Intel MAX10 I2C doesn't send any signals. how can i fix it?

231 Views Asked by At

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.

there is no error with compile.

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
);

GPIO are inout pins.

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.

i also use BusBee serial bus monitor for chseck I2C signals. but it can not detect any signals.

what is problem?

0

There are 0 best solutions below