This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VH-Q1: Test code to ready EEPROM using I2c driver

Part Number: TDA4VH-Q1

Tool/software:

Hello, I am trying to read one byte of data from the EEPROM device AT24CM01.

I only have one question regarding the device address that I should use for writing vs reading.

e.g.

I use the dummy code below to write one byte:

#define I2cChannel_EEPROM_WR_ADDR   (0u)

#define I2cChannel_EEPROM_WR_DATA    (1u)

#define I2cChannel_EEPROM_RD_ADDR    (2u)

#define I2cChannel_EEPROM_RD_DATA     (3u)

#define I2cSequence_EEPROM_Write_MCU_I2C0    (0u)

#define I2cSequence_EEPROM_Read_MCU_I2C0    (1u)

uint8 EEPROM_Addr[2] = {0x00,0x00};
uint8 Tx_Buffer_AT24CM01[1] = {0x22};
uint8 Rx_Buffer_AT24CM01[1] = {0};
void function()
{
  I2c_SetupEBDynamic(I2cChannel_EEPROM_WR_ADDR, 0x50, &EEPROM_Addr[0], NULL_PTR, 2u);
  I2c_SetupEBDynamic(I2cChannel_EEPROM_WR_DATA, 0x50, &Tx_Buffer_AT24CM01[0], NULL_PTR, 1u);
  I2c_AsyncTransmit(I2cSequence_EEPROM_Write_MCU_I2C0);
}

And I use the dummy code below to read one byte from the same address

void function()

{

      I2c_SetupEBDynamic(I2cChannel_EEPROM_RD_ADDR, 0x50, &EEPROM_Addr[0], NULL_PTR, 2u);
      I2c_SetupEBDynamic(I2cChannel_EEPROM_RD_DATA, 0x51u, NULL_PTR, &Rx_Buffer_AT24CM01[0], 1u);
      I2c_AsyncTransmit(I2cSequence_EEPROM_Read_MCU_I2C0);

}

So, as the last bit of the device address shall 0 for writing and 1 for reading, my question is: should I use the adress 0x51 instead of 0x50 when calling I2c_SetupEBDynamic to indicate a read operation ?

or do you activate that bit internally before seding the address to the bus when a read operation is detected ?