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.

TMS320F28379D: Resetting CMPA when the HRPWM is configured for duty-cycle control in up-down mode

Part Number: TMS320F28379D

Hello everyone,

I use an ePWM with CMPA in shadow mode, but sometimes I need to reset it to its default value. In order to avoid waiting until the shadow register is loaded into the active register, I found a method where I do something like this:

ePwm->CMPA.half.CMPA = 0; // write to shadow register (CMPA becomes zero)
ePwm->CMPCTL.bit.SHDWAMODE = TB_IMMEDIATE; 
ePwm->CMPA.half.CMPA = 0; // direct write to active register (CMPAM becomes 0) 
ePwm->CMPCTL.bit.SHDWAMODE = TB_SHADOW;

This does what I want, but I wonder if it may interfere with the HRPWM. The TRM states in chapter 15.2.4.4.1 that "the TBPRD and CC registers must be configured for shadow loads". If I run the ePWM in high-resolution up-down duty cycle control, then force the CMPA to zero in the manner described above, will it break the configuration of the HRPWM because I put the CMPA in immediate mode for a short while?

Cheers,

Pierre

  • I see how the code above would work, but I'm not sure if it will cause a problem or not based on when the instructions above take place. There is one thing I do see as a potential problem and that is operating the HRPWM in the "Range Limitation" sections (fig 15-8 15-9 and 15-10) depending on which mode you are using.
  • Nima,

    Thank you for your answer. I have been reading about the range limitations and I believe you're right about the potential problem, since I'm working in symmetric duty-cycle control, for which period control needs to be enabled.

    I think it will be safer if I try to use AQCSFRC instead. Do you agree?

    Pierre
  • Yes if the CMPA value being set to 0 will actually cause OUTPUTx to go to a specified state, then yes the AQCSFRC feature is the option I would go with.