AnsweredAssumed Answered

I2C/FMPI2C lockup/error handling

Question asked by Rolf Welde Skeie on Feb 27, 2017
Latest reply on Feb 27, 2017 by KIC8462852 EPIC204278916

Hi,

I've got two STM32F410 communicating over I2C using HAL FMPI2C library (v 1.14.0).

Both initially enables FMPI2C listen with interrupt.

 

When one of the STMs wants to send data, it:

  - disables FMPI2C interrupt listen (HAL_FMPI2C_DisableListen_IT())

  - waits for FMPI2C to become ready

  - then transmits the data with FMPI2C_Master_Transmit

  - It re-enables FMPI2C listen with interrupt once done(HAL_FMPI2C_EnableListen_IT()).

Write-read operations also do a Master_Receive before returning to listen state.

 

The receiving party enters HAL_FMPI2C_AddrCallback() based on interrupt which:

  - disables FMPI2C interrupt listen (HAL_FMPI2C_DisableListen_IT())

  - does a HAL_FMPI2C_Slave_Receive()

  - re-enables FMPI2C listen with interrupt once done(HAL_FMPI2C_EnableListen_IT()).


All of this works just fine until I put some pressure on the STMs and I get error callbacks (HAL_FMPI2C_ErrorCallback()) with various error codes (ARLO, BERR), eventually causing all transfers to fail due to timeout. Line monitoring reveals usually that SCL is stuck in low, but SDA have also been stuck at low. I need to reset one of the STMs, sometimes multiple times, in order to release the lines once this condition occur.

Anyone got any ideas why this happens and what I'm doing wrong?
Are there any special calls I need to do to clean up after an error condition has occured?


Thank you for your time.

Outcomes