Timer in combined PWM mode question - how to set the polarity of the reference PWMs?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-23 10:30 AM
Can the combined PWM signal be the AND of two reference PWMs in which one is negated?
This is what I would like to do.
Combined PWM signal = OC1Ref AND NOT(OC2Ref)
If I could set the polarity of the two reference PWMs differently, I think that would work. I just don't now how to configure it that way. Are there any code examples for using the PWM in combined mode?
Thanks -
- Labels:
-
STM32L4 series
-
TIM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-23 11:11 AM
Include your chip part number.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-23 11:20 AM
Sorry, I forgot to add that to my original post.
STM32L475
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-23 1:14 PM
Polarity is applied *after* the combiner:
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-23 2:02 PM
Thanks for the reply. So it looks like I cannot implement the following logic using the combined PWM mode feature.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-23 4:03 PM
What is your desired output waveform?
As PWM1 and PWM2 modes are effectively mutually inverted, you might be able to achieve the same effect using more channels.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-23 6:12 PM
Here is an example waveform. Effectively, the channel outputs only drive high when there is a difference between the two reference PWM outputs.
CH1 goes high when OC1 is high and OC2 is low. CH2 goes high when OC1 is low and OC2 is high. If OC1 and OC2 are both high or both low, CH1 and CH2 stay low.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-23 11:19 PM
As I've said, use PWM1 mode in one channel and PWM2 in the other, to generate one of the waveforms. Then use channels 3 and 4, withc CCRx having copied from CH1/CH2, with PWM1/PWM2 set exactly to opposite as in CH1/CH2 and use that to generate the other waveform. As the matter of fact, when Combined AND mode is used, the channel where the AND is performed works as PWM2 anyway.
JW
