cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with I2C mailbox write and read

DS.4
Senior II

Using st25DV tag on our embedded system. 

In short, the second I2c read does not display the same data that was written. It differs, as the first byte changes to 0xFF.

 

When I write to the mailbox the first time, and then read the data, it's the same. ( usually just a couple of bytes )

But when I read it again, I see that the first byte changed to 0xFF, and all of the bytes that I had written were shifted.

 

Here is what it looks like when writing  "01 02" to the mailbox and reading it

 

First read:

 

01 02 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

 

Second read: 

ff 01 02 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

 

 

According to the documentation, I can read it multiple times, don't understand why it fails.

 

DS4_0-1703797011228.png

 

 

 

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
1 ACCEPTED SOLUTION

Accepted Solutions
Rene Lenerve
ST Employee

Hi DS.4,

Data are not shifted in the Mailbox memory, so reading multiple time at same address give you same data (until they are overwritten or cleared).

Are you sure to display correctly the buffer where you store your data.

Maybe sharing some code may help to see what's wrong.

 

Kind Regards.

View solution in original post

3 REPLIES 3
Rene Lenerve
ST Employee

Hi DS.4,

Data are not shifted in the Mailbox memory, so reading multiple time at same address give you same data (until they are overwritten or cleared).

Are you sure to display correctly the buffer where you store your data.

Maybe sharing some code may help to see what's wrong.

 

Kind Regards.

JL. Lebon
ST Employee

Hello, 

Yes, it is possible to read multiple time into the mailbox the exact same data. There is no shift.
Are you doing something else on the I2C bus between the two reads of the mailbox ?

Best regards.

I suspect the source of my issue to be the I2C write. I am writing 256 bytes with a method that supports only 255.

So I guess writing is done twice. (255 +1 ). 

Please see my other question regarding writing with I2C with DMA.