Part Number: TMS320F28388D
Hi,
Sorry it took so long for the follow-up on the previous topic.
At the end of our last conversation I still had a few unanswered questions, which as of today are not yet answered by the Technical Reference Manual.
My question :
I'm confused, does it mean that the HRPWM extension will not work properly if I don't perform a "dummy" write in my initialization code?
Answer :
It does work, but the set of accepted values are from 0x1 and up. Using the value 0 for the HR section will not give you the correct ePWM frequency that you assume. That is becuase the 0x0 value in the HR portion does not mean your PWM calculation is the same as if you had your HRMODE disabled.
My new question :
Sorry I don't get it. Every single document about the HRPWM I've come accross basically says that CMPAHR value = (number of MEP steps) << 8. So what you are saying is that this is true except in the case where I want zero MEP steps?
For example the formulas in chapter 26.15.1.5.2 Scaling Considerations explicitely show how the value of CMPAHR should be based on frac(PWMDuty*PWMPeriod). Do you mean that this formula is actually wrong if PWMDuty*PWMPeriod happens to be an integer without a fractional part?
Another excerpt from the latest TRM :
26.15.1.5.2 Scaling Considerations
In a practical application, however, it is necessary to seamlessly provide the CPU a mapping function from a per-unit (fractional) duty cycle to a final integer (non-fractional) representation that is written to the [CMPA:CMPAHR] register combination.
The sample assembly code from the latest TRM :
Example 26-4. HRPWM Buck Converter Run-Time CodeMOVW DP, #_HRBUCK_InMOVL XAR2,@_HRBUCK_In ; Pointer to Input Q15 Duty (XAR2)MOVL XAR3,#CMPAHR1 ; Pointer to HRPWM CMPA reg (XAR3)
; Output for EPWM1A (HRPWM)MOV T,*XAR2 ; T <= DutyMPYU ACC,T,@_hrbuck_period ; Q15 to Q0 scaling based on PeriodMOV T,@_MEP_ScaleFactor ; MEP scale factor (from optimizer s/w)MPYU P,T,@AL ; P <= T * AL, Optimizer scalingMOVH @AL,P ; AL <= P, move result back to ACCADD ACC, #0x080 ; MEP range and rounding adjustmentMOVL *XAR3,ACC ; CMPA:CMPAHR(31:8) <= ACC
In this sample code there is no check of any kind about the MEP step count. And this code has been in your docs forever. I have spotted it in the HRPWM user guide for the F2803x from ten years ago.
This worries me. Is the procedure performed by the sample code above not correct? If not why are the docs not up to date?
Kind regards,
Pierre