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

TMS320F280025C: F280025 EPWM发波,有载波信号和比较信号,但是不能生成驱动信号,求大神帮忙!

Part Number:TMS320F280025C

大家好,本人在将代码从F280049切换到F280025过程中,遇到问题,EPWM比较器的输入信号:载波信号和比较信号都有,但是不能生成驱动信号。在F280048中都是好的,切换到F280025就遇到此问题?查看芯片手册,49和25芯片EPWM比较寄存器基本一样,25比49只多了EPWMSYNCINSEL和EPWMSYNCOUTEN两个寄存器,我的配置代码如下,请大神帮忙,谢谢~

//配置GPIO0口为EPWM1
GpioCtrlRegs.GPAPUD.bit.GPIO0 = 1;
GpioCtrlRegs.GPAGMUX1.bit.GPIO0 = 0;
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1;

EPwm1Regs.TBPRD = C_INIT_PRD;
EPwm1Regs.CMPB.bit.CMPB = EPwm1Regs.TBPRD – gADC.DelayApply;
EPwm1Regs.TBPHS.all = 0;
EPwm1Regs.TBCTL.all = 0xE012;

EPwm1Regs.TBCTL.bit.HSPCLKDIV = PWM_CLK_DIV;
EPwm1Regs.TBCTL.bit.PHSDIR = TB_UP;

EPwm1Regs.CMPCTL.all = 0x0100;

EPwm1Regs.CMPA.bit.CMPA = C_INIT_PRD/2;

EPwm1Regs.AQCTLA.all = 0x0060;

EPwm1Regs.AQSFRC.all = 0x0;
EPwm1Regs.AQCSFRC.all = 0x0;
EPwm1Regs.DBCTL.all = 0x000B;

EPwm1Regs.DBFED.bit.DBFED = C_MAX_DB;
EPwm1Regs.DBRED.bit.DBRED = C_MAX_DB;

EPwm1Regs.EPWMSYNCINSEL.bit.SEL = 0x01;
EPwm1Regs.EPWMSYNCOUTEN.bit.ZEROEN = 1;

EPwm1Regs.TZDCSEL.all = 0x0C3;

EPwm1Regs.DCTRIPSEL.bit.DCALCOMPSEL =3;
EPwm1Regs.DCTRIPSEL.bit.DCBLCOMPSEL =4;

EPwm1Regs.DCALTRIPSEL.bit.TRIPINPUT4 =1;//trip4
EPwm1Regs.DCBLTRIPSEL.bit.TRIPINPUT5 =1;//trip5

EPwm1Regs.DCACTL.all = 0x0002;
EPwm1Regs.DCBCTL.all = 0x0002;

//Set the Trip-zone (TZ) Module
EPwm1Regs.TZCLR.all = 0x02F;

EPwm1Regs.TZSEL.bit.OSHT1 = 1; // OSHT1:TZ1;
//内部比较器1 2作为触发EPWMXA的逐波限流(ost)触发源
EPwm1Regs.TZSEL.bit.DCAEVT1 = 1;//Enable DCAEVT1 as a ost trip source for this ePWM module
EPwm1Regs.TZSEL.bit.DCBEVT1 = 1;//Enable DCBEVT1 as a ost trip source for this ePWM module

EPwm1Regs.TZCTL.bit.TZA = 2;//Force EPWMxA to a low state
EPwm1Regs.TZCTL.bit.TZB = 2;//Force EPWMxA to a low state
EPwm1Regs.TZCTL.bit.DCAEVT1 = 2;//Force EPWMxA to a low state
EPwm1Regs.TZCTL.bit.DCBEVT1 = 2;//Force EPWMxA to a low state

EPwm1Regs.TZEINT.bit.OST = 1;
EPwm1Regs.TZEINT.bit.DCAEVT1 = 1;
EPwm1Regs.TZEINT.bit.DCBEVT1 = 1;

//Set the Event-trigger (ET) Module
EPwm1Regs.ETCLR.bit.INT = 1;
EPwm1Regs.ETSEL.all = 0x0F09;

EPwm1Regs.ETPS.all = 0x0101;

Green Deng:

你好,看了一下你的代码,相比F280049,F280025 的代码只是添加了下面这两句代码吗?

EPwm1Regs.EPWMSYNCINSEL.bit.SEL = 0x01;EPwm1Regs.EPWMSYNCOUTEN.bit.ZEROEN = 1;

你提到这个程序不能生成驱动代码,是因为没有运行代码还是运行之后芯片没反应?有没有单步调试过程序有没有运行这部分代码?

,

user4678620:

已经运行了,芯片也正常工作,就是在EPWM比较的时候,比较器的输入信号都是有的,但是没有输出?程序已经运行到这部分了。

,

Green Deng:

找到一份F28004x<>F28002x迁移文档(SPRACK2),你可以对比一下其他方面的设置有没有遗漏的地方

,

user4678620:

您好,麻烦问下,DSP配置同一个功能的时候,能不能一部分用函数写,一部分用寄存器编写,谢谢~

,

Green Deng:

你是指用driverlib库的方式配置吗?可以的,只要不重复配置就可以。

,

user4678620:

把配置语句前后的EALLOW和EDIS代码去掉,问题解决了,但是280049的配置里也有EALLOW和EDIS代码,能够正常输出驱动信号,请问是怎么回事?

,

Green Deng:

F280025的PWM寄存器也是有EALLOW保护的,你看看是不是程序里面其他地方还有EALLOW?会不会是重复了

赞(0)
未经允许不得转载:TI中文支持网 » TMS320F280025C: F280025 EPWM发波,有载波信号和比较信号,但是不能生成驱动信号,求大神帮忙!
分享到: 更多 (0)