cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 ADC and DMA?

KHans.4
Associate

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

1 ACCEPTED SOLUTION

Accepted Solutions
gbm
Lead III

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

View solution in original post

1 REPLY 1
gbm
Lead III

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