cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 - HAL_I2C_STATE_BUSY_RX issue

wasp.lahis
Associate

I'm having trouble with i2c communication. In my i2c bus, i have 4 boards (STM32L4 Sensortiles) and sometimes one of them blocks the bus and the others stop communicating consequently. When I reset that one that blocks the bus, all boards starting working again.

In my debugs, this bug happened when HAL_I2C_GetState(&hi2c3) returns HAL_I2C_STATE_BUSY_RX, even my others i2c functions HAL_I2C_Slave_Receive_IT and HAL_I2C_Slave_Transmit_IT returns HAL_OK:

0693W000003OstZQAS.png

Any ideas what I'm doing wrong? Thanks.

2 REPLIES 2
T J
Lead

I believe the problem with IIC being dodgy is the clock source and pin speed.

make sure your IIC clock source is above 2MHz and set the pin to very fast.

prain
Senior III

HAL_I2C_STATE_BUSY_RX is a temporary state. It should return to idle state. step into code and check. Usually the transmit/receive complete interrupt resets the HAL to idle state.