Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
98 Views

Why I2C Master core not work?(MAX10)

Jump to solution

I use DE10-LITE board.

I try to use I2C for connect with external ROM.

In QSYS, I set up NIOS and I2C Master Core.

 

it is my code

 

GPIO(0) <= '0' WHEN SDA_OE = '1' ELSE 'Z';

GPIO(1) <= '0' WHEN SCL_OE = '1' ELSE 'Z';

 

SDA <= GPIO(0);

SCL <= GPIO(1);

 

u0 : component QSYS

port map (

clk_clk         => MAX10_CLK1_50,         --       clk.clk

reset_reset_n      => RST,      --      reset.reset_n

i2c_0_i2c_serial_sda_in => SDA, -- i2c_0_i2c_serial.sda_in

i2c_0_i2c_serial_scl_in => SCL, --         .scl_in

i2c_0_i2c_serial_sda_oe => SDA_OE, --         .sda_oe

i2c_0_i2c_serial_scl_oe => SCL_OE --         .scl_oe

);

 

and i write program code in Eclips like this.

 

 i2c_dev = alt_avalon_i2c_open("/dev/i2c_0");

 if (NULL==i2c_dev)

 {

  printf("Error: Cannot find /dev/i2c_0\n");

  //return 1;

 }

 

 while(1)

 {

  alt_avalon_i2c_master_target_set(i2c_dev,SLAVE_ROM_ADDR);

 

  status=alt_avalon_i2c_enable(i2c_dev);

 

  i2c_tx_buf[0] = 0x00;

  i2c_tx_buf[1] = 0x00;

  i2c_tx_buf[2] = 0x03;

  i2c_tx_buf[3] = 0x04;

  status=alt_avalon_i2c_master_tx(i2c_dev, i2c_tx_buf, 4, 0);

}

 

and i connect gpio pins to oscilloscope. but it doesn't send any signals.

 

what is problem?

0 Kudos

Accepted Solutions
Highlighted
Novice
17 Views

Re: Why I2C Master core not work?(MAX10)

Jump to solution

I recommend to check out this example of Master-Slave https://www.macnica.co.jp/business/semiconductor/articles/intel/129485/

is in Japanese but you can get the example files and then translate the bits that you do not understand, the example worked for me.

 

View solution in original post

0 Kudos
1 Reply
Highlighted
Novice
18 Views

Re: Why I2C Master core not work?(MAX10)

Jump to solution

I recommend to check out this example of Master-Slave https://www.macnica.co.jp/business/semiconductor/articles/intel/129485/

is in Japanese but you can get the example files and then translate the bits that you do not understand, the example worked for me.

 

View solution in original post

0 Kudos