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.

280049 DBCTL.OUTSWAP寄存器不能使用SHADOW模式

Other Parts Discussed in Thread: C2000WARE

280049 PWM1相关配置如下:

EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR;
EPwm1Regs.AQCTLA.bit.CAD = AQ_SET;

EPwm1Regs.CMPCTL.bit.LOADAMODE = AQ_CTR_PRD;
EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.LOADBMODE = AQ_CTR_PRD;
EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;

EPwm1Regs.DBCTL2.bit.LOADDBCTLMODE = DB_CTR_PRD;
EPwm1Regs.DBCTL2.bit.SHDWDBCTLMODE = DB_SHADOW;

EPwm1Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE;
EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC;
EPwm1Regs.DBRED.bit.DBRED = PFC_DB_RED_CNT;
EPwm1Regs.DBFED.bit.DBFED = PFC_DB_FED_CNT;

在收到指令时刻,写寄存器EPwm1Regs.DBCTL.bit.OUTSWAP = 3;

目的:在收到指令后,在PWM CNT= DB_CTR_PRD 时使PWM1A和PWM1B的输出进行交替,

但是实际情况是,每当执行EPwm1Regs.DBCTL.bit.OUTSWAP = 3;操作时,PWM1A和PWM1B的输出就进行交替输出。所以OUTSWAP是立即生效的。

我在debug窗口下看过EPwm1Regs.DBCTL2.bit.LOADDBCTLMODE 和 EPwm1Regs.DBCTL2.bit.SHDWDBCTLMODE寄存器值的配置是正确的,截图如下:

图1:寄存器值

图二:PWM输出波形

2通道(蓝色)测试IO口,上升沿为EPwm1Regs.DBCTL.bit.OUTSWAP = 3;指令执行位置

3通道(紫色)PWM1A输出

4通道(绿色)PWM1B输出

  • 请参考下面的回复

    Note: Shadowing is applicable for bits [5:0] of DBCTL. Other bits are not affected by shadow load operation.

    Typically it is not recommended to swap the two outputs during operation. If it must be done, I recommend implementing it during a 'quiet' time of the operation when there's no switching or when the outputs are in the same state.

    e2e.ti.com/.../658232
  • 谢谢你专业、明确的答复。用户手册里没有明确这一点,走了弯路。主要是这个例程里是这样用的D:\ti\c2000\C2000Ware_DigitalPower_SDK_2_00_01_00\solutions\tidm_1007\source。

    Susan ,能不能帮我解决一下另外一个问题e2echina.ti.com/.../188778
    谢谢。这个问题我先确认解决了。
  • 这个问题再补充一点,希望对使用该功能的朋友有帮助。在利用swap指令进行输出动态切换时,第一次切换点是没有死区的,容易造成上下管直通,所以还是按照英文论坛链接的建议操作,最好不要在运行过程中执行切换。
  • 谢谢您的分享,我来看一下另一个帖子