TI中文支持网
TI专业的中文技术问题搜集分享网站

TMS320F28377S的PWM发波问题

Other Parts Discussed in Thread:TMS320F28377S

大家好,我现在用TMS320F28377S的EPWM1A和1B发波,遇到了一个奇怪的问题,EPWM1A发出高频信号,EPWM1B发出工频信号,高频信号在翻转的过程中,会出现一个周期值减小一般的情况,导致一堆问题,麻烦有遇到相关问题的朋友解答一下,不胜感激。

PWM的初始化代码如下所示

EALLOW;
// EPWM Module 1 config
EPwm1Regs.TBPRD = INV_PWM_TIMER_TBPRD; // Period TBCLK counts
EPwm1Regs.CMPA.bit.CMPA = 0; //PWM_Control_Period_Count*0.25;
EPwm1Regs.CMPB.bit.CMPB = 0;
EPwm1Regs.TBPHS.bit.TBPHS = 0; // Set Phase register to zero
EPwm1Regs.TBCTR = 0;

EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Symmetrical mode
EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE;
EPwm1Regs.TBCTL.bit.PHSDIR = TB_UP; // 0x1
EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW;
EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO;
EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; //TBCLK=SYSCLKOUT
EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV1;

EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // CC_CTR_ZERO_PRD
EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;

EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // set actions for EPWM1A
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR;
EPwm1Regs.AQCTLB.bit.CBU = AQ_CLEAR; // set actions for EPWM1A
EPwm1Regs.AQCTLB.bit.CBD = AQ_SET;

EPwm1Regs.AQSFRC.bit.RLDCSF = 0;
EPwm1Regs.AQCSFRC.bit.CSFA = 0; // Software forcing disabled, i.e., has no effect
EPwm1Regs.AQCSFRC.bit.CSFB = 0;

// EPwm1Regs.DBCTL.bit.IN_MODE = DBA_ALL;
// EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC;//DB_ACTV_LOC;
EPwm1Regs.DBCTL.bit.OUT_MODE = DB_DISABLE;
EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_LOC;
EPwm1Regs.DBRED.bit.DBRED = 0;
EPwm1Regs.DBFED.bit.DBFED = 0;

EPwm1Regs.TZCTL.bit.TZA = TZ_FORCE_LO; //Force EPWMxA to a low state
EPwm1Regs.TZCTL.bit.TZB = TZ_FORCE_LO; //Force EPWMxB to a low state
EPwm1Regs.TZFRC.bit.OST = 1;
EPwm1Regs.TZEINT.bit.OST = 0; //Disable one-shot interrupt generation
EDIS;

user6383334:

波形如下图

红色是工频信号,蓝色是高频信号

,

Susan Yang:

能给出您的波形吗?

另外若是可以的话,请您私信一下工程,我们来测试一下,谢谢

,

user6383334:

您好,波形已经贴出来了,麻烦帮忙解答一下,非常感谢您

,

Susan Yang:

谢谢您的反馈!单从给出的代码,我没有发现问题所在。请您私信一下您的工程,我使用开发板来测试一下,谢谢

,

user6383334:

您好,我已经发出了私信,您没有回复,工程量太大,不太适合发私信,就用私信的方式交流一下相关的代码吧

,

Susan Yang:

您如何在EPWM1​​A / B上生成两个不同的频率,因为两者都在相同的设置(TBPRD)上工作? 

EPWM1​​A的周期不应仅因为极性改变而改变。您如何得出结论,即周期减小一半的?

,

user6576535:

为什么CMPA、CMPB都是0^_^,以及为什么都是EPWM1,PWM频率还能不一样?^_^

赞(0)
未经允许不得转载:TI中文支持网 » TMS320F28377S的PWM发波问题
分享到: 更多 (0)