cancel
Showing results for 
Search instead for 
Did you mean: 

I2C reads FF and stucks

malb0794
Associate II

Hi everyone! 

I'm using two uC, STM32F105VCT7TR and MSP430G2452, and I'm establishong an I2C communication between them, with the STM32F105 being the master and MSP430 the slave. For the write operation, the communication works fine. However, when performing a read operation, things do not go as expected - I can't read the data (every time I get FF data) and the bus gets stuck.

Here's what I'm doing to read the MSP data.

 

print1.png

print2.png

 Here's the scope.

scope_0.png

 

Could anyone help me, please?

12 REPLIES 12
Geek09
Associate

Did you check your hardware setup ?Maybe try reading from different register or reading different number of bytes to eliminate possibilities?

For the single-byte read, you have to clear I2C_CR1.ACK *before* clearing ADDR.

Read and follow "Method 2" in "Master receiver" subchapter in I2C chapter in RM0008, there are 3 distinct cases: for 1, 2, and more read bytes.

JW

 

AScha.3
Chief III

Just looking at your scope pic , i see two problems :

- signal levels 4Vss  --- how can this be real?  3,3V is max. with 3,3V cpu !

- SDA shows 3 (!!!) voltage levels - nothing, that a I2C can ever do - if hardware ok.

 

+

Is this on both chips I2C , open drain ? + pullups ? 

What value are pullups ? 

If you feel a post has answered your question, please click "Accept as Solution".

> SDA shows 3 (!!!) voltage levels - nothing, that a I2C can ever do - if hardware ok.

This is consequence of a small series resistor in SDA, a common trick to distinguish master and slave when looking at the waveforms on an oscilloscope.

JW

Yes, I already checked the hardware and tried reading another register.

The hardware is adequate and even changing the register or the number of bytes it is not possible to read it.

I had followed what is written in the reference manual, but I couldn't read it either.

Clearing the ACK as suggested keeps reading FF, but now SDA stays high and SCL gets stuck low.

The hardware is OK.

Boths uC are configured correctly.

The value of the pullups is 2k2.

Clever !

But still : 4V level - why ?  (3,6 is typ. max .)

+

>This is consequence of a small series resistor in SDA

ok, but here seem the "3." level generated by the "helping" resistor close to 1V above gnd, so this might be close to wrong 0->1 decision .... right ?  ( try without these resistor ... same effects ?)

If you feel a post has answered your question, please click "Accept as Solution".

> Clearing the ACK as suggested keeps reading FF,

That's what your slave reads from that address. As the waveform shows, the next byte would read non-FF.

> but now SDA stays high and SCL gets stuck low.

This to me sounds like clock stretching due to missing STOP.

JW