AnsweredAssumed Answered

restarting PWM in DSC 56F83xx IN THE MIDDLE OF PWM CYCLE.

Question asked by Dmitry Rogachev on Feb 1, 2016
Latest reply on Feb 3, 2016 by xiangjun.rong

Re: PWM @ MC56F8323, F83xx, F832x, F8xxx, etc.

 

Hello, everybody.

 

Does anybody knows - how to interrupt the ongoing PWM cycle and restart it say with the different duty cycle?

For the motor control it is often desired not to wait until the PWM cycle ends, but interrupt it and restart the new one.

Is it a way to cause the transfer without waiting the end of cycle (half cycle in some cases)?

These chips does not allow to write directly to the counter PMCNT.

 

I was trying to disable the PWM module (PMCTL &= 0x3,  bits LDOK and PWMEN), to stop PWM, and restart PWM with all same parameters:

It does not work.

 

QUESTIONS:

1. Is there a better way to interrupt PWM cycle than resetting the whole module?

2. What parameters do I need to set, so re-initialization would actually work?

 

Thanks,

Dmitry.

 

Code example:

Here PWM works and outputs.

PW
     PWM->CTL &= 0x0003;  // disable pwm to reset the cycle
   PWM->OUT =  0x8000 | (~(commutation_state_table[commutation_state])&0x3FFF); // configure outputs from the array of states
   PWM->CTL |= 0x0002;                          // set LDOK
   PWM->CTL &= 0x0020;                        // clear PWMIE (int)
   PWM->CTL |= 0x0001;                         // set PWM ENABLE
  

Outcomes