- Part Number: TMS320F28377D
Tool/software:
Hello,
while working with HRPWM on a TMS320F282377D mcu, I noticed some behaviours which made me doubt about what understood from the Technical Reference Manual (SPRUHM8I).
In particular, from figure 15-24 at page 1896, it seems that edges are generated by the Action-Qualifier submodule immediately after TBCTR up counts from CMPx to CMPx+1 or immediately after it down counts from CMPx to CMPx-1, like if the Action-Qualifier output signals were latched and not resulting from the continuous comparison of TBCTR with CMPx.
This seems in contrast with the description given in subsections "15.5.1 Purpose of the Counter-Compare Submodule" at page 1882, where it is written that "The counter-compare submodule takes as input the time-base counter value. This value is continuously compared to the counter-compare A (CMPA) counter-compare B (CMPB) counter-compare C (CMPC) and counter-compare D (CMPD ) registers. When the time-base counter is equal to one of the compare registers, the counter-compare unit generates an appropriate event."
So it would seem that a match event is generated immediately after TBCTR up counts from CMPx-1 to CMPx or immediately after down counts from CMPx+1 to CMPx as a consequence of the continuous comparison.
Additionally, from subsection "15.14.1.5.3 Duty Cycle Range Limitation" at page 1962, it seems that HRPWM is forcibly disabled only during the first three EPWMCLK periods of every timebase period when high resolution period control is not used.
During my tests and for the sake of simplicity, I have configured EPWM1 as follows:
- up-count direction only (TBCTR.CTRMODE = 0b00);
- overall timebase prescaler ratio set to 1 (TBCTL.CLKDIV = TBCTL.HSPCLKDIV = 0xb000);
- TBPRD = 99;
- TBCTR == CMPA event used for generating an AQEPWM1A rising edge (AQCTLA.CAU = 0b10);
- TBCTR == CMPB event used for generating an AQEPWM1A falling edge (AQCTLA.CBU = 0b01);
- deadband submodule completely bypassed (DBCTL.OUT_MODE = 0b11);
- high resolution period control disabled (HRPCTL.HRPE = 0);
- high resolution deadbanding disabled (HRCNFG2.EDGMODEDB = 0b00);
TEST 1:
When CMPB = 99, HRCNFG.EDGEMODE = 0b10 (hi-res positioning of AQEPWM1A falling edge) and CMPA=10, I can perform high resolution positioning of the AQEPWM1A falling edge (the one resulting from the TBCTR == CMPB event) in the range 0 < CMPAHR <= (MEPscaleFactor-1) = 61. For greater CMPAHR values, the AQEPWM1A falling edge does not shift anymore.
This behaviour makes me believe that the AQEPWM1A falling edge is generated immediately after TBCTR up counts from 98 to 99 (CMPx-1 to CMPx transition) and not immediately after it is overflows from 99 to 0 (CMPx to CMPx+1 transition shown in figure 15-24) .
The fact that micro-positioning of the AQEPWM1A falling edge is not anymore possible for CMPAHR >= MEPscaleFactor = 62 is consistent with the fact that the HRPWM submodule is forcibly disabled by the encountering of the HRPWM inoperativity region of the successive PWM period while it is still delaying the AQEPWM1A falling edge.
As a result, the HRPWM submodule is suddenly bypassed and the AQEPWMiA signal is immediately output so generating a falling edge synchronized with the start of the successive PWM period/HRPWM inoperativity region no matter is CMPAHR >= MEPscaleFactor.
TEST 2:
When CMPB = 90, HRCNFG.EDGEMODE = 0b01 (hi-res positioning of AQEPWM1A rising edge), CMPA = 0 or CMPA = 1, the AQEPWM1A rising edge cannot be micro-positioned whatever is the CMPAHR register value. This is consistent with the fact that, for such CMPA values, the resulting AQEPWM1A rising edges fall into the HRPWM inoperativity region.
TEST 3:
When CMPA = 2, the AQEPWM1A rising edge can be again micro-positioned not only in the 0 < CMPAHR <= 61 range but also in the larger 0 < CMPAHR < 0xFE range.
However this behaviour should occur only for CMPA >= 3 if the HRPWM inoperativity region is three EPWMCLK periods large and if the rising edge resulting from the TBCTR == CMPA event is generated immediately after TBCTR up counts from CMPA-1 to CMPA as TEST 1 would suggest.
So here are my questions for you.
- if in up-count mode, edges are generated immediately after TBCTR up counts from CMPx to CMPx+1 as Figure 15-24 would suggest, how can you explain the results obtained from TEST 1?
In such case, the falling edge resulting from the TBCTR == CMPB == 99 event should not be micro-positionable because occurring exactly at the beginning of the HRPWM inoperativity region of the successive PWM period.
- if in up-count mode, edges are generated immediately after TBCTR up counts from CMPx-1 to CMPx as TEST 1 would suggest, how can you explain the results obtained from TEST 3?
If the HRPWM inoperativity region is three EPWMCLK periods large, the first AQEPWM1A rising edge falling outside of it would be the one resulting from the TBCTR == CMPA == 3 event.
The only explanation for both TEST 1 and TEST 3 is that, in up-count mode, edges are generated when TBCTR up-counts from CMPx-1 to CMPx and the HRPWM inoperativity region is two (not three) EPWMCLK periods large.
Any alternative explanation would be very welcome.
Thank you very much for your support,
Best Regards,
Alberto