cancel
Showing results for 
Search instead for 
Did you mean: 

ADC1 + ADC5 with DMA and HRTIMER trigger dont work together on STM32G474

KoRba88
Associate III

Hi

I've configured two ADC 1 and ADC5 in independend mode with DMA and triggered by master compare from HRTIMER.

I have two problems

First. When I have started two ADCs by HAL_ADC_Start_DMA one by one

my code freeze on debug after this, but when I set the one GPIO to toggle in HAL_ADC_ConvCpltCallback I see that converters are working

even they dont work when I use two diffrent compare registers in HRTIMER with two diffrent values to trigger them out of phase

With one ADC at once code works perfectly and I can debug code normally

Second issue is that i see that GPIO toggle (BSRR used) in HAL_ADC_ConvCpltCallback is not in sync with HRTIMER edges and it varies from cycle to cycle. (blue is PWM from HRTIMER, yellow is GPIO toggle after ADC callback)

0693W000001sTc6QAE.png

10 REPLIES 10

I don't know why.

Try reducing the program to a bare minimum, or maybe better, start from scratch to write a minimal program exhibiting the problem. Try a different DMA channel. Try selectively disabling individual DMA interrupt sources. Try to clear the interrupts using CGIF1.

This is not the reason, and should be harmless, but don't use RMW (i.e. |=) with the IFCR register, write directly a value.

JW