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.
Hi team,
My customer is using F28004x HRPWM. The ePWMA is set at CTR=ZRO and clear at CTR=CMPA and ePWMB is using active high complimentary mode. And HR CTR is also enabled as well.
We noticed ePWMA always works without any fault. But ePWMB's high resolution comparator would not work when TBPRDHR is zero. The ePWMB would still toggle, but the resolution is normal mode. After we set value for TBPRDHR, the ePWMB would also toggle with high resolution.
Attaching is the configuration for PWM. Could you help to review what is wrong with the configuration?
EPwm2Regs.TBPRD = TBPRD_SYCN; EPwm2Regs.CMPA.bit.CMPA = CMP_DEAD; EPwm2Regs.TBPHS.bit.TBPHS = 0; // Phase is 0 EPwm2Regs.TBCTR = 0; //时基寄存器清0 //时基控制 EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP; //递增计数模式 EPwm2Regs.TBCTL.bit.PRDLD = TB_SHADOW; //使用 SHADOW 寄存器 EPwm2Regs.TBCTL.bit.PHSEN = TB_ENABLE; //使能从相位寄存器 TBPHS 装载 TBCTR EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; //同步输出选择in EPwm2Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; //TBCLK = SYSCLKOUT / (HSPCLKDIV × CLKDIV) EPwm2Regs.TBCTL.bit.CLKDIV = TB_DIV1; //不分频 EPwm2Regs.TBCTL.bit.FREE_SOFT = 0x2; //自由运行 //比较器 EPwm2Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; //使用 SHADOW 寄存器 EPwm2Regs.CMPCTL.bit.LOADAMODE = CC_CTR_PRD; //在 CTR=0 时载 //动作限定器 EPwm2Regs.AQCTL.bit.LDAQAMODE = 0; //CTR=0时更改AQ寄存器 EPwm2Regs.AQCTL.bit.SHDWAQAMODE = 1; //shadow EPwm2Regs.AQCTL.bit.LDAQASYNC = 0; //只允许LDAQMODE EPwm2Regs.AQCTLA.bit.ZRO = AQ_SET; //计数器等于A时置位 EPwm2Regs.AQCTLA.bit.CAU = AQ_CLEAR; //计数器等于A时复位 //死区调节 EPwm2Regs.DBCTL.bit.IN_MODE = DBA_ALL; //A上升沿下降沿延时 EPwm2Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC; //B反向 EPwm2Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE;//使能A,B狼? EPwm2Regs.DBRED.all = 0;//DEAD_TIME_300 EPwm2Regs.DBFED.all = 0; //HRPWM EPwm2Regs.HRCNFG.all = 0x0; //clear all bits first EPwm2Regs.HRCNFG.bit.EDGMODE = HR_BEP; //0x3 MEG control falling edges HR_FEP EPwm2Regs.HRCNFG.bit.CTLMODE = HR_CMP; //0x0 CMPAHR(8) or TBPRDHR(8) Register control mode EPwm2Regs.HRCNFG.bit.HRLOAD = HR_CTR_PRD; // 0x1 Load CMPAHR at CTR=PRD EPwm2Regs.HRCNFG.bit.AUTOCONV = 1; //使能自动调节 EPwm2Regs.HRPCTL.bit.HRPE = 1; //高分辨率周期使能
Regards,
Brian
Counter is in Up mode? or Up-down mode?
Also setting the HRPRD value to 1 fixes everything?
Hi Nima,
The counter works in up mode which you could see in my attached configuration file.
When TBPRDHR is loaded with value, it is fixed.
Regards,
Brian
Okay in that case with the counter in UP mode, can you have your actions occur on CMPAU, and PRD? instead of ZERO.
Nima
Hi Nima,
Yes we might suggest customer to do that.
But the question is what is the reason behind? Why the value in TBPRDHR would have such influence? If customer would like to enable HRPRD and HRCMP when both channel works in complimentary mode with dead band, are there anything wrong with the PWM configuration?
Regards,
Brian
The setting in which HRPWM operates needs to be set SPECIFICALLY to a known working mode.
In general the HR deadband and up-count mode do not work together. YOU MUST SELECT UP-DOWN mode for the counter. In up down mode, again you need to ensure all shadow to active loads occur on both CTR=ZERO and CTR=PRD. Furthermore you need to make sure the EPWM action qualifier SETs on CMPAU and CLEARs on CMPAD. The actions to SET/CLEAR must be on CMPxU/CMPxD. These are necessary. We have examples for HR PRD and DUTY in UP-DOWN mode.
Many configuration could cause issues/jitter. You must follow the strict working configurations when using the HR module.
Would you like the example for HR PRD and DUTY using driverlib? This has not been released yet but I have it in the pipeline for Feb release.
Nima