This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Possible bug in TWI HW

Hi

I'm having a strange behaviour when using the TWI HW peripheral for reading from an I2C device. My application tries to read one byte from a register in a I2C device. As background:

-I2C address: 0x55 -Register address: 0x0A -Expected value: 0x10 -I2C speed: 50KHz (very slow: at higher rates more errors)

The problem is that when reading, I've detected that the first SCL pulse I sent when starting to receive the register data has a variable width. Normally, there's no problem because its width is wider than normally, but sometimes (1/10) its witdh is smaller than 4us. When this happens, the I2C device doesn't recognize this pulse as a SCL pulse, so the received data is shifted one position. In other words: when expecting 0x10, i get 0x08.

In the first image, you can see a successul data transaction. scope_0.bmpimage description

The second image is a zoom over the first SCL pulse when receiving the data register. You can see this pulse is wider than the following ones. scope_2.bmpimage description

In the third image, its width is now 3.4us, causing the problems. scope_4.bmpimage description

To try to debug this problem, I've disabled the SD, and my SW is inside a while (1) and only reading this register. Only the TWI peripheral is enabled.

I've no found errata references and no similar problems in this forum. Am I getting crazy?

Any guess?

Thanks in advance

Cheers,

Elena

Parents Reply Children
No Data
Related