Skip to main content
Visitor II
May 9, 2024
Question

ADC Multichannel Polling Example

  • May 9, 2024
  • 1 reply
  • 1371 views

I'm writing firmware for stm32c011f4u6 using Keil5.

I downloaded and checked an example about ADC from the homepage, but I only found the code that uses DMA.

Is there any example of using ADC with Polling instead of DMA?

Also, I need an example for multi-channels, not single channels.

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    May 9, 2024

    Hello,

    This is not related to the tool (Keil or whatever else) but to the MCU itself.

    It's possible by reading DR register before the next conversion but it's not recommended in scan mode as you may lose reading samples. That's why there is no polling mode example in scan mode.

    So I recommend to use DMA instead.

     

    KenLeeAuthor
    Visitor II
    May 10, 2024

    Thank you for your reply.

    when I use DMA in my program and I enable DMA interrupt, the interrupt handler is infinitely generated, and the program gets stuck in interrupt.

    I tried maximizing the sampling cycle, but the same thing happens. I want to read each channel in the ADC only once and move on to the next sequence in the program. 

    How can I fix this?

    Technical Moderator
    May 10, 2024

    Did you set ADC continuous mode?