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.
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.