AnsweredAssumed Answered

STM32F4xx: I2C multiple slaves, very strange behavior

Question asked by itko.itko on Oct 16, 2014
Latest reply on Nov 14, 2014 by itko.itko
Hello all,

I'm attempting to talk to two devices, a barometer (MS5611) and a magnetometer (HMC5883L), using I2C with DMA on an STM32F4. The barometer runs on a timer (10ms), while the magnetometer runs through an interrupt line.

The slaves work well together, communicating only when the other isn't as verified by a logic analyzer. However, occasionally (~ every 20 secs), when the MCU attempts to write to the barometer the start condition is immediately followed by a stop condition. No address is sent, it is a void message! I have attached pictures below.

I2C working nicely until the last part:
start-stop1-low.png

Zoom in on the last three communications. The first is a barometer write followed by read. The second is a magnetometer interrupt triggering a write followed by read. The last is the faulty barometer communication.

start-stop-low.png


This is a close-up of the last faulty communication. You can see that SDA is low for 4us, which is slightly longer than usual.

start-stop-zoom-low.png

This issue causes the I2C to timeout at the I2C_WaitOnMasterAddressFlagUntilTimeout function.

I do not believe this is associated with DMA as I am using CubeMX code, where the Addressing phase occurs before any DMA communication.

I have also tried adding an EEPROM (4FC128) as a third slave. The eeprom exhibited the same problem. Only the Magnetometer does not exhibit this, making me think it might be causing the problem?

Any help with this strange issue would be appreciated.</map></div>

Outcomes