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.

关于PWM载波周期

Other Parts Discussed in Thread: CONTROLSUITE

我的设计是使用F28021,系统时钟为40M,PWM模块的时钟与系统时钟一致,PWM计数方式为增减模式,要求输出的PWM波的频率为10K,这样我的PWM初始化程序如下:

EPwm1Regs.TBPRD = 2000;         //load frq 10k and pwm frq 20k
  EPwm1Regs.TBPHS.half.TBPHS = 0;        //phase register to 0
  EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;   //crease-decrease mode
  EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE;      //disable load the phase from the phase register
  EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO;    //tbctr = 0;

  EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;    //use shadow register
  EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
  EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;    //use CTR = ZERO load
  EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;
  EPwm1Regs.AQCTLA.bit.CAU = AQ_SET;
  EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR;

  EPwm1Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE;
  EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC;
  EPwm1Regs.DBFED = 50;
  EPwm1Regs.DBRED = 50;

  EPwm4Regs.CMPA.half.CMPA = 750;

但是实际输出的PWM波的载波周期为20K,请问我的EPwm1Regs.TBPRD = 2000;是否有问题?

  • 周期设置应该没有错,确认你的PWM时钟是否是和系统时钟一致,你可以参考controlSUITE中的例程:C:\ti\controlSUITE\device_support\f2802x\v220\f2802x_examples_structs\epwm_updown_aq