AnsweredAssumed Answered

STM32F1 I2C with DMA, processor stays busy during read/write operation

Question asked by Zawyer on Apr 29, 2016
Latest reply on May 2, 2016 by Zawyer
Everything is working, just not as I thought it should be. As the logic analyzer shows below, the main loop is interrupted for almost the same amount of time the I2C operation takes.

Capture.PNG

Notes:
- I'm using Cube generated HAL library
- First and last thing on the main loop is to toggle a pin, that's what you see on the analyzer's "Main loop" channel (High at the beginning, low at the end)
- Same thing for the "DMA complete" channel, a pin is pulsed for the duration of the HAL_I2C_MemRxCpltCallback interrupt routine

I tracked down the portion of code causing this busy time to this private function I2C_RequestMemoryRead  it even receives a timeout as a parameter (35ms defined by the library)
Looking at the comments inside this function, gives me the impression that there's some bit banging going on?
I thought the dedicated I2C module was supposed to deal with this stuff
Where am I wrong?

Attachments

Outcomes