cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7: TIM PWM DMA does not directly stop transmitting when HAL_TIM_PWM_Stop_DMA() is called in the HAL_TIM_PWM_PulseFinishedCallback() function.

eeeeee
Associate III

I have a buffer of 24 values. When this buffer is fully transmitted I want the TIM PWM to stop. It sends out 4 more values after I stop the DMA in the pulse finished callback. Why does this happen?

0693W00000KdOKrQAN.pngThanks in advance!

2 REPLIES 2
TDK
Guru

It probably just takes some time for HAL_TIM_PWM_PulseFinishedCallback to get called, during which time the additional pulses happen. What is the timescale here? Slow down the pulses by an order of magnitude and see if it still happens. You can use a repetition counter + onepulse mode to avoid this, or have the timer gated by another timer to have it enabled for an exact amount of time. You could also pad your buffer so values after 24 are either 0% or 100% duty cycle.

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

I had room to increase the CPU clock frequency and that did the trick. I've read into the repetition counter + onepulse mode and that also sounds like a great solution. Thanks for your time!