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.

TMS320F28388D: HRPWM duty cycle and phase shift control

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE

Hi,

I have a question regarding the configuration of high-resolution PWM on the C2000 TMS320F2838xD for the following use case:

  • Constant PWM frequency
  • Variable duty cycle
  • Variable phase shift between two PWMs
  • Preferably using up-down count mode (if suitable)

I have already tried several configurations. Currently, I am using the following setup:
TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;
TBCTL.bit.PHSEN = TB_ENABLE;
TBCTL.bit.PRDLD = TB_SHADOW;
TBCTL.bit.HSPCLKDIV = TB_DIV1;
TBCTL.bit.CLKDIV = TB_DIV1;

HRCNFG.bit.EDGMODE = HR_BEP;
HRCNFG.bit.CTLMODE = HR_CMP;
HRCNFG.bit.HRLOAD = HR_CTR_ZERO_PRD;
HRCNFG.bit.AUTOCONV = 1;

CMPCTL.all = ((CC_CTR_ZERO << 0) | (CC_CTR_ZERO << 2)
| (CC_SHADOW << 4) | (CC_SHADOW << 6));

With this configuration, I observe that both edges (rising and falling) are shifted equally. As a result, the duty cycle remains effectively unchanged, and only a phase shift is noticeable.

When I configure EDGMODE to affect only the rising or falling edge, the duty cycle changes smoothly up to about 10 ns, after which it jumps to 20 ns (and so on).

Additionally, I observe an unintended phase shift of approximately 20 ns between the two PWMs, even though no phase shift has been configured.

Could you please help me understand how to correctly configure the PWM to achieve independent control of duty cycle and phase shift?