This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler: phase shift PWM1A e PWM1B

Other Parts Discussed in Thread: CONTROLSUITE

Tool/software: TI C/C++ Compiler

Hi,

i would like know how edit phase of pwm2A and pwm2b.
In practical i would wish have PWM2A and PWM2B non in phase

Thanks 

  • Hi,

    I'm not sure i understand your question completely.
    Are you trying to maintain phase shift between PWM 1 and 2 modules?
    If so, please refer to the PWM synchronization mechanism in the device user guide and configure TBPHS register to the value of the phase needed. If you are just looking for phase shift across PWM1A and PWM1B then you need to use the CMPx accordingly accounting for phase shift needed.

    -Bharathi.
  • Hi, i have take the follow script from example PWM of : ti\controlSUITE\development_kits\Piccolo controlSTICK.
    What other have i registers to add for phase shift of pwm2b respect pwm2A?

    thanks.

    EPwm2Regs.TBPRD = 500
    EPwm2Regs.TBPHS.all=0;
    EPwm2Regs.TBCTR = 0;
    EPwm2Regs.TBCTL.bit.PRDLD = TB_IMMEDIATE;
    EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;
    EPwm2Regs.TBCTL.bit.PHSEN = TB_DISABLE;
    EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_DISABLE;
    EPwm2Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1;
    EPwm2Regs.TBCTL.bit.CLKDIV = TB_DIV1;

    EPwm2Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
    EPwm2Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
    EPwm2Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR=Zero
    EPwm2Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR=Zero


    EPwm2Regs.AQCTLA.bit.CAU = AQ_SET;
    EPwm2Regs.AQCTLA.bit.CAD = AQ_CLEAR;

    EPwm2Regs.CMPA.half.CMPA =250;
    EPwm2Regs.CMPB = 250;
  • Hi,

    If you've to maintain phase shift across 2 PWM outputs of the same module - you can simply achieve that by using appropriate values in the CMPx registers used to generate the PWM outputs. 
    If you've to maintain phase shift across multiple modules (ex: PWM1 and PWM2) then you can use synchronization method along with TBPHS register set to the desired phase shift.


    -Bharathi.