Skip to main content
KHans.4
Visitor II
September 25, 2022
Solved

STM32F103 ADC and DMA?

  • September 25, 2022
  • 1 reply
  • 1112 views

Hello

I am familiar with STM32. I have a simple project with CubeMX

One ADC reads 3 channels, continuousmade disable , DMA active.

I turn everything on and start the first ADC conversion with a function

HAL_ADC_Start_DMA.

My questions

  1. How do I start another ADC conversion?
  2. What should I test to make the program wait for the ADC conversion to complete and the data transfer via DMA?

Thanks you

This topic has been closed for replies.
Best answer by gbm

Typically you would start the conversion in timer interrupt routine. This is also a convenient place to handle the results of a previous conversion, before starting the new one. Another possibility is to use hardware triger via timer for starting the conversion and handling the results in DMA channel interupt. Alternatively, without DMA interrupt, you may test the DMA transfer complete flag.

1 reply

gbm
gbmAnswer
Principal
September 25, 2022

Typically you would start the conversion in timer interrupt routine. This is also a convenient place to handle the results of a previous conversion, before starting the new one. Another possibility is to use hardware triger via timer for starting the conversion and handling the results in DMA channel interupt. Alternatively, without DMA interrupt, you may test the DMA transfer complete flag.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice