I2C write data shifted

Hi Robert,

I am trying to write EEPROM through the call i2c_write in board_detect.c. Data are partially written. But it is shifted 2 bytes ( i.e. data are placed into address + 2 ) as shown :
image
another problem is that first 16 byte data is not written.
I didn’t call i2c_init, etc. Assumed that i2c is initialized. Do you have any suggestions that may have caused these problems?

Thank you for your help,
David

Hi Robert,

After calling ti_i2c_eeprom_init() , ti_i2c_set_alen(), and alen = 2 in i2c_write() call, it worked.

Regards,
David

Ah! I think you answered a problem I was working last night on i2c reading… I’m getting some weird shifting on soft-reboot’s with i2c read’s…

For writing to the eeprom, I’ve only used the shell calls:

Reading:

i2c md 0x50 0x00.2 20

Writing:

i2c mw 0x50 0x00.2 ff

Regards,

At first, I check i2c_write (… alen, ), it was not used inside the function i2c_write itself, but I believe it is passed into I2C_ADAP->write().
The data shifted by 2 bytes, it is the data struct is null terminated for string. So added 2 bytes. Cannot directly passing eeprom data struct pointer for writing.
Tricky stuff.

Regards,
David