Skip to main content
Associate III
May 9, 2024
Question

ADC Multichannel Polling Example

  • May 9, 2024
  • 5 replies
  • 1406 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.

5 replies

mƎALLEm
ST 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.

 

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
KenLeeAuthor
Associate III
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?

mƎALLEm
ST Technical Moderator
May 10, 2024

Did you set ADC continuous mode?

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.