AnsweredAssumed Answered

STM32F401: HAL Busy never clears after write

Question asked by Tyler Arnold on Jan 20, 2018

hi there, 

  I am debugging an issue on the M4 where the SR2 hal busy bit never clears after a write transaction. The slave device asserts clock stretching but releases the clock. 

 

 logic analyzer capture of clock stretching

 

 

with some debug added to the hal code, we see the following:

/vendor/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c:5265: I2C_WaitOnFlagUntilTimeout SR2

./vendor/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c:5272: I2C_WaitOnFlagUntilTimeout start: flag 100002 SR2 0

./vendor/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c:5263: I2C_WaitOnFlagUntilTimeout SR1

./vendor/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c:5270: I2C_WaitOnFlagUntilTimeout start: flag 10001 SR1 1

./vendor/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c:725: HAL_I2C_Master_Receive: HAL_I2C_STATE_READY

./vendor/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c:5265: I2C_WaitOnFlagUntilTimeout SR2

./vendor/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c:5272: I2C_WaitOnFlagUntilTimeout start: flag 100002 SR2 2

./vendor/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c:5281: I2C_WaitOnFlagUntilTimeout poll: flag 100002 SR2 2

./vendor/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c:5292: I2C_WaitOnFlagUntilTimeout to: flag 100002 SR1 0 SR2 2

./vendor/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c:730: HAL_I2C_Master_Receive: HAL_BUSY, start = 42211, end = 42274

 

 

Outcomes