2023-08-25 08:21 AM - edited 2023-08-25 08:22 AM
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
Solved! Go to Solution.
2023-08-25 08:39 AM
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?
2023-08-25 08:39 AM
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?
2023-08-26 12:05 AM
Wonderful. Thanks @TDK!
That was it :) Drastically increased the clock divider on all ADCs, and changed NVIC priority, everything now works properly.