When the HRPWM module is set up using the UP/DOWN counter mode, the CMPx and CMPxHR shadow load mode must be set to load on both CMP=ZERO AND PRD.
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW; EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO_PRD; EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; EPwm1Regs.HRCNFG.bit.EDGMODE = HR_BEP; EPwm1Regs.HRCNFG.bit.CTLMODE = HR_CMP; EPwm1Regs.HRCNFG.bit.HRLOAD = HR_CTR_ZERO_PRD;
Even though the shadow load mode is set to both CTR=ZERO AND PRD, the CMPx and CMPxHR shadow registers accessible by the user only get loaded at CTR=ZERO. This is due to the fact that the HRPWM module will center the PWM signal around CTR=PRD. The HRPWM module will internally calculate and load different CMPx and CMPxHR values at CTR=ZERO and then again at CTR=PRD (not accessible through software) to advance and delay the edges of the PWM output.