PWM outputs enabled/disabled during run-time.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi,

I need to control the direct/inverted PWM outputs on the fly.
For example, in the positive cilcle of a signal, switch off the inverted output,
and in the negative half switch off the direct output.

Suppose the PWM outputs are manually asigned to:

direct output p/0/pad/5
inverted output p/0/pad/2


thanks in advance for any help

regards
Ernesto
0 Likes
6 Replies
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi erni,

You can the follow ...

The software can at any time write a 1B into the GCSS.SySTS bitfield, which will set the
status bit GCST.CC4yST of the specific timer slice. Writing a 1B into the GCSC.SySTC
bitfield will clear the specific status bit.

G@@d luck
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
My suggestion will immediately change the status of CC4yST. However CC4yST will resume its status base on the "Active/Passive rule" while the timer is running. So you might want to consider to pause the timer for this case or change a different compare / period value to achieve 100% or 0% duty cycle.

A waveform drawing of your requirement will give us a better understanding of your needs.

Best Regards
Travis
0 Likes
User6412
Level 4
Level 4
I have the same requirements and my solution is as follow:

Force low of the specified PWM output (in this example it is P1.14, CCU81.OUT10):

#define FORCE_LOW_BH_L1 { \
PORT1->OMR |= PORT1_OMR_PR14_Msk; \
WR_REG(PORT1->IOCR12, PORT1_IOCR12_PC14_Msk, PORT1_IOCR12_PC14_Pos, 0b10000); }


Reactivate the same PWM again:

#define ACTIVATE_BH_L1 WR_REG(PORT1->IOCR12, PORT1_IOCR12_PC14_Msk, PORT1_IOCR12_PC14_Pos, 0b10011);


Force heigh cand be done if the PORT1_OMR_PR14_Msk mask change to PORT1_OMR_PS14_Msk one. But to avoid the dead time problematic one should instead use the setting 100% or 0% of the duty cycle in combination with force low.
0 Likes
Not applicable
Thank all for the answers,

@Travis, I'm doing a CCM PFC boost converter (or interleaved) with two swicthes and two capacitors (with half point) and I want to use only one PWM.
During the positive cicle of the input AC voltage the direct output of the PWM modulates and drives the upper switch that charges the upper capacitor.
My idea is to use the inverted output during the negative cicle to drive the lower switch.
Do you understand me?

thanks in advance

regards
Ernesto
0 Likes
Not applicable
Hi Travis,

Talking with a partner I realized that it's not necessary to switch off any of the PWM output because during that cicle the freewheeling diode is conducting.

Anyway thanks all for your answers.

regards
Ernesto
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi erni,

Please keep us posted of your successful project ..:D

Best Regards
Travs
0 Likes