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'm learning 28379D one day workshop and have read the following codes:
void InitEPwm1(void)
{
// Setup TBCLK
EPwm1Regs.TBCTL.bit.CTRMODE = 0; // Count up
EPwm1Regs.TBPRD = period1; // Set timer period
EPwm1Regs.TBCTL.bit.PHSEN = 0; // Disable phase loading
EPwm1Regs.TBPHS.bit.TBPHS = 0x0000; // Phase is 0
EPwm1Regs.TBCTR = 0x0000; // Clear counter
EPwm1Regs.TBCTL.bit.HSPCLKDIV = 1; // Clock ratio to SYSCLKOUT
EPwm1Regs.TBCTL.bit.CLKDIV = 0;
EPwm1Regs.TBCTL.bit.SYNCOSEL = 1; // SYNC output on CTR = 0
// Setup shadow register load on ZERO
EPwm1Regs.CMPCTL.bit.SHDWAMODE = 0;
EPwm1Regs.CMPCTL.bit.SHDWBMODE = 0;
EPwm1Regs.CMPCTL.bit.LOADAMODE = 0;
EPwm1Regs.CMPCTL.bit.LOADBMODE = 0;
// Set Compare values
EPwm1Regs.CMPA.bit.CMPA = dutyCycle1; // Set compare A value
// Set actions
EPwm1Regs.AQCTLA.bit.ZRO = 2; // Set PWM1A on Zero
EPwm1Regs.AQCTLA.bit.CAU = 1; // Clear PWM1A on event A, up count
}
void InitEPwm5(void)
{
// Setup TBCLK
EPwm5Regs.TBCTL.bit.CTRMODE = 0; // Count up
EPwm5Regs.TBPRD = PWM1_PERIOD; // Same period as PWM1
EPwm5Regs.TBCTL.bit.PHSEN = 1; // Enable phase loading
EPwm5Regs.TBPHS.bit.TBPHS = phaseOffset5; // Phase
EPwm5Regs.TBCTR = 0x0000; // Clear counter
EPwm5Regs.TBCTL.bit.HSPCLKDIV = 1; // Clock ratio to SYSCLKOUT
EPwm5Regs.TBCTL.bit.CLKDIV = 0;
// Setup shadow register load on ZERO
EPwm5Regs.CMPCTL.bit.SHDWAMODE = 0;
EPwm5Regs.CMPCTL.bit.SHDWBMODE = 0;
EPwm5Regs.CMPCTL.bit.LOADAMODE = 0;
EPwm5Regs.CMPCTL.bit.LOADBMODE = 0;
// Set Compare values
EPwm5Regs.CMPA.bit.CMPA = dutyCycle5; // Set compare A value
// Set actions
EPwm5Regs.AQCTLA.bit.ZRO = 2; // Set PWM1A on Zero
EPwm5Regs.AQCTLA.bit.CAU = 1; // Clear PWM1A on event A, up count
}
It's said that EPWM5 SYNC input is from EPWM1 SYNCOUT, but I don't understand. From below picture, EPWM5 SYNC input can only be from EPWM4 SYNCOUT, and EPWM4 SYNC input is selected by SYNCSELEPWM4SYNCIN among EPWM1SYNCOUT, EXTSYNCIN1, EXTSYNCIN2.
Hi Howard,
Can you tell us which section of the workshop you are referencing? One possibility is that EPWM1's SYNCO is going to EPWM4 which is being passed through to EPWM5. However, I will need to review the specific context to determine if this is the case here or not.
Thanks,
Kris
Howard,
The default for EPWM4 bit fields SYNCOSEL [5-4] is SyncIn is passed to SyncOut. Please see the TRM page 1656. You can also reference the multi-day workshop manual module 7 for more details (see figures on pages 7-8 and 7-9). The multi-day workshop materials can be found at:
http://processors.wiki.ti.com/index.php/C2000_Multi-Day_Workshop
I hope this helps.
- Ken