Skip to main content
PJera.1
Associate
May 18, 2020
Question

Start multiple ADC's DMA

  • May 18, 2020
  • 2 replies
  • 817 views

I have tried to get ADC results from 8 different chanels on 3 ADC's using DMA so that the fresh values are always avaliable to me on STM32F303

I used Cube MX to configure the ADC's and DMA's. After initisalization I did:

   HAL_ADC_Start_DMA(&hadc1, (uint32_t*)ADC1Buff, 4);

   HAL_ADC_Start_DMA(&hadc2, (uint32_t*)ADC2Buff, 2);

   HAL_ADC_Start_DMA(&hadc3, (uint32_t*)ADC3Buff, 2);

I only get ADC1 running.

I can't even step into the second line.

If I interchange the lines, it always works for the ADC in the first row, and skips the second and third one.

What am i missing?

This topic has been closed for replies.

2 replies

TDK
May 18, 2020

Your ADC is running so fast that once the first one starts, the processor is stuck calling IRQs and has no time available for the main loop.

Slow down your sample rate and trigger off of a timer, or disable interrupts if you don't need them.

Be wary of overloading your DMA with this method. There is only so much bandwidth.

"If you feel a post has answered your question, please click ""Accept as Solution""."
PJera.1
PJera.1Author
Associate
May 18, 2020

Thank you for a quick answer,

I already had them slowed down to 61.5 cycles, now I've tried 601.5 cycles, and it started to work.

The best part of your advice was the "disable IT" tip. I don't need them and I will them and keep the speed at 61.5.

Funny that all other code including FreeRTOS worked fine.

B.R.

Peter