• Resolved

tricky PWM 100% duty cycle problem in 28335

Hi,

I have configured my PWM timer initilization for inverter which are complementary and PWM outputs are gated (Init_Timer function below). I am using EPWM1 interrupt to process ADC data only.

InitPWMs-1/2/3()
{
// Allow synchronization            
TBCTL.bit.SYNCOSEL  = 0; 
TBCTL.bit.PHSEN     = 0; 
TBCTL.bit.CLKDIV    = 0; 
TBCTL.bit.HSPCLKDIV = 0; 
TBPHS.half.TBPHS    = 0; 
TBCTL.bit.FREE_SOFT = 2;  
                                    
TBPRD              = 5000;
CMPA.half.CMPA     = 2500;
                                    
TBCTL.bit.CTRMODE  = 2;  
TBCTR              = 0;   
                                    
CMPCTL.bit.SHDWAMODE = 0;
CMPCTL.bit.SHDWBMODE = 0;
                                    
// Next PWM is set zero when CTR      reaches zero and moved from Shadow to Active.                       
CMPCTL.bit.LOADAMODE = 0;
CMPCTL.bit.LOADBMODE = 0;
                                    
// Set actions: ACTIVE LOW-HIGH     
AQCTLA.bit.CAU = 0x1;    
AQCTLA.bit.CAD = 0x2;    
                                    
// Setup the deadband - Active high  complementary PWMs               
DBCTL.bit.OUT_MODE = 0x3;
DBCTL.bit.POLSEL   = 2;  
DBCTL.bit.IN_MODE  = 0x0;
DBRED              = 10; 
DBFED              = 10; 

}

With an interface I was able to change the duty cycle varying from 10% to 100% duty cycle and with fixed frequency and could able to see different PWM outputs. I was trying to configure a shorted PWM case which means

EPWM1A-> 12.5V or 100%  EPWM1B -> 0V or 0%
EPWM2A-> 12.5V or 100%. EPWM2B -> 0V or 0%
EPWM3A-> 12.5V or 100%. EPWM3B -> 0V or 0%

or vice versa.

Inorder to acheive this,as per the document. I have set my PWM registers as below. In this case, my PWM just stops and never starts. Only option is to reset the processor and run the PWM. Short()
{
  EPwm1Regs.TBPRD = PWM_PERIOD;
  EPwm2Regs.TBPRD = PWM_PERIOD;
  EPwm3Regs.TBPRD = PWM_PERIOD;

  EPwm1Regs.half.bit.CMPA = 0x0000
  EPwm2Regs.half.bit.CMPA = 0x0000
  EPwm3Regs.half.bit.CMPA = 0x0000
}

Can I acheive this with this configuration or Am I missing some thing or IS THERE ANY MAGIC?  I have referred EPWM document as well as SPRAA1 doc also. Replies greatly appreciated.

Thanks alot,

Regards,

Kuldeep

 

 


 

  • In reply to Kuldeep Kumar Mynampati:

    Daniel,

    Is trip zone or deadband setting  would be help ful for me in my SHORTPWM () function?

    KK

  • In reply to Kuldeep Kumar Mynampati:

    KK,

    What you are describing sounds like normal operation to me. 

    Your Action Qualifier settings has-
        Clear on CMPA-Up
        Set on CMPA-Down

    With CMPA=0, both events occur simultaneously.  According to the event priority in the ePWM user guide, CMPA-Up takes priority.  With your configuration, this results in 0% duty.  Why don't you try CMPA = Period instead to see if that is what you want?

    Depending on your goal, you could also try using a continuous SW force, using the  AQCSFRC register.

    You can refer to SPRUGE9

     

  • In reply to Daniel Chang:

    Daniel,

    Thanks for the update. I tried to set the CMPA= MAX_PERIOD (10000 or 0x2710). Either with CMPA = 0x0 or CMPA = 0x2710. I still have the same problem. No PWM WAVE FORM with my register settings.  I will try to see by using AQCSFRC register.

    Regards,

    KK

     

  • In reply to Kuldeep Kumar Mynampati:

    Hi,

    I am using 28335 for PWM setup. PWM are running fine. I have set up to trigger ADC when TBCTR = TBPRD and  I am using Shadow registers. In this case, sometimes I am seeing PWM is not triggering ADC on the scope. Is there any way to know if the next pulse is updated as expected or if I am missing a PWM pulse setup in debugger or some test examples?

     

    Thanks,

    KUldeep