STM32H7: TIM PWM DMA does not directly stop transmitting when HAL_TIM_PWM_Stop_DMA() is called in the HAL_TIM_PWM_PulseFinishedCallback() function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-21 4:28 AM
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?
Thanks in advance!
- Labels:
-
DMA
-
STM32H7 Series
-
TIM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-21 5:41 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-21 6:26 AM
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!
