www.ti.com
Controlling a 3-Phase Interleaved DC/DC Converter
Example 3-5. Code Snippet for Configuration in Figure 3-13
//=====================================================================
// Config |
|
|
// Initialization Time |
|
|
//======================== |
|
|
// EPWM Module 1 config |
|
|
EPwm1Regs.TBPRD = 450; |
| // Period = 900 TBCLK counts |
EPwm1Regs.TBPHS = 0; |
| // Set Phase register to zero |
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; | // Symmetrical mode | |
EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; | // Master module | |
EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW; |
| |
EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; | // Sync | |
EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; |
| |
EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW; |
| |
EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; | // load on CTR=Zero | |
EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; | // load on CTR=Zero | |
EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; | // set actions for EPWM1A | |
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR; |
| |
EPwm1Regs.DBCTL.bit.MODE = DB_FULL_ENABLE; | // enable | |
EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC; | // Active Hi complementary | |
EPwm1Regs.DBFED = 20; |
| // FED = 20 TBCLKs |
EPwm1Regs.DBRED = 20; |
| // RED = 20 TBCLKs |
// EPWM Module 2 config |
|
|
EPwm2Regs.TBPRD = 450; |
| // Period = 900 TBCLK counts |
EPwm2Regs.TBPHS = 300; |
| // Phase = 300/900 * 360 = 120 deg |
EPwm2Regs.TBCTL.bit.CTRMODE = | TB_COUNT_UPDOWN; | // Symmetrical mode |
EPwm2Regs.TBCTL.bit.PHSEN = | TB_ENABLE; | // Slave module |
EPwm2Regs.TBCTL.bit.PHSDIR = | TB_DOWN; | // Count DOWN on sync (=120 deg) |
EPwm2Regs.TBCTL.bit.PRDLD = | TB_SHADOW; |
|
EPwm2Regs.TBCTL.bit.SYNCOSEL = | TB_SYNC_IN; | // sync |
EPwm2Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; |
| |
EPwm2Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW; |
| |
EPwm2Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; | // load on CTR=Zero | |
EPwm2Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; | // load on CTR=Zero | |
EPwm2Regs.AQCTLA.bit.CAU = AQ_SET; | // set actions for EPWM2A | |
EPwm2Regs.AQCTLA.bit.CAD = AQ_CLEAR; |
| |
EPwm2Regs.DBCTL.bit.MODE = DB_FULL_ENABLE; | // enable | |
EPwm2Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC; | // Active Hi Complementary | |
EPwm2Regs.DBFED = 20; |
| // FED = 20 TBCLKs |
EPwm2Regs.DBRED = 20; |
| // RED = 20 TBCLKs |
// EPWM Module 3 config |
|
|
EPwm3Regs.TBPRD = 450; |
| // Period = 900 TBCLK counts |
EPwm3Regs.TBPHS = 300; |
| // Phase = 300/900 * 360 = 120 deg |
EPwm3Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; | // Symmetrical mode | |
EPwm3Regs.TBCTL.bit.PHSEN = TB_ENABLE; | // Slave module | |
EPwm2Regs.TBCTL.bit.PHSDIR = TB_UP; | // Count UP on sync (=240 deg) | |
EPwm3Regs.TBCTL.bit.PRDLD = TB_SHADOW; |
| |
EPwm3Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN; | // sync | |
EPwm3Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; |
| |
EPwm3Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW; |
| |
EPwm3Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; | // load on CTR=Zero | |
EPwm3Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; | // load on CTR=Zero | |
EPwm3Regs.AQCTLA.bit.CAU = AQ_SET; | // set actions for EPWM3Ai | |
EPwm3Regs.AQCTLA.bit.CAD = AQ_CLEAR; |
| |
EPwm3Regs.DBCTL.bit.MODE = DB_FULL_ENABLE; | // enable | |
EPwm3Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC; | // Active Hi complementary | |
EPwm3Regs.DBFED = 20; |
| // FED = 20 TBCLKs |
EPwm3Regs.DBRED = 20; |
| // RED = 20 TBCLKs |
//Run Time (Note: Example execution of one
EPwm1Regs.CMPA.half.CMPA = 285; | // adjust duty for output EPWM1A | |||
EPwm2Regs.CMPA.half.CMPA | = | 285; | // adjust duty for | output EPWM2A |
EPwm3Regs.CMPA.half.CMPA | = | 285; | // adjust duty for | output EPWM3A |
88 | Applications to Power Topologies |