HAL bug with 1-byte I2C reads
Greetings all,
I'm using the 1.6.0 release of the STM32F4xx_HAL_Driver, and I believe there's a problem with doing 1-byte I2C reads using the HAL_I2C_Master_Receive_IT function.Doing reads of more than one byte works fine:The user calls HAL_I2C_Master_Receive_IT
The I2C_EV_IRQn interrupt fires, which calls HAL_I2C_EV_IRQHandler
The HAL_I2C_EV_IRQHandler finds I2C_FLAG_MSL set (implying ''Master'' mode)
The event is processed by the ''Master'' portion of the HAL_I2C_EV_IRQHandler function
Once all bytes are read, the HAL_I2C_MasterRxCpltCallback function is invoked
The user calls HAL_I2C_Master_Receive_IT
The HAL_I2C_Master_Receive_IT function
sets I2C_CR1_STOP
(to stop after the first byte)The I2C_EV_IRQn interrupt fires, which calls HAL_I2C_EV_IRQHandler
The HAL_I2C_EV_IRQHandler
finds I2C_FLAG_MSL clear
(implying ''Slave'' mode)The event is processed by the ''Slave'' portion of the HAL_I2C_EV_IRQHandler function
The ''Slave'' portion of HAL_I2C_EV_IRQHandler cannot invoke HAL_I2C_MasterRxCpltCallback
I can't switch to the DMA version, as I'm out of DMA channels
I can't switch to the polling version, as this is a medical device with hard real-time requirements.
I can't just round up all 1-byte reads to 2 bytes as the part I'm talking to is intolerant to that kind of behavior.