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.

TMS320F28034: Cooperation between Time-Base Period Shadow and Time-Base Counter Synchronization

Genius 3095 points

Part Number: TMS320F28034

Dear team:

Enable synchronization of epwm1 and epwm2. Enable the shadow register of TB.

The TBPRD shadow register is enabled when TBCTL[PRDLD] = 0. Reads from and writes to the
TBPRD memory address go to the shadow register. The shadow register contents are transferred to
the active register (TBPRD (Active) ← TBPRD (shadow)) when the time-base counter equals zero
(TBCTR = 0x0000). By default the TBPRD shadow register is enabled.

EPwm1Regs.TBCTL.bit.FREE_SOFT=TB_FREEZE;
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;
EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE;

EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW;

EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; 

EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;
EPwm2Regs.TBCTL.bit.PHSEN = TB_ENABLE;
EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN; 

EPwm2Regs.TBCTL.bit.PRDLD = TB_SHADOW;
EPwm2Regs.TBPHS.half.TBPHS = 3;
EPwm2Regs.TBCTR = 0;

During the program running, I need to dynamically modify the frequency (TBPRD) of epwm1 and epmw2, and the two frequencies are the same.

In this configuration, is it possible that TBCTR of epwm2 can not count to 0 because TBPHS is loaded by TBCTR of epwm2?

Best regards

  • I will let our F28034x expert response!

  • F.F,

    When a sync occurs TBPHS is loaded into TBCTR. Under certain conditions this can certainly cause TBCTR to never reach zero.

    If you are using periodic syncing with PWMs of different frequencies, the slower PWM must always be the master to avoid syncing issues.

    Since your PWMs are the same frequency you shouldn't have this issue for more than the first cycle. After the phase offset is applied once, the second PWM will lead or lag the other correctly every cycle. When the sync pules comes it will simply load the same value into the TBCTR every cycle.

    This relationship again becomes more complex if you are varying the phase relationship between the two PWMs.

    In short, you should be able to avoid the issue you are describing.

    Regards,
    Cody