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.
I Use TMS320F280021 for LLC charging process, ePWM3 and ePwm4 are used to drive H-bridge LLC, with PWM operating frequency ranging from 80K to 150K, which is the upper and lower limits set by the software, and resonant operating frequency of 90KHZ. When the frequency of LLC is adjusted from 85K to close to 80K during the working process, there is an occasional possibility of the MOS transistor driving at the same height on the half bridge, which is not 100%. The MOS transistor is directly short circuited and the tube is burned out. May I ask if there are any issues with the configuration? Thank you!
The waveform is as follows:
Drive waveform and frequency at the moment before short circuit:
PWM setting code:
void UserSetEPWM() { EALLOW; CpuSysRegs.PCLKCR0.bit.TBCLKSYNC = 0; EDIS; EALLOW; GpioCtrlRegs.GPHAMSEL.bit.GPIO242 = 0; GpioCtrlRegs.GPHQSEL2.bit.GPIO242 = 3; InputXbarRegs.INPUT1SELECT = 242; GpioCtrlRegs.GPHLOCK.bit.GPIO242 = 1; GpioCtrlRegs.GPHCR.bit.GPIO242 = 1; InputXbarRegs.INPUTSELECTLOCK.bit.INPUT1SELECT = 1; EPwm1Regs.TZSEL.bit.OSHT1 = TZ_ENABLE; EPwm2Regs.TZSEL.bit.OSHT1 = TZ_ENABLE; EPwm3Regs.TZSEL.bit.OSHT1 = TZ_ENABLE; EPwm4Regs.TZSEL.bit.OSHT1 = TZ_ENABLE; EPwm1Regs.TZSEL.bit.OSHT5 = TZ_ENABLE; EPwm2Regs.TZSEL.bit.OSHT5 = TZ_ENABLE; EPwm3Regs.TZSEL.bit.OSHT5 = TZ_ENABLE; EPwm4Regs.TZSEL.bit.OSHT5 = TZ_ENABLE; EPwm1Regs.TZSEL.bit.OSHT6 = TZ_ENABLE; EPwm2Regs.TZSEL.bit.OSHT6 = TZ_ENABLE; EPwm3Regs.TZSEL.bit.OSHT6 = TZ_ENABLE; EPwm4Regs.TZSEL.bit.OSHT6 = TZ_ENABLE; EPwm1Regs.TZCTL.bit.TZA = TZ_FORCE_LO; EPwm1Regs.TZCTL.bit.TZB = TZ_FORCE_LO; EPwm2Regs.TZCTL.bit.TZA = TZ_FORCE_LO; EPwm2Regs.TZCTL.bit.TZB = TZ_FORCE_LO; EPwm3Regs.TZCTL.bit.TZA = TZ_FORCE_LO; EPwm3Regs.TZCTL.bit.TZB = TZ_FORCE_LO; EPwm4Regs.TZCTL.bit.TZA = TZ_FORCE_LO; EPwm4Regs.TZCTL.bit.TZB = TZ_FORCE_LO; EPwm1Regs.TZFRC.bit.OST = 1; EPwm2Regs.TZFRC.bit.OST = 1; EPwm3Regs.TZFRC.bit.OST = 1; EPwm4Regs.TZFRC.bit.OST = 1; EPwm1Regs.GLDCFG.all = 0x07FF; EPwm1Regs.GLDCTL.bit.GLDMODE = 6; EPwm1Regs.GLDCTL.bit.OSHTMODE = 1; EPwm1Regs.GLDCTL.bit.GLD = 1; EPwm1Regs.EPWMXLINK.bit.GLDCTL2LINK = 0; EPwm2Regs.GLDCFG.all = 0x07FF; EPwm2Regs.GLDCTL.bit.GLDMODE = 6; EPwm2Regs.GLDCTL.bit.OSHTMODE = 1; EPwm2Regs.GLDCTL.bit.GLD = 1; EPwm2Regs.EPWMXLINK.bit.GLDCTL2LINK = 0; EPwm3Regs.GLDCFG.all = 0x07FF; EPwm3Regs.GLDCTL.bit.GLDMODE = 6; EPwm3Regs.GLDCTL.bit.OSHTMODE = 1; EPwm3Regs.GLDCTL.bit.GLD = 1; EPwm3Regs.EPWMXLINK.bit.GLDCTL2LINK = 0; EPwm4Regs.GLDCFG.all = 0x07FF; EPwm4Regs.GLDCTL.bit.GLDMODE = 6; EPwm4Regs.GLDCTL.bit.OSHTMODE = 1; EPwm4Regs.GLDCTL.bit.GLD = 1; EPwm4Regs.EPWMXLINK.bit.GLDCTL2LINK = 0; EDIS; EPwm1Regs.TBPRD = EPWMPeriod; EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV1; // TBCLK = SYSCLKOUT /(HSPCLKDIV ×CLKDIV) EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; EPwm1Regs.TBCTL.bit.PHSDIR = TB_UP; EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW; EPwm1Regs.TBCTL.bit.PHSEN = TB_ENABLE; // EPwm1Regs.TBPHS.bit.TBPHS = 0; EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count updown EPwm1Regs.EPWMSYNCINSEL.bit.SEL = SYNC_IN_SRC_DISABLE_ALL; EPwm1Regs.EPWMSYNCOUTEN.bit.ZEROEN = SYNC_OUT_SRC_ENABLE; EPwm2Regs.TBPRD = EPWMPeriod; EPwm2Regs.TBCTL.bit.CLKDIV = TB_DIV1; // TBCLK = SYSCLKOUT /(HSPCLKDIV ×CLKDIV) EPwm2Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; EPwm2Regs.TBCTL.bit.PHSDIR = TB_UP; EPwm2Regs.TBCTL.bit.PRDLD = TB_SHADOW; EPwm2Regs.TBCTL.bit.PHSEN = TB_ENABLE; EPwm2Regs.TBPHS.bit.TBPHS = 2; EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count updown EPwm2Regs.EPWMSYNCINSEL.bit.SEL = SYNC_IN_SRC_SYNCOUT_EPWM1; EPwm3Regs.TBPRD = EPWMPeriod; EPwm3Regs.TBCTL.bit.CLKDIV = TB_DIV1; // TBCLK = SYSCLKOUT /(HSPCLKDIV ×CLKDIV) EPwm3Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; EPwm3Regs.TBCTL.bit.PHSDIR = TB_UP; EPwm3Regs.TBCTL.bit.PRDLD = TB_SHADOW; EPwm3Regs.TBCTL.bit.PHSEN = TB_ENABLE; EPwm3Regs.TBPHS.bit.TBPHS = 3; //10ns dalay EPwm3Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count updown EPwm3Regs.EPWMSYNCINSEL.bit.SEL = SYNC_IN_SRC_SYNCOUT_EPWM1; EPwm4Regs.TBPRD = EPWMPeriod; EPwm4Regs.TBCTL.bit.CLKDIV = TB_DIV1; // TBCLK = SYSCLKOUT /(HSPCLKDIV ×CLKDIV) EPwm4Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; EPwm4Regs.TBCTL.bit.PHSDIR = TB_UP; EPwm4Regs.TBCTL.bit.PRDLD = TB_SHADOW; EPwm4Regs.TBCTL.bit.PHSEN = TB_ENABLE; EPwm4Regs.TBPHS.bit.TBPHS = 3; //10ns delay EPwm4Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count updown EPwm4Regs.EPWMSYNCINSEL.bit.SEL = SYNC_IN_SRC_SYNCOUT_EPWM1; EPwm5Regs.TBPRD = 1000; EPwm5Regs.TBCTL.bit.CLKDIV = TB_DIV1; // TBCLK = SYSCLKOUT /(HSPCLKDIV ×CLKDIV) EPwm5Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; EPwm5Regs.TBCTL.bit.PHSDIR = TB_UP; EPwm5Regs.TBCTL.bit.PRDLD = TB_SHADOW; EPwm5Regs.TBCTL.bit.PHSEN = TB_DISABLE; // EPwm5Regs.TBPHS.bit.TBPHS = 2; //10ns delay EPwm5Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count updown EPwm5Regs.EPWMSYNCINSEL.bit.SEL = SYNC_IN_SRC_DISABLE_ALL; //计数比较模块设定 EPwm1Regs.TBCTR = 0; //0 EPwm1Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LeastTime_LLC; EPwm1Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LeastTime_LLC; EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW; EPwm2Regs.TBCTR = 0; //0 EPwm2Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LeastTime_LLC; EPwm2Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LeastTime_LLC; EPwm2Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; EPwm2Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; EPwm2Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; EPwm2Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW; EPwm3Regs.TBCTR = 0; //0 EPwm3Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LeastTime_LLC; EPwm3Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LeastTime_LLC; EPwm3Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; EPwm3Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; EPwm3Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; EPwm3Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW; EPwm4Regs.TBCTR = 0; //计数初值为0 EPwm4Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LeastTime_LLC; EPwm4Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LeastTime_LLC; 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; EPwm5Regs.TBCTR = 0; //0 // EPwm5Regs.CMPA.bit.CMPA = 0; // EPwm5Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // EPwm5Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; // AQ模块设定 EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; EPwm1Regs.AQCTLA.bit.CBU = AQ_CLEAR; EPwm1Regs.AQCTLB.bit.CBD = AQ_SET; EPwm1Regs.AQCTLB.bit.CAD = AQ_CLEAR; EPwm1Regs.AQCTLA.bit.ZRO = AQ_CLEAR; EPwm1Regs.AQCTLB.bit.ZRO = AQ_CLEAR; EPwm2Regs.AQCTLB.bit.CAU = AQ_SET; EPwm2Regs.AQCTLB.bit.CBU = AQ_CLEAR; EPwm2Regs.AQCTLA.bit.CBD = AQ_SET; EPwm2Regs.AQCTLA.bit.CAD = AQ_CLEAR; EPwm2Regs.AQCTLA.bit.ZRO = AQ_CLEAR; EPwm2Regs.AQCTLB.bit.ZRO = AQ_CLEAR; EPwm3Regs.AQCTLA.bit.CAU = AQ_SET; EPwm3Regs.AQCTLA.bit.CBU = AQ_CLEAR; EPwm3Regs.AQCTLB.bit.CBD = AQ_SET; EPwm3Regs.AQCTLB.bit.CAD = AQ_CLEAR; EPwm3Regs.AQCTLA.bit.ZRO = AQ_CLEAR; EPwm3Regs.AQCTLB.bit.ZRO = AQ_CLEAR; EPwm4Regs.AQCTLB.bit.CAU = AQ_SET; EPwm4Regs.AQCTLB.bit.CBU = AQ_CLEAR; EPwm4Regs.AQCTLA.bit.CBD = AQ_SET; EPwm4Regs.AQCTLA.bit.CAD = AQ_CLEAR; EPwm4Regs.AQCTLA.bit.ZRO = AQ_CLEAR; EPwm4Regs.AQCTLB.bit.ZRO = AQ_CLEAR; //DB EPwm1Regs.DBCTL.bit.OUT_MODE = DB_DISABLE; EPwm2Regs.DBCTL.bit.OUT_MODE = DB_DISABLE; EPwm3Regs.DBCTL.bit.OUT_MODE = DB_DISABLE; EPwm4Regs.DBCTL.bit.OUT_MODE = DB_DISABLE; EPwm1Regs.GLDCTL2.bit.GFRCLD = 1; EPwm5Regs.ETSEL.bit.SOCAEN = 1; // 1 Enable the ADC Start of Conversion B (EPWMxSOCB) Pulse, Enable EPWMxSOCB pulse. EPwm5Regs.ETSEL.bit.SOCASEL = ET_CTR_ZERO; //PRD ADC_B EPwm5Regs.ETPS.bit.SOCAPRD = ET_1ST; // EPwm1Regs.ETSEL.bit.INTEN = 1; // 1 Enable the ADC Start of Conversion B (EPWMxSOCB) Pulse, Enable EPWMxSOCB pulse. // EPwm1Regs.ETSEL.bit.INTSEL = ET_CTR_ZERO; //PRD ADC_B // EPwm1Regs.ETPS.bit.INTPRD = ET_1ST; EALLOW; CpuSysRegs.PCLKCR0.bit.TBCLKSYNC = 1; EDIS; }
PWM LOAD Code:
void loadpwm() { F_SW = CC_PID.PIDU; //PID return value is freq value F_SW = __fmin(150,F_SW); F_SW = __fmax(80,F_SW); EPWMPeriod = 50000 / F_SW; EPWMPeriod_DIV2 = EPWMPeriod / 2; LLC_Hduty_EPWM = LLC_duty * EPWMPeriod_DIV2; if( LLC_Hduty_EPWM > EPWMPeriod_DIV2 - 25 ) { LLC_Hduty_EPWM = EPWMPeriod_DIV2 - 25; } EPWMPeriod = EPWM_Cal_SW / F_SW; EPWMPeriod_DIV2 = EPWMPeriod / 2; EPWMPeriod = EPWMPeriod_DIV2 * 2; F_Int = 50; T_Ctrl = 0.001f/F_Int; EPwm3Regs.TBPRD = EPWMPeriod; //Period of TB = 10kHz EPwm4Regs.TBPRD = EPWMPeriod; //Period of TB = 10kHz EPwm3Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LLC_Hduty_EPWM; EPwm3Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LLC_Hduty_EPWM; EPwm4Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LLC_Hduty_EPWM; EPwm4Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LLC_Hduty_EPWM; EPwm1Regs.GLDCTL2.bit.OSHTLD = 1; }
update the pwm load code as bellow:
void loadpwm() { F_SW = CC_PID.PIDU; //PID return value is freq value F_SW = __fmin(150,F_SW); F_SW = __fmax(80,F_SW); EPWMPeriod = 50000 / F_SW; EPWMPeriod_DIV2 = EPWMPeriod / 2; LLC_Hduty_EPWM = EPWMPeriod_DIV2; if( LLC_Hduty_EPWM > EPWMPeriod_DIV2 - 25 ) { LLC_Hduty_EPWM = EPWMPeriod_DIV2 - 25; } EPWMPeriod = 50000 / F_SW; EPWMPeriod_DIV2 = EPWMPeriod / 2; EPWMPeriod = EPWMPeriod_DIV2 * 2; F_Int = 50; T_Ctrl = 0.001f/F_Int; EPwm3Regs.TBPRD = EPWMPeriod; //Period of TB = 10kHz EPwm4Regs.TBPRD = EPWMPeriod; //Period of TB = 10kHz EPwm3Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LLC_Hduty_EPWM; EPwm3Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LLC_Hduty_EPWM; EPwm4Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LLC_Hduty_EPWM; EPwm4Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LLC_Hduty_EPWM; EPwm1Regs.GLDCTL2.bit.OSHTLD = 1; }
We record the PWM register values(EPwm3Regs.CMPA.bit.CMPA,EPwm3Regs.CMPB.bit.CMPB and EPwm3Regs.TBPRD) for each cycle in a loop in a buffer, and after a short circuit occurred, we write them to the FLASH. We couldn't find any issues. Is there a BUG in the chip?
The specific data is shown in the table below:
The 32nd occurrence of a short circuit in the data record.
EPwm3Regs.CMPA.bit.CMPA | EPwm3Regs.CMPB.bit.CMPB | EPwm3Regs.TBPRD | ||||||
No. | hexadecimal | decimalism | hexadecimal | decimalism | hexadecimal | decimalism |
calculateLLC Freq KHZ |
dead band |
1 | 19 | 25 | 0233 | 563 | 024C | 588 | 85.03401361 | 25 |
2 | 19 | 25 | 022B | 555 | 0244 | 580 | 86.20689655 | 25 |
3 | 19 | 25 | 0225 | 549 | 023E | 574 | 87.10801394 | 25 |
4 | 19 | 25 | 021F | 543 | 0238 | 568 | 88.02816901 | 25 |
5 | 19 | 25 | 021B | 539 | 0234 | 564 | 88.65248227 | 25 |
6 | 19 | 25 | 021B | 539 | 0234 | 564 | 88.65248227 | 25 |
7 | 19 | 25 | 021D | 541 | 0236 | 566 | 88.33922261 | 25 |
8 | 19 | 25 | 0223 | 547 | 023C | 572 | 87.41258741 | 25 |
9 | 19 | 25 | 022B | 555 | 0244 | 580 | 86.20689655 | 25 |
10 | 19 | 25 | 0235 | 565 | 024E | 590 | 84.74576271 | 25 |
11 | 19 | 25 | 023F | 575 | 0258 | 600 | 83.33333333 | 25 |
12 | 19 | 25 | 024B | 587 | 0264 | 612 | 81.69934641 | 25 |
13 | 19 | 25 | 0255 | 597 | 026E | 622 | 80.38585209 | 25 |
14 | 19 | 25 | 0257 | 599 | 0270 | 624 | 80.12820513 | 25 |
15 | 19 | 25 | 0257 | 599 | 0270 | 624 | 80.12820513 | 25 |
16 | 19 | 25 | 0257 | 599 | 0270 | 624 | 80.12820513 | 25 |
17 | 19 | 25 | 0257 | 599 | 0270 | 624 | 80.12820513 | 25 |
18 | 19 | 25 | 0257 | 599 | 0270 | 624 | 80.12820513 | 25 |
19 | 19 | 25 | 0251 | 593 | 026A | 618 | 80.90614887 | 25 |
20 | 19 | 25 | 0247 | 583 | 0260 | 608 | 82.23684211 | 25 |
21 | 19 | 25 | 023B | 571 | 0254 | 596 | 83.89261745 | 25 |
22 | 19 | 25 | 0231 | 561 | 024A | 586 | 85.32423208 | 25 |
23 | 19 | 25 | 0227 | 551 | 0240 | 576 | 86.80555556 | 25 |
24 | 19 | 25 | 0221 | 545 | 023A | 570 | 87.71929825 | 25 |
25 | 19 | 25 | 021D | 541 | 0236 | 566 | 88.33922261 | 25 |
26 | 19 | 25 | 021B | 539 | 0234 | 564 | 88.65248227 | 25 |
27 | 19 | 25 | 021F | 543 | 0238 | 568 | 88.02816901 | 25 |
28 | 19 | 25 | 0225 | 549 | 023E | 574 | 87.10801394 | 25 |
29 | 19 | 25 | 022F | 559 | 0248 | 584 | 85.61643836 | 25 |
30 | 19 | 25 | 023D | 573 | 0256 | 598 | 83.61204013 | 25 |
31 | 19 | 25 | 024B | 587 | 0264 | 612 | 81.69934641 | 25 |
32 | 19 | 25 | 0257 | 599 | 0270 | 624 | 80.12820513 | 25 |
33 | 19 | 25 | 01E1 | 481 | 01FA | 506 | 98.81422925 | 25 |
34 | 19 | 25 | 01DF | 479 | 01F8 | 504 | 99.20634921 | 25 |
35 | 19 | 25 | 01DF | 479 | 01F8 | 504 | 99.20634921 | 25 |
36 | 19 | 25 | 01E3 | 483 | 01FC | 508 | 98.42519685 | 25 |
37 | 19 | 25 | 01E9 | 489 | 0202 | 514 | 97.27626459 | 25 |
38 | 19 | 25 | 01EF | 495 | 0208 | 520 | 96.15384615 | 25 |
39 | 19 | 25 | 01F5 | 501 | 020E | 526 | 95.05703422 | 25 |
40 | 19 | 25 | 01FD | 509 | 0216 | 534 | 93.6329588 | 25 |
41 | 19 | 25 | 0203 | 515 | 021C | 540 | 92.59259259 | 25 |
42 | 19 | 25 | 0205 | 517 | 021E | 542 | 92.25092251 | 25 |
43 | 19 | 25 | 0207 | 519 | 0220 | 544 | 91.91176471 | 25 |
44 | 19 | 25 | 0207 | 519 | 0220 | 544 | 91.91176471 | 25 |
45 | 19 | 25 | 0207 | 519 | 0220 | 544 | 91.91176471 | 25 |
46 | 19 | 25 | 0203 | 515 | 021C | 540 | 92.59259259 | 25 |
47 | 19 | 25 | 01FD | 509 | 0216 | 534 | 93.6329588 | 25 |
48 | 19 | 25 | 01F5 | 501 | 020E | 526 | 95.05703422 | 25 |
49 | 19 | 25 | 01EB | 491 | 0204 | 516 | 96.89922481 | 25 |
50 | 19 | 25 | 01E5 | 485 | 01FE | 510 | 98.03921569 | 25 |
51 | 19 | 25 | 01DF | 479 | 01F8 | 504 | 99.20634921 | 25 |
52 | 19 | 25 | 01DD | 477 | 01F6 | 502 | 99.60159363 | 25 |
53 | 19 | 25 | 01DB | 475 | 01F4 | 500 | 100 | 25 |
54 | 19 | 25 | 01DB | 475 | 01F4 | 500 | 100 | 25 |
55 | 19 | 25 | 01DD | 477 | 01F6 | 502 | 99.60159363 | 25 |
56 | 19 | 25 | 01E1 | 481 | 01FA | 506 | 98.81422925 | 25 |
57 | 19 | 25 | 01E7 | 487 | 0200 | 512 | 97.65625 | 25 |
58 | 19 | 25 | 01ED | 493 | 0206 | 518 | 96.52509653 | 25 |
59 | 19 | 25 | 01F3 | 499 | 020C | 524 | 95.41984733 | 25 |
60 | 19 | 25 | 01F7 | 503 | 0210 | 528 | 94.6969697 | 25 |
61 | 19 | 25 | 01FB | 507 | 0214 | 532 | 93.98496241 | 25 |
62 | 19 | 25 | 01FD | 509 | 0216 | 534 | 93.6329588 | 25 |
63 | 19 | 25 | 01FD | 509 | 0216 | 534 | 93.6329588 | 25 |
64 | 19 | 25 | 01FB | 507 | 0214 | 532 | 93.98496241 | 25 |
65 | 19 | 25 | 01F7 | 503 | 0210 | 528 | 94.6969697 | 25 |
66 | 19 | 25 | 01F1 | 497 | 020A | 522 | 95.78544061 | 25 |
67 | 19 | 25 | 01EB | 491 | 0204 | 516 | 96.89922481 | 25 |
68 | 19 | 25 | 01E5 | 485 | 01FE | 510 | 98.03921569 | 25 |
69 | 19 | 25 | 01E1 | 481 | 01FA | 506 | 98.81422925 | 25 |
70 | 19 | 25 | 01DB | 475 | 01F4 | 500 | 100 | 25 |
71 | 19 | 25 | 01D9 | 473 | 01F2 | 498 | 100.4016064 | 25 |
72 | 19 | 25 | 01D7 | 471 | 01F0 | 496 | 100.8064516 | 25 |
73 | 19 | 25 | 01D9 | 473 | 01F2 | 498 | 100.4016064 | 25 |
74 | 19 | 25 | 01DB | 475 | 01F4 | 500 | 100 | 25 |
75 | 19 | 25 | 01DF | 479 | 01F8 | 504 | 99.20634921 | 25 |
76 | 19 | 25 | 01E3 | 483 | 01FC | 508 | 98.42519685 | 25 |
77 | 19 | 25 | 01E7 | 487 | 0200 | 512 | 97.65625 | 25 |
78 | 19 | 25 | 01ED | 493 | 0206 | 518 | 96.52509653 | 25 |
79 | 19 | 25 | 01F1 | 497 | 020A | 522 | 95.78544061 | 25 |
80 | 19 | 25 | 01F1 | 497 | 020A | 522 | 95.78544061 | 25 |
81 | 19 | 25 | 01F3 | 499 | 020C | 524 | 95.41984733 | 25 |
82 | 19 | 25 | 01F3 | 499 | 020C | 524 | 95.41984733 | 25 |
83 | 19 | 25 | 01F1 | 497 | 020A | 522 | 95.78544061 | 25 |
84 | 19 | 25 | 01ED | 493 | 0206 | 518 | 96.52509653 | 25 |
85 | 19 | 25 | 01EB | 491 | 0204 | 516 | 96.89922481 | 25 |
86 | 19 | 25 | 01E3 | 483 | 01FC | 508 | 98.42519685 | 25 |
87 | 19 | 25 | 01E1 | 481 | 01FA | 506 | 98.81422925 | 25 |
88 | 19 | 25 | 01DD | 477 | 01F6 | 502 | 99.60159363 | 25 |
89 | 19 | 25 | 01DB | 475 | 01F4 | 500 | 100 | 25 |
90 | 19 | 25 | 01D9 | 473 | 01F2 | 498 | 100.4016064 | 25 |
91 | 19 | 25 | 01D9 | 473 | 01F2 | 498 | 100.4016064 | 25 |
92 | 19 | 25 | 01D9 | 473 | 01F2 | 498 | 100.4016064 | 25 |
93 | 19 | 25 | 01DB | 475 | 01F4 | 500 | 100 | 25 |
94 | 19 | 25 | 01DF | 479 | 01F8 | 504 | 99.20634921 | 25 |
95 | 19 | 25 | 01E3 | 483 | 01FC | 508 | 98.42519685 | 25 |
96 | 19 | 25 | 01E7 | 487 | 0200 | 512 | 97.65625 | 25 |
97 | 19 | 25 | 01E9 | 489 | 0202 | 514 | 97.27626459 | 25 |
98 | 19 | 25 | 01ED | 493 | 0206 | 518 | 96.52509653 | 25 |
99 | 19 | 25 | 01EF | 495 | 0208 | 520 | 96.15384615 | 25 |
100 | 19 | 25 | 01EF | 495 | 0208 | 520 | 96.15384615 | 25 |
101 | 19 | 25 | 01ED | 493 | 0206 | 518 | 96.52509653 | 25 |
102 | 19 | 25 | 01ED | 493 | 0206 | 518 | 96.52509653 | 25 |
103 | 19 | 25 | 01ED | 493 | 0206 | 518 | 96.52509653 | 25 |
104 | 19 | 25 | 01E7 | 487 | 0200 | 512 | 97.65625 | 25 |
105 | 19 | 25 | 01E3 | 483 | 01FC | 508 | 98.42519685 | 25 |
106 | 19 | 25 | 01DF | 479 | 01F8 | 504 | 99.20634921 | 25 |
107 | 19 | 25 | 01DD | 477 | 01F6 | 502 | 99.60159363 | 25 |
108 | 19 | 25 | 01DB | 475 | 01F4 | 500 | 100 | 25 |
109 | 19 | 25 | 01D9 | 473 | 01F2 | 498 | 100.4016064 | 25 |
110 | 19 | 25 | 01D9 | 473 | 01F2 | 498 | 100.4016064 | 25 |
111 | 19 | 25 | 01DB | 475 | 01F4 | 500 | 100 | 25 |
112 | 19 | 25 | 01DD | 477 | 01F6 | 502 | 99.60159363 | 25 |
113 | 19 | 25 | 01DF | 479 | 01F8 | 504 | 99.20634921 | 25 |
114 | 19 | 25 | 01E3 | 483 | 01FC | 508 | 98.42519685 | 25 |
115 | 19 | 25 | 01E7 | 487 | 0200 | 512 | 97.65625 | 25 |
116 | 19 | 25 | 01EB | 491 | 0204 | 516 | 96.89922481 | 25 |
117 | 19 | 25 | 01ED | 493 | 0206 | 518 | 96.52509653 | 25 |
118 | 19 | 25 | 01EF | 495 | 0208 | 520 | 96.15384615 | 25 |
119 | 19 | 25 | 01EF | 495 | 0208 | 520 | 96.15384615 | 25 |
120 | 19 | 25 | 01EF | 495 | 0208 | 520 | 96.15384615 | 25 |
121 | 19 | 25 | 01EF | 495 | 0208 | 520 | 96.15384615 | 25 |
122 | 19 | 25 | 01ED | 493 | 0206 | 518 | 96.52509653 | 25 |
123 | 19 | 25 | 01E9 | 489 | 0202 | 514 | 97.27626459 | 25 |
124 | 19 | 25 | 01E7 | 487 | 0200 | 512 | 97.65625 | 25 |
125 | 19 | 25 | 01E5 | 485 | 01FE | 510 | 98.03921569 | 25 |
126 | 19 | 25 | 01E1 | 481 | 01FA | 506 | 98.81422925 | 25 |
127 | 19 | 25 | 01DF | 479 | 01F8 | 504 | 99.20634921 | 25 |
128 | 19 | 25 | 01DF | 479 | 01F8 | 504 | 99.20634921 | 25 |
129 | 19 | 25 | 01E1 | 481 | 01FA | 506 | 98.81422925 | 25 |
130 | 19 | 25 | 01E1 | 481 | 01FA | 506 | 98.81422925 | 25 |
131 | 19 | 25 | 01E1 | 481 | 01FA | 506 | 98.81422925 | 25 |
132 | 19 | 25 | 01E5 | 485 | 01FE | 510 | 98.03921569 | 25 |
133 | 19 | 25 | 01E7 | 487 | 0200 | 512 | 97.65625 | 25 |
134 | 19 | 25 | 01EB | 491 | 0204 | 516 | 96.89922481 | 25 |
135 | 19 | 25 | 01ED | 493 | 0206 | 518 | 96.52509653 | 25 |
136 | 19 | 25 | 01EF | 495 | 0208 | 520 | 96.15384615 | 25 |
137 | 19 | 25 | 01F1 | 497 | 020A | 522 | 95.78544061 | 25 |
138 | 19 | 25 | 01F3 | 499 | 020C | 524 | 95.41984733 | 25 |
139 | 19 | 25 | 01F3 | 499 | 020C | 524 | 95.41984733 | 25 |
140 | 19 | 25 | 01F3 | 499 | 020C | 524 | 95.41984733 | 25 |
141 | 19 | 25 | 01F1 | 497 | 020A | 522 | 95.78544061 | 25 |
142 | 19 | 25 | 01EF | 495 | 0208 | 520 | 96.15384615 | 25 |
143 | 19 | 25 | 01ED | 493 | 0206 | 518 | 96.52509653 | 25 |
144 | 19 | 25 | 01EB | 491 | 0204 | 516 | 96.89922481 | 25 |
145 | 19 | 25 | 01E9 | 489 | 0202 | 514 | 97.27626459 | 25 |
146 | 19 | 25 | 01E9 | 489 | 0202 | 514 | 97.27626459 | 25 |
147 | 19 | 25 | 01E7 | 487 | 0200 | 512 | 97.65625 | 25 |
148 | 19 | 25 | 01E7 | 487 | 0200 | 512 | 97.65625 | 25 |
149 | 19 | 25 | 01E7 | 487 | 0200 | 512 | 97.65625 | 25 |
150 | 19 | 25 | 01E9 | 489 | 0202 | 514 | 97.27626459 | 25 |
151 | 19 | 25 | 01EB | 491 | 0204 | 516 | 96.89922481 | 25 |
152 | 19 | 25 | 01EF | 495 | 0208 | 520 | 96.15384615 | 25 |
153 | 19 | 25 | 01F1 | 497 | 020A | 522 | 95.78544061 | 25 |
154 | 19 | 25 | 01F9 | 505 | 0212 | 530 | 94.33962264 | 25 |
155 | 19 | 25 | 01FB | 507 | 0214 | 532 | 93.98496241 | 25 |
156 | 19 | 25 | 01FB | 507 | 0214 | 532 | 93.98496241 | 25 |
157 | 19 | 25 | 01FB | 507 | 0214 | 532 | 93.98496241 | 25 |
158 | 19 | 25 | 01FD | 509 | 0216 | 534 | 93.6329588 | 25 |
159 | 19 | 25 | 01FB | 507 | 0214 | 532 | 93.98496241 | 25 |
160 | 19 | 25 | 01F9 | 505 | 0212 | 530 | 94.33962264 | 25 |
161 | 19 | 25 | 01F7 | 503 | 0210 | 528 | 94.6969697 | 25 |
162 | 19 | 25 | 01F3 | 499 | 020C | 524 | 95.41984733 | 25 |
163 | 19 | 25 | 01F1 | 497 | 020A | 522 | 95.78544061 | 25 |
164 | 19 | 25 | 01F1 | 497 | 020A | 522 | 95.78544061 | 25 |
165 | 19 | 25 | 01EF | 495 | 0208 | 520 | 96.15384615 | 25 |
166 | 19 | 25 | 01EF | 495 | 0208 | 520 | 96.15384615 | 25 |
167 | 19 | 25 | 01F1 | 497 | 020A | 522 | 95.78544061 | 25 |
168 | 19 | 25 | 01F3 | 499 | 020C | 524 | 95.41984733 | 25 |
169 | 19 | 25 | 01F5 | 501 | 020E | 526 | 95.05703422 | 25 |
170 | 19 | 25 | 01F9 | 505 | 0212 | 530 | 94.33962264 | 25 |
171 | 19 | 25 | 01FB | 507 | 0214 | 532 | 93.98496241 | 25 |
172 | 19 | 25 | 01FF | 511 | 0218 | 536 | 93.28358209 | 25 |
173 | 19 | 25 | 0201 | 513 | 021A | 538 | 92.93680297 | 25 |
174 | 19 | 25 | 0205 | 517 | 021E | 542 | 92.25092251 | 25 |
175 | 19 | 25 | 0207 | 519 | 0220 | 544 | 91.91176471 | 25 |
176 | 19 | 25 | 0207 | 519 | 0220 | 544 | 91.91176471 | 25 |
177 | 19 | 25 | 0207 | 519 | 0220 | 544 | 91.91176471 | 25 |
178 | 19 | 25 | 0205 | 517 | 021E | 542 | 92.25092251 | 25 |
179 | 19 | 25 | 0203 | 515 | 021C | 540 | 92.59259259 | 25 |
180 | 19 | 25 | 0201 | 513 | 021A | 538 | 92.93680297 | 25 |
181 | 19 | 25 | 01FF | 511 | 0218 | 536 | 93.28358209 | 25 |
182 | 19 | 25 | 01FD | 509 | 0216 | 534 | 93.6329588 | 25 |
183 | 19 | 25 | 01FB | 507 | 0214 | 532 | 93.98496241 | 25 |
184 | 19 | 25 | 01FB | 507 | 0214 | 532 | 93.98496241 | 25 |
185 | 19 | 25 | 01FB | 507 | 0214 | 532 | 93.98496241 | 25 |
186 | 19 | 25 | 01FD | 509 | 0216 | 534 | 93.6329588 | 25 |
187 | 19 | 25 | 01FF | 511 | 0218 | 536 | 93.28358209 | 25 |
188 | 19 | 25 | 0203 | 515 | 021C | 540 | 92.59259259 | 25 |
189 | 19 | 25 | 0205 | 517 | 021E | 542 | 92.25092251 | 25 |
190 | 19 | 25 | 0209 | 521 | 0222 | 546 | 91.57509158 | 25 |
191 | 19 | 25 | 020D | 525 | 0226 | 550 | 90.90909091 | 25 |
192 | 19 | 25 | 020F | 527 | 0228 | 552 | 90.57971014 | 25 |
193 | 19 | 25 | 0211 | 529 | 022A | 554 | 90.25270758 | 25 |
194 | 19 | 25 | 0213 | 531 | 022C | 556 | 89.92805755 | 25 |
195 | 19 | 25 | 0215 | 533 | 022E | 558 | 89.60573477 | 25 |
196 | 19 | 25 | 0213 | 531 | 022C | 556 | 89.92805755 | 25 |
197 | 19 | 25 | 0213 | 531 | 022C | 556 | 89.92805755 | 25 |
198 | 19 | 25 | 0211 | 529 | 022A | 554 | 90.25270758 | 25 |
199 | 19 | 25 | 020F | 527 | 0228 | 552 | 90.57971014 | 25 |
200 | 19 | 25 | 020D | 525 | 0226 | 550 | 90.90909091 | 25 |
201 | 19 | 25 | 020B | 523 | 0224 | 548 | 91.24087591 | 25 |
202 | 19 | 25 | 0209 | 521 | 0222 | 546 | 91.57509158 | 25 |
203 | 19 | 25 | 0207 | 519 | 0220 | 544 | 91.91176471 | 25 |
204 | 19 | 25 | 0207 | 519 | 0220 | 544 | 91.91176471 | 25 |
205 | 19 | 25 | 0209 | 521 | 0222 | 546 | 91.57509158 | 25 |
206 | 19 | 25 | 020B | 523 | 0224 | 548 | 91.24087591 | 25 |
207 | 19 | 25 | 020F | 527 | 0228 | 552 | 90.57971014 | 25 |
208 | 19 | 25 | 0213 | 531 | 022C | 556 | 89.92805755 | 25 |
209 | 19 | 25 | 0217 | 535 | 0230 | 560 | 89.28571429 | 25 |
210 | 19 | 25 | 021B | 539 | 0234 | 564 | 88.65248227 | 25 |
211 | 19 | 25 | 021F | 543 | 0238 | 568 | 88.02816901 | 25 |
212 | 19 | 25 | 0221 | 545 | 023A | 570 | 87.71929825 | 25 |
213 | 19 | 25 | 0223 | 547 | 023C | 572 | 87.41258741 | 25 |
214 | 19 | 25 | 0225 | 549 | 023E | 574 | 87.10801394 | 25 |
215 | 19 | 25 | 0225 | 549 | 023E | 574 | 87.10801394 | 25 |
216 | 19 | 25 | 0223 | 547 | 023C | 572 | 87.41258741 | 25 |
217 | 19 | 25 | 0221 | 545 | 023A | 570 | 87.71929825 | 25 |
218 | 19 | 25 | 021F | 543 | 0238 | 568 | 88.02816901 | 25 |
219 | 19 | 25 | 021B | 539 | 0234 | 564 | 88.65248227 | 25 |
220 | 19 | 25 | 0219 | 537 | 0232 | 562 | 88.96797153 | 25 |
221 | 19 | 25 | 0215 | 533 | 022E | 558 | 89.60573477 | 25 |
222 | 19 | 25 | 0213 | 531 | 022C | 556 | 89.92805755 | 25 |
223 | 19 | 25 | 0213 | 531 | 022C | 556 | 89.92805755 | 25 |
224 | 19 | 25 | 0213 | 531 | 022C | 556 | 89.92805755 | 25 |
225 | 19 | 25 | 0215 | 533 | 022E | 558 | 89.60573477 | 25 |
226 | 19 | 25 | 0219 | 537 | 0232 | 562 | 88.96797153 | 25 |
227 | 19 | 25 | 021D | 541 | 0236 | 566 | 88.33922261 | 25 |
228 | 19 | 25 | 0223 | 547 | 023C | 572 | 87.41258741 | 25 |
229 | 19 | 25 | 0229 | 553 | 0242 | 578 | 86.50519031 | 25 |
230 | 19 | 25 | 022D | 557 | 0246 | 582 | 85.91065292 | 25 |
231 | 19 | 25 | 0231 | 561 | 024A | 586 | 85.32423208 | 25 |
232 | 19 | 25 | 0235 | 565 | 024E | 590 | 84.74576271 | 25 |
233 | 19 | 25 | 0239 | 569 | 0252 | 594 | 84.17508418 | 25 |
234 | 19 | 25 | 0237 | 567 | 0250 | 592 | 84.45945946 | 25 |
235 | 19 | 25 | 0235 | 565 | 024E | 590 | 84.74576271 | 25 |
236 | 19 | 25 | 0233 | 563 | 024C | 588 | 85.03401361 | 25 |
237 | 19 | 25 | 022D | 557 | 0246 | 582 | 85.91065292 | 25 |
238 | 19 | 25 | 0227 | 551 | 0240 | 576 | 86.80555556 | 25 |
239 | 19 | 25 | 0223 | 547 | 023C | 572 | 87.41258741 | 25 |
240 | 19 | 25 | 021F | 543 | 0238 | 568 | 88.02816901 | 25 |
241 | 19 | 25 | 021B | 539 | 0234 | 564 | 88.65248227 | 25 |
242 | 19 | 25 | 0219 | 537 | 0232 | 562 | 88.96797153 | 25 |
243 | 19 | 25 | 0219 | 537 | 0232 | 562 | 88.96797153 | 25 |
244 | 19 | 25 | 021D | 541 | 0236 | 566 | 88.33922261 | 25 |
245 | 19 | 25 | 0221 | 545 | 023A | 570 | 87.71929825 | 25 |
246 | 19 | 25 | 0227 | 551 | 0240 | 576 | 86.80555556 | 25 |
247 | 19 | 25 | 022D | 557 | 0246 | 582 | 85.91065292 | 25 |
248 | 19 | 25 | 0237 | 567 | 0250 | 592 | 84.45945946 | 25 |
249 | 19 | 25 | 023D | 573 | 0256 | 598 | 83.61204013 | 25 |
250 | 19 | 25 | 0245 | 581 | 025E | 606 | 82.50825083 | 25 |
251 | 19 | 25 | 0249 | 585 | 0262 | 610 | 81.96721311 | 25 |
252 | 19 | 25 | 024B | 587 | 0264 | 612 | 81.69934641 | 25 |
253 | 19 | 25 | 024B | 587 | 0264 | 612 | 81.69934641 | 25 |
254 | 19 | 25 | 0249 | 585 | 0262 | 610 | 81.96721311 | 25 |
255 | 19 | 25 | 0243 | 579 | 025C | 604 | 82.78145695 | 25 |
256 | 19 | 25 | 023B | 571 | 0254 | 596 | 83.89261745 | 25 |
Hi Qin,
When are you updating the ePWM parameters? Are you using a timer ISR? What ePWM signals are the green/yellow, is it ePWM3's output?
Best,
Ryan Ma
Hi Qin,
Could you show me when the PWM CMP registers get updated and loaded by toggling a GPIO during your ADC ISR? According to your configurations is the following diagram representative of what is occurring before the short with AU = CMPAU, and BU = CMPBU, BD = CMPBD events? Is the highlighted red No. 32 row where the short occurs?
EPwm3Regs.AQCTLA.bit.CAU = AQ_SET;
EPwm3Regs.AQCTLA.bit.CBU = AQ_CLEAR;
EPwm3Regs.AQCTLA.bit.ZRO = AQ_CLEAR;
EPwm3Regs.AQCTLB.bit.CBD = AQ_SET;
EPwm3Regs.AQCTLB.bit.CAD = AQ_CLEAR;
EPwm3Regs.AQCTLB.bit.ZRO = AQ_CLEAR;
The data log you are capturing appears to have CMP values still even after the highlighted red portion, how come the PWM signals stop after the short? Can you verify that the TBCTR is continuously running after the short circuit occurs? When the short occurs, are you shutting off the PWM?
I believe there is something happening with the loading scheme of your setup, with an AQ event being missed because either CMPBU is greater than TBPRD or there is nothing in the shadow registers at the time the global load scheme occurs. Is there anything special about this last PWM period that is happening in the code?
Best,
Ryan Ma
Hi Ryan:
The following are normal charging process ePWM3 and GPIO toggling waveform.yellow and blue are ePWM,Green is GPIO.When the Green signal rise is begin to load PWM CMP registers. You can see the detail code as bellow.
void PWM_load() is use in the ISR.
void PWM_load() { static Uint16 CountNum = 0; LED1on(); // test GIIO go high F_SW = CC_PID.PIDU; //PID return value is freq value F_SW = __fmin(150,F_SW); F_SW = __fmax(80,F_SW); EPWMPeriod = 50000 / F_SW; EPWMPeriod_DIV2 = EPWMPeriod / 2; LLC_Hduty_EPWM = EPWMPeriod_DIV2; if( LLC_Hduty_EPWM > EPWMPeriod_DIV2 - 25 ) { LLC_Hduty_EPWM = EPWMPeriod_DIV2 - 25; } EPwm3Regs.TBPRD = EPWMPeriod; //Period of TB = 10kHz EPwm4Regs.TBPRD = EPWMPeriod; //Period of TB = 10kHz EPwm1Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LLC_Lduty_EPWM; EPwm1Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LLC_Lduty_EPWM; EPwm2Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LLC_Lduty_EPWM; EPwm2Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LLC_Lduty_EPWM; EPwm3Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LLC_Hduty_EPWM; EPwm3Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LLC_Hduty_EPWM; EPwm4Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LLC_Hduty_EPWM; EPwm4Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LLC_Hduty_EPWM; EPwm1Regs.GLDCTL2.bit.OSHTLD = 1; WriteFlashBuf[i] = EPwm3Regs.CMPA.bit.CMPA; // Save pwm value every cycle WriteFlashBuf[i+512] = EPwm3Regs.CMPB.bit.CMPB; WriteFlashBuf[i+1024] = EPwm3Regs.TBPRD; if(CountNum < 511) { CountNum++; } else { CountNum = 0; } WriteFlashBuf[1536] = CountNum; // Save occur short-circuit count num LED1off(); }
The diagram what I show is save in a buffer every ISR,when the short circuit occurs,the hardware will occurs a TZ module protect and stop the PWM, and then write the buffer data to the use flash area.After a short circuit occurred, I read Flash data and CountNum variables,Through the count number I know when the error happen.The CountNum may not be the counting at that time,but it must be one of the previous times.
Yes,I suspect that scertain register is not set correctly or miss some seting.But I don't know.
On the other hand,I found a iInteresting things,when the ePwm frequency is change from high drop to low over 2K,it maybe occurs short circuit.The following table shows the data when errors is occur.The red line is the final CountNum record.
So,I write a program to simulate a frequency jumps.It run on a demo board.It can reproduce the phenomenon of short circuits.
The program is as follows:
***********************************************************************/ void loadpwm() { volatile static float Temp_CC_PID_Gain = 1; static Uint16 u16TurnPhaseFlag = 0; static Uint16 u16adjfreqNum = 0; static float Fnum = 0; /**********************debug************************/ if(u16TurnPhaseFlag) { F_SW = F_SW + 0.01f; if( F_SW > 100 ) // max freq is 100K { u16TurnPhaseFlag = 0; } } else { F_SW = F_SW - 0.01f ; if( F_SW < 80 ) // min freq is 80k { u16TurnPhaseFlag = 1; } } if(TimerFlg.bit.TimerPWM1msFlag) // 1ms timer flag { TimerFlg.bit.TimerPWM1msFlag = 0; u16adjfreqNum++; if(Fnum < 7.0f) // { Fnum = Fnum + 0.1; // change freq } else { Fnum = 0; } if(u16adjfreqNum > 1000) { u16adjfreqNum = 0; F_SW = F_SW - Fnum; LED1on(); // GPIO tes signal,load epwm } if(u16adjfreqNum > 500) { LED1off(); } } /**********************debug************************/ F_SW = __fmin(150,F_SW); F_SW = __fmax(80,F_SW); // 限上下限 EPWMPeriod = 50000 / F_SW; EPWMPeriod_DIV2 = EPWMPeriod / 2; LLC_Hduty_EPWM = EPWMPeriod_DIV2; if( LLC_Hduty_EPWM > EPWMPeriod_DIV2 - 25 ) { LLC_Hduty_EPWM = EPWMPeriod_DIV2 - 25; } LLC_Lduty_EPWM = LLC_Hduty_EPWM*0.9f; // 开启同步整流后低压MOS PWM为高压MOS的90% EPwm3Regs.TBPRD = EPWMPeriod; //Period of TB = 10kHz EPwm4Regs.TBPRD = EPWMPeriod; //Period of TB = 10kHz EPwm3Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LLC_Hduty_EPWM; EPwm3Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LLC_Hduty_EPWM; EPwm4Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LLC_Hduty_EPWM; EPwm4Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LLC_Hduty_EPWM; EPwm1Regs.GLDCTL2.bit.OSHTLD = 1; }
The short-circuit waveform is as follows:yellow is low drive,green is high drive,blue is GPIO signal(ePMW load signal).
Do you have any good suggestions?
Thanks!
Hi Qin,
Can you please clarify if green is ePWM3A and yellow is ePWM3B?
EPwm3Regs.GLDCTL.bit.GLDMODE = 6;
Here you're global loading on a SYCNEVT correct?
EPwm3Regs.TBCTL.bit.PHSDIR = TB_UP;
After the sync event you count up, what is your TBPHS at the time? It may get updated to a value greater than TBPRD causing a missed AQ.
Best,
Ryan Ma
Hi Qin,
I believe it is a loading scheme issue with the counter compare registers. Can you try loading on CTR == PERIOD or ZRO for ePWM3?
Best,
Ryan Ma
Hi Qin,
If you're using ePWM1 to sync the other ePWM modules, why are you changing ePWM3's and ePWM4's TBPRD. This will cause the ePWM's to become out of sync to each other, and we do not recommend this as the sync scheme. Could you synchronize ePWM3 and ePWM4's modules together since their TBPRD will be aligned with each other?
Best,
Ryan Ma
Hi Ryan:
"I believe it is a loading scheme issue with the counter compare registers. Can you try loading on CTR == PERIOD or ZRO for ePWM3?"
We had set the global Register GLDCFG and GLDCTL.The CTR == PERIOD or ZRO for ePWM3,is it right? So short circuits still occur.
EPwm3Regs.GLDCFG.all = 0x07FF;
EPwm3Regs.GLDCTL.bit.GLDMODE = 6;
"If you're using ePWM1 to sync the other ePWM modules, why are you changing ePWM3's and ePWM4's TBPRD."
Yes.We want using ePWM1 to sync the other ePWM modules.The ePWM1's,ePWM2's,ePWM3's,ePWM4's TBPRD are change as the same time.I removed the TBPRD loading for ePWM1 and ePWM2 in the code I showed you.All ePMW's TBPRD are load as the same time in the ISR.If it cause the ePWM's to become out of sync to each other?
void PWM_load() { static Uint16 CountNum = 0; LED1on(); // test GIIO go high F_SW = CC_PID.PIDU; //PID return value is freq value F_SW = __fmin(150,F_SW); F_SW = __fmax(80,F_SW); EPWMPeriod = 50000 / F_SW; EPWMPeriod_DIV2 = EPWMPeriod / 2; LLC_Hduty_EPWM = EPWMPeriod_DIV2; if( LLC_Hduty_EPWM > EPWMPeriod_DIV2 - 25 ) { LLC_Hduty_EPWM = EPWMPeriod_DIV2 - 25; } EPwm1Regs.TBPRD = EPWMPeriod; //Period of TB = 10kHz EPwm2Regs.TBPRD = EPWMPeriod; //Period of TB = 10kHz EPwm3Regs.TBPRD = EPWMPeriod; //Period of TB = 10kHz EPwm4Regs.TBPRD = EPWMPeriod; //Period of TB = 10kHz EPwm1Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LLC_Lduty_EPWM; EPwm1Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LLC_Lduty_EPWM; EPwm2Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LLC_Lduty_EPWM; EPwm2Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LLC_Lduty_EPWM; EPwm3Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LLC_Hduty_EPWM; EPwm3Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LLC_Hduty_EPWM; EPwm4Regs.CMPA.bit.CMPA = EPWMPeriod_DIV2 - LLC_Hduty_EPWM; EPwm4Regs.CMPB.bit.CMPB = EPWMPeriod_DIV2 + LLC_Hduty_EPWM; EPwm1Regs.GLDCTL2.bit.OSHTLD = 1; WriteFlashBuf[i] = EPwm3Regs.CMPA.bit.CMPA; // Save pwm value every cycle WriteFlashBuf[i+512] = EPwm3Regs.CMPB.bit.CMPB; WriteFlashBuf[i+1024] = EPwm3Regs.TBPRD; if(CountNum < 511) { CountNum++; } else { CountNum = 0; } WriteFlashBuf[1536] = CountNum; // Save occur short-circuit count num LED1off(); }
"Could you synchronize ePWM3 and ePWM4's modules together since their TBPRD will be aligned with each other?"
How should I set it up?Could you show me the setting code?
On the other hand,We found some clues to this issue today. I test the frequency jumps code,and turn out all pwm.When the frequency change,the ePWM3A's period change first,but the ePWM1 is not change.Next cycle ePWM3B and ePWM1B are change,this time may causing a missed AQ.It caused a short circuit.
Do you have any idea?
As follow waveform:Yellow is ePWM3B,Green is ePWM3A,Blue is ePWM1A,Purple is ePWM1B.
ePWM3 period change:
ePWM1 period change:
Thanks!
Hi Qin,
We will do some testing here to produce the same results based on the configurations your team sent over. Once we have this set up we can see what configuration issue may be.
Thank you for your patience.
Best,
Ryan Ma
Hi Qin,
Here is a summary of the fixed results attached in this powerpoint. This should resolve the short circuit issue, please let me know if you have any questions on the slide or content.
Best,
Ryan MaTOBPAND_SUMMARY.pptx
Hi Qin,
I am preparing a test case for our design team to simulate.
Best,
Ryan Ma