How to Fix ADC Sampling Triggered by Counter Rollover
- March 18, 2026
- 3 replies
- 344 views
Hi,
I am currently working on a project where I want to adjust the duty cycle and trigger an ADC measurement on every counter rollover.
I managed to get the PWM running in center-aligned mode, but I’m having trouble triggering the counter rollover at the correct moment.
To verify whether the trigger is correct, I routed the output compare signal to an external pin and observed it on an oscilloscope.
The basic idea is to run an additional counter alongside the PWM. This counter should count up to ARR and then generate a trigger that starts the ADC conversion. Becuase in the center aligned mode two update event occurs both on CNT=0 and CNT=ARR.
On the oscilloscope, it looks like the trigger—presumably when CNT = 0 (at least that’s my assumption)—produces an edge.
Im using NUCLEO-G491RE.
What could I be missing here? What might be causing this behavior?



Yellow (PWM TIM8 Channel3), Blue (PWM TIM8 Channel1), Orange (Capture Compare TIM8 Channel 4)

Thank you in advance!
Simon


