FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
5234 Discussions

Why I2C Master core not work?(MAX10)

jpark198
Beginner
566 Views

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
1 Solution
druva1
New Contributor I
485 Views

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

1 Reply
druva1
New Contributor I
486 Views

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.

 

Reply