Skip to main content
Visitor II
November 23, 2024
Question

Error In Reading Multiple ADC Channels using Interrupt

  • November 23, 2024
  • 2 replies
  • 677 views

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.

    This topic has been closed for replies.

    2 replies

    Explorer
    November 23, 2024

    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.

    Technical Moderator
    November 25, 2024

    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.