Repetition Timer PWM Help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-02 10:51 AM
Hello, I'm wondering if there is an obvious way to generate a limited set of n pulses from an external trigger?
At the moment i'm using TIM8 in one pulse mode with repetition but my problem is that i want the White pulse train to start with the rising edge of Red while maintaining some gap between the pulses. I can't seem to figure it out.
Thanks
- Labels:
-
STM32CubeMX
-
STM32G4 Series
-
TIM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-02 1:05 PM
Try to make a drawing, showing what do you want to achieve.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-02 4:51 PM
So what about the picture you showed is wrong? Do you only want the white rising edge closer to the red rising edge? If so, use combined PWM mode, set CCR1 to 1 and CCR2 to whatever you need for the duty cycle. If 50% duty cycle, set it to (CCR + 3) / 2.
Keep in mind they can never be perfectly aligned.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-02 11:11 PM
So this is what i'm trying to achieve
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-03 12:16 AM
The way how Compare thus PWM generation works in the STM32 timers is, that the "idle" value is what continues to be output also during the first portion of the timer cycle. So, to achieve what you've drawn, some trickery is needed. @TDK 's suggestion (to use Combined mode with one of the channel's CCRx set to 1 so that outputting the "idle" value is disabled) is probably the simplest way to go; at the cost of 1 (prescaled) timer cycle delay.
JW
