2025-09-24 8:10 PM
Hi i'm using STM32F411RE.
I've been reading data from ADC IC using I2C communication. It's 400Khz, and I'm reading using DMA.
By the way, if another interrupt with high priority occurs during I2C communication, it runs that interrupt during I2C communication and reads I2C data again.
If I operate with DMA, isn't it irrelevant to the interrupt because I2C operates on hardware?
Of course, the data comes exactly.
If you have any question, please ask me.
Thank you.
Solved! Go to Solution.
2025-09-29 4:50 PM
When I checked the library, I checked the contents related to interrupt. I should find another way. Thank you.
2025-09-25 1:38 AM
@giwonKIM wrote:if another interrupt with high priority occurs during I2C communication, it runs that interrupt during I2C communication and reads I2C data again. .
Not sure what you mean by that?
Perhaps show a minimum but complete example which illustrates this.
@giwonKIM wrote:Of course, the data comes exactly.
So there isn't actually any problem?
2025-09-25 1:58 AM
As @Andrew Neil pointed out, the question is not very comprehensible.
... if another interrupt with high priority occurs during I2C communication, it runs that interrupt during I2C communication and reads I2C data again.
How would you know it reads again ?
Except you have a DMA interrupt activated that would notify you.
Unless you need equidistant samples, you can transfer the ADC values to some memory location via DMA in the background, and read them when convenient.
Otherwise (i.e. equidistance is required) you could transfer a larger number of samples, and activate a DMA TC interrupt.
You would need to copy the ADC buffer data in the interrupt handler, since DMA would begin to overwrite it.
Prioritisation within the context of other interrupts are your responsibility.
2025-09-25 6:28 AM
If something is using DMA, it will function at the same time as the interrupt. The IRQ will not stop or pause it.
2025-09-25 7:39 PM - edited 2025-09-25 7:39 PM
@giwonKIM Does the STM32 pause clocking on the I2C while the other interrupt handler executes?
The I2C transfer on STM32 unfortunately has several steps, some of them use interrupts (even polling IIRC), so what you see is possible. For more details please check the library source.
2025-09-29 4:50 PM
When I checked the library, I checked the contents related to interrupt. I should find another way. Thank you.