cancel
Showing results for 
Search instead for 
Did you mean: 

stm32 i2c problem after reciving 3 bytes

Posted on January 31, 2014 at 17:14

Hi,

I have a problem with i2c interface of stm32f103rbt6 mcu. I use interrupts for sending/receiving data, and everything is ok until slave (MS5611) sent 3 bytes. The bytes are received correctly, but i2c interface is death after this operation.

You can see whole transmission in attached i2c_1.png file.

The packed labaled as ''2'' is detailed in file i2c_2, it's just receiving of 3 bytes.

After that I try to send 1 byte (same like packed labaled as 1), but the i2c interface sends only the start and  end sequence. Only one event is trigered

case I2C_EVENT_MASTER_MODE_SELECT:    // EV5

                // sending addres and set transmiter mode

                I2C_AcknowledgeConfig(I2C1, ENABLE);

                I2C_Send7bitAddress(I2C1, gv_i2c1_addr, I2C_Direction_Transmitter);

What do I wrong?

Thank you in advance

Krzysiek

#stm32 #i2c
2 REPLIES 2
chen
Associate II
Posted on January 31, 2014 at 17:42

Hi

''I have a problem with i2c interface of stm32f103rbt6 mcu. I use interrupts for sending/receiving data, and everything is ok until slave (MS5611) sent 3 bytes. The bytes are received correctly, but i2c interface is death after this operation.''

I think it is because you have pushed the I2C peripheral into an unknown state.

Your I2C transmission for a Master to Slave read is not correct.

See :

http://en.wikipedia.org/wiki/I2c

For the master to read bytes from a slave - it must first send the slave address + write, set up the read address, no byte etc. Then it must send a re-start and the slave address + read, then the slave can reply.

Posted on January 31, 2014 at 19:12

Hi Chen Chung,

Sorry, but you are wrong. There are simple i2c devices, without registers, so i2c sequence is much simpler then you think ;).

Please compare MS5611 data sheet with files attached by me. Everything is ok, and I could read the prom, start conversion, read the results, but only one time. After reading results (3 bytes) the i2c interface stops working.

Regards

Krzysiek