cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G474 Multiple ADC DMA crash

Itamar Eliakim
Associate III

Hey.

I am trying to run ADC DMA sampling on multiple buses/channels, running in parallel to a few FreeRTOS tasks.

The following initialization causes unstable behavior and device halt upon boot:

 

HAL_ADC_Start_DMA(&hadc1, (uint32_t*)adc1_buf, 3);
HAL_ADC_Start_DMA(&hadc2, (uint32_t*)adc2_buf, 2);
HAL_ADC_Start_DMA(&hadc3, (uint32_t*)adc3_buf, 5);
HAL_ADC_Start_DMA(&hadc5, (uint32_t*)adc5_buf, 2);

 

 

 

Everything works perfectly if I comment out one line (any of them), and unstable/halts if I initialize all 4 streams.

 

Any idea?

 

 

Thanks.

Itamar

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Perhaps the sum of those calls stresses the system too much, either overwhelming the DMA with requests or the CPU with interrupts. What sample rates are we talking about here? What happens if you reduce those by a factor of 10?

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
TDK
Guru

Perhaps the sum of those calls stresses the system too much, either overwhelming the DMA with requests or the CPU with interrupts. What sample rates are we talking about here? What happens if you reduce those by a factor of 10?

If you feel a post has answered your question, please click "Accept as Solution".
Itamar Eliakim
Associate III

Wonderful. Thanks @TDK!
That was it :) Drastically increased the clock divider on all ADCs, and changed NVIC priority, everything now works properly.