其中CH1:PWM2A,CH2:PWM2B
我的ePwm初始化配置如下:
// PWM2 Register Initial
//Time Base SubModule Register
EPwm2Regs.TBCTL.bit.PRDLD = TB_SHADOW; // Reload from the Shadow
EPwm2Regs.TBPRD= cInvPwmPeriodCnt;
EPwm2Regs.TBPHS.half.TBPHS =0;
EPwm2Regs.TBCTR = 0;
EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;
EPwm2Regs.TBCTL.bit.PHSEN = TB_DISABLE;
EPwm2Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1;
EPwm2Regs.TBCTL.bit.CLKDIV = TB_DIV1;
EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO;
// Counter compare submodule registers
EPwm2Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
EPwm2Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm2Regs.CMPCTL.bit.LOADAMODE = CC_CTR_PRD;
EPwm2Regs.CMPCTL.bit.LOADBMODE = CC_CTR_PRD;
EPwm2Regs.CMPA.half.CMPA = 0; //Initialize the CMP register
// Action Qualifier SubModule Registers
EPwm2Regs.AQCTLA.bit.CAU = AQ_CLEAR;
EPwm2Regs.AQCTLA.bit.CAD = AQ_SET;
EPwm2Regs.AQCTLB.bit.CAU = AQ_CLEAR;
EPwm2Regs.AQCTLB.bit.CAD = AQ_SET;
// TZA events can force EPWMxA
// TZB events can force EPWMxB
EALLOW;
EPwm2Regs.TZCTL.bit.TZA = TZ_FORCE_LO; // EPWM1A will go low
EPwm2Regs.TZCTL.bit.TZB = TZ_FORCE_LO; // EPWM1B will go low
EPwm2Regs.TZSEL.bit.CBC2 = 1; // Cycle by Cycle Protect
EPwm2Regs.TZFRC.bit.OST = 1; // Turn off the PWM
EDIS;
// Deadband SubModule Registers
EPwm2Regs.DBCTL.bit.IN_MODE = DBA_RED_DBB_FED; // EPWM1A is the Source for xA,xB
EPwm2Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; //Both rising and falling edge
EPwm2Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC; // Active high complementary
EPwm2Regs.DBFED = 120; // Deadtime is 1.4us
EPwm2Regs.DBRED = 120;
对应的GPIO口没有被占用或者无用,这样的配置有问题吗?
Linda:
您好!
请下载以下F2806x的技术文档,其中第3.3.6节有关于三相互补PWM的参考设置例程:
www.ti.com/lit/spruh18f