cancel
Showing results for 
Search instead for 
Did you mean: 

Why does the HAL non-blocking I2C function HAL_I2C_Master_Seq_Transmit_IT() appear to block execution until the I2C transaction has completed?

NPurv.2
Associate

I am using an STM32F407 processor chip and want to operate as I2C Master on two interfaces, I2C2 and I2C3. It is essential for our application that both busses can be utilised efficiently (with minimal gaps between transactions) and at the same time. Also I am interfacing with existing devices which expect to be driven using the repeated start condition.

I am therefore using the functions HAL_I2C_Master_Seq_Transmit_IT() and HAL_I2C_Master_Seq_Receive_IT() to operate in non-blocking sequential/interrupt mode. I use the "Transmit" function to send a message to the slave and then inside the "Transmit Complete" function HAL_I2C_MasterTxCpltCallback() I use the "Receive" function to obtain the slave's response.

This all works perfectly EXCEPT that the "Transmit" function appears to block for the duration of the entire transmission, and doesn't seem to return until the "Receive Complete" function HAL_I2C_MasterRxCpltCallback() has been called.

I am totally puzzled why the non-blocking function should appear to block, and this of course defeats the whole object of using the sequential/interrupt functions.

I would be grateful for anyone who can shed some light on this. Otherwise I could consider using DMA mode, except it doesn't seem to support the repeated start condition which we need. The only other option would I guess be to bypass the HAL drivers and use the low-level (LL) interface functions directly.

Any suggestions or clues on this will be appreciated.

0 REPLIES 0