Part Number:TMS320F28379D
Hi dear people!
Progressing in my application, I am in need of a variable output in one ePWM channel,
changing Period and Duty every millisecond.
If I do this inside a loop, the ePWM get periods of time (around 1,3 mS) where the output is zero. The pin goes down for 1,3 mS, and then the normal operation continues.
Those "black-outs" correspond to the end of the setting with the largest Period, it fails to change to the quicker setting.
Sometimes, however, it succeed, ramdonly.
I include some screenshots to show this.
In the screenshots I use a DELAY_US(500); to toggle a pin to make things more clear to you.
Every time the pin toggles, the settings should change too.
I have changed the settings and changed the time every setting is active, without succes.
The 1,3 mS periods occur at different intervals, but always by the end of the period with the slower setting.
I have used another Launchpad.
Running the Launchpad in stand alone, without my custom circuit, does not help either.
If I run the loop with only one of the settings, everything is fine.
I have stoped the ePWM with
CpuSysRegs.PCLKCR0.bit.TBCLKSYNC = 0;
before making the changes and started it again, no changes.
If I use a slider to modity those setings, everything is fine, but if I run it in a loop not.
Is there a way to do this?
Below I include the two settings and the configuration of the ePWM
Thanks in advance for your opinion!
Greetings from Germany,
Gustavo
EPwm4Regs.TBPRD = 176;
EPwm4Regs.CMPA.bit.CMPA = 107;
EPwm4Regs.CMPB.bit.CMPB = 107;
EPwm4Regs.TBPRD = 57;
EPwm4Regs.CMPA.bit.CMPA = 35;
EPwm4Regs.CMPB.bit.CMPB = 35
void HRPWM4_Config(period)
{
EPwm4Regs.TBCTL.bit.PRDLD = TB_IMMEDIATE;
EPwm4Regs.TBPRD = 176;
EPwm4Regs.CMPA.bit.CMPA = 107;
EPwm4Regs.CMPA.bit.CMPAHR = (0 << 8);
EPwm4Regs.CMPB.bit.CMPB = 107;
EPwm4Regs.CMPB.all |= (0 << 8);
EPwm4Regs.TBPHS.all = 0;
EPwm4Regs.TBCTR = 0;
EPwm4Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP;
EPwm4Regs.TBCTL.bit.PHSEN = TB_DISABLE;
EPwm4Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_DISABLE;
EPwm4Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1;
EPwm4Regs.TBCTL.bit.CLKDIV = TB_DIV1;
EPwm4Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;
EPwm4Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;
EPwm4Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
EPwm4Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm4Regs.AQCTLA.bit.ZRO = AQ_SET;
EPwm4Regs.AQCTLA.bit.CAU = AQ_CLEAR;
EPwm4Regs.AQCTLB.bit.ZRO = AQ_SET;
EPwm4Regs.AQCTLB.bit.CBU = AQ_CLEAR;
EPwm4Regs.ETSEL.bit.INTEN = 1;
EPwm4Regs.ETPS.bit.INTPSSEL = 0x0;
EPwm4Regs.ETPS.bit.INTPRD = 0x0;
EPwm4Regs.ETSEL.bit.INTSELCMP = 0x0;
EPwm4Regs.ETSEL.bit.INTSEL = 0x6;
EALLOW;
EPwm4Regs.HRCNFG.all = 0x0;
EPwm4Regs.HRCNFG.bit.EDGMODE = HR_FEP;
EPwm4Regs.HRCNFG.bit.CTLMODE = HR_CMP;
EPwm4Regs.HRCNFG.bit.HRLOAD = HR_CTR_ZERO;
EPwm4Regs.HRCNFG.bit.EDGMODEB = HR_FEP;
EPwm4Regs.HRCNFG.bit.CTLMODEB = HR_CMP;
EPwm4Regs.HRCNFG.bit.HRLOADB = HR_CTR_ZERO;
EDIS;
}
![]()
![]()
![]()
![]()