Enable and disable PWM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Enable and disable PWM

2,372 Views
sagha
Contributor II

I am programming a PWM channel submodule on the MC56F84789 that I need to enable and disable within my program and have the pin output high on disable. I used the Processor Expert to create the PWM signal, but after reading through the documentation, it is still unclear to me how to a) enable and b) disable the PWM signal. Specifically, my questions are:

 

1. The documentation cites the "STOP mode" of the PWM but does not say what it is nor how to enter it. How is this done?

 

2. I am able to "disable" the PWM output by clearing the appropriate PWM_MCTRL run mask bit. This turns off the PWM, but it also clears the pin. For my application, I would like the pin to be high when the PWM is off. In the Processor Expert, I have inverted the output polarity and set the output fault state to "Forced to 1 prior to output polarity".

 

3. How can I intitialize the PWM in the Processor Expert without turning the PWM on (not just keeping the output disabled, but making sure that the submodule is not on at all)? I've managed to get it to not PWM on startup by setting the "Load values after init into SMx" to "no"; like this, the pin is high on reset. When I start the PWM and then "disable" it as in (2), the pin then goes low. If I "disable" the pin while it is high, it remains high.

 

I'd appreciate any help.

 

Thanks,

Simone

Labels (1)
Tags (3)
0 Kudos
1 Reply

1,014 Views
johnlwinters
NXP Employee
NXP Employee

"Stop Mode" is entered not with the PWM, but for the entire SOC by using the following instruction:

for(;;) {

 

  asm(stop);

 

  }

At this point the peripherals are in "Stop Mode".

0 Kudos