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.
Hi, I used F28069.
Because I have read the "http://www.ti.com/lit/ug/spruh18e/spruh18e.pdf" P.255
eCAP1 can synchronize to PWM1.
If this step is success. I think I can see the wavefrom in eCap pin (GPIO05) or PWMSYNCO pin (GPIO33).
Here's my code.
void InitEPwm1Example()
{
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
EDIS;
// Setup TBCLK
EPwm1Regs.TBPRD = EPWM1_TIMER_TBPRD; // Set timer period 801 TBCLKs
EPwm1Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0
EPwm1Regs.TBCTR = 0x0000; // Clear counter
// Set Compare values
EPwm1Regs.CMPA.half.CMPA = EPWM1_MIN_CMPA; // Set compare A value
EPwm1Regs.CMPB = EPWM1_MAX_CMPB; // Set Compare B value
// Setup counter mode
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count up
EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading
EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; // Clock ratio to SYSCLKOUT
EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV1;
EPwm1Regs.TBCTL.bit.PHSDIR = 1;
EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW;
EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO;
// EPwm1Regs.TBSTS.bit.CTRMAX = 0;
EPwm1Regs.TBSTS.bit.SYNCI = 0;
// Setup shadowing
EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // Load on Zero
EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;
// Set actions
EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear PWM1A on event A, down count
EPwm1Regs.AQCTLB.bit.CBU = AQ_SET; // Set PWM1B on event B, up count
EPwm1Regs.AQCTLB.bit.CBD = AQ_CLEAR; // Clear PWM1B on event B, down count
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;
}
//////////////////////////////////////////////////////////////////////////
ECap1Regs.ECCTL2.bit.SYNCI_EN = 1;
//////////////////////////////////////////////////////////////////////////
Where I miss?
Can any help me?
Thanks
Hi,
Based on my understanding of your post, you are looking to synch ePWM1 with eCAP1 (in APWM mode).
I would recommend first focusing on getting ePWM1's PWMSYNCO pulse show up on GPIO33. Since you are not seeing anything on this pin we can tell that either something is wrong with the ePWM configuration or the GPIO configuration. Based on a quick look at the ePWM code you posted, I do not see anything incorrect.
I have a few questions:
1) Can you generate a waveform on ePWM1A @ GPIO00? This would confirm that the PWM itself is behaving correctly.
2) Have you configured GPIO33 as PWMSYNCO (peripheral selection 2 or GPBMUX1 = 2)
Thank you,
Brett