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.

CCS/TMS320F28379D: Long Pulse from PWM updating PHS and CMP at same time.

Part Number: TMS320F28379D

Tool/software: Code Composer Studio

Hello I am trying to have a PWM updating from 28379D controller.

I have to update PHS and CMPA, CMPB at the same time but some time I will encounter issue. Here is my code:

EPwm7Regs.TBPRD = PRD7;

EPwm7Regs.CMPA.bit.CMPA = CMPA;

EPwm7Regs.CMPB.bit.CMPB = CMPB;

I used shadow load mode so the value should load while counter=0; My PRD value will change from 830 to 769, and CMPA from 366 to 345, CMPB from 781 to 730. In real test, I feel in some case which happens a lot, PRD is updated but CMPA and CMPB is not. In this case CMPB(781) is larger than new PRD(769), and will cause a long pulse. Is there any way for PRD and CMP to let them load or update at the same time?

Tianxiang Chen

  • You have the option to use Global load mode.

  • Hi Nima,

    Thanks for your reply. For global load mode, my understand is it will load PRD and CMP at same time no matter what shadow reg have. But here I want to update PRD and CMP value in my interrupt first, then let it load at next counter=0 event.

    If I use global mode and software force load, I cannot guarantee it will load at next counter=0 event; If I use global mode and counter=0 event load, case will same as if I do not have global mode as my shadow mode of CMP and PRD will load on counter =0 event anyway. 

    To be more spicific, here the case is, shadow to active load occur after I have "EPwm7Regs.TBPRD = PRD7;" and before "EPwm7Regs.CMPA.bit.CMPA = CMPA;", and shadow to active load occur after I update all my update.

    Thanks, 

    Tianxiang

  • Hi Nima,

    Thanks for your reply. For global load mode, my understand is it will load PRD and CMP at same time no matter what shadow reg have. But here I want to update PRD and CMP value in my interrupt first, then let it load at next counter=0 event.

    If I use global mode and software force load, I cannot guarantee it will load at next counter=0 event; If I use global mode and counter=0 event load, case will same as if I do not have global mode as my shadow mode of CMP and PRD will load on counter =0 event anyway. 

    To be more spicific, here the case is, shadow to active load occur after I have "EPwm7Regs.TBPRD = PRD7;" and before "EPwm7Regs.CMPA.bit.CMPA = CMPA;", and shadow to active load occur after I update all my update.

    Thanks, 

    Tianxiang

  • Yes, but I do think that is why we originally implement the Global load feature. Give it a try with load at CTR=ZERO as the trigger for the global load. This will ensure there was no error in the initialization code.