SMT32F730 I2C write with strange error

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: barthess, RoccoMarco

tecnologic
Posts: 116
Joined: Tue Jan 10, 2012 8:42 am
Has thanked: 19 times
Been thanked: 4 times

SMT32F730 I2C write with strange error

Postby tecnologic » Sun Feb 23, 2020 3:51 pm

Hi all,

here is my test case i want to write 16bytes with the values from 0x50 to 0x5F in the first 16byte page of a AT34C04 EEPROM conected to the I2C Bus.

Code: Select all

// write buffer out to ram so that dma can access it.
cacheBufferFlush(write_buffer, sizeof(write_buffer));

status |= i2cMasterTransmitTimeout(I2CP, RW_ADDRESS,
         write_buffer, write_length + 1, nullptr, 0, WRITE_TIMEOUT);

writebuffer is 17bytes long with a 0 for the EEPROMs internal Address in byte 0 of the buffer an then followed by 0x50 - 0x5F.

An here is the problem:
i2c_capture_with_addr_error.jpg

the Address and the first byte are correct but then there is a additional 0????
i2c_error_write_buffer.jpg

This is the writebuffer how it is given to the i2cMasterTransmitTimeout function.

From the code of the i2cMasterTransmitTimeout function i can not see where the first 0 comes from. it just gives the buffer pointer to the dma. And i flushed the cache right before the call so data has to be in ram.

Anyone has an idea?

Thanks

Tec

User avatar
Giovanni
Site Admin
Posts: 12747
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 694 times
Been thanked: 572 times
Contact:

Re: SMT32F730 I2C write with strange error

Postby Giovanni » Sun Feb 23, 2020 6:31 pm

Hi,

Everything looks shifted by one position, very strange.

Is your device address a 7 bits one? if not then it could add another byte for the extended address.

Giovanni

tecnologic
Posts: 116
Joined: Tue Jan 10, 2012 8:42 am
Has thanked: 19 times
Been thanked: 4 times

Re: SMT32F730 I2C write with strange error

Postby tecnologic » Sun Feb 23, 2020 6:57 pm

Hi Giovanni,

I just found the problem. 34xx EEPROM for SPDs of modern RAM DIMMs have 2 256byte halfs to set the half u want to access u need to send an "Set Page Address" command. Which is basically an I2C write with address and according to the data sheet TWO dummy bytes. An i send this command right before the write. Thing was now the EEPROM sends a NACK on the first dummy byte so I2C HW stops transmission and the second dummy byte is some where in the i2C buffer. And this was 0 in my case. When i set it to 0xA5 it sends address 0xA5 0x00 0x50 .....

So my fault. Nasty EEPROMs

Thanks anyway.


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 2 guests