cancel
Showing results for 
Search instead for 
Did you mean: 

Error In Reading Multiple ADC Channels using Interrupt

Sumukha
Associate

I am trying to read multiple channels of ADC (like Temperature sensor channel, Vbat channel, Vrefint ...) using the interrupt method, but I am not able to read all the Channel readings , only the readings of first channel is being reflected for all the channels. I have configured the ranks for each channel and the end of conversion is set to End of Sequence Conversion. If anyone has any Idea on how to read multiple channels of ADC using interrupt, do answer and help.

2 REPLIES 2
Ozone
Lead II

Because it doesn't work that way.

All channels of one ADC have one common result register, which reflects the result of the last conversion.
If you have a sequence of several channels, you need either to keep track of the channels and gather the results by individual EOC interrupts before the next conversion finishes, or use DMA with a matching configuration and configure a DMA TC (transmission complete) interrupt to pick up all results at once.

I'm not a HAL/Cube user, I don't know how it is done there.
But I recommend to consult the reference manual (ADC interrupts section) to get a better understanding.

Saket_Om
ST Employee

Hello @Sumukha 

Please, refer to the LL example Projects/STM32F411RE-Nucleo/Examples_LL/ADC/ADC_MultiChannelSingleConversion as starting point for your application. The covertion is handled by the DMA and the IT. 

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar