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.

TMS320F280049: Action does not happen unless value written to TBPRDHR

Part Number: TMS320F280049

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?

PWM Configuration.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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=0AQ
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;//使AB?
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; //使
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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