Skip to main content
Explorer
August 25, 2023
Solved

STM32G474 Multiple ADC DMA crash

  • August 25, 2023
  • 2 replies
  • 1578 views

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

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

    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?

    2 replies

    TDKAnswer
    Super User
    August 25, 2023

    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?

    Explorer
    August 26, 2023

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