Part Number: TMS320F280049C
Other Parts Discussed in Thread: C2000WARE
Hello C2000 Team,
I am having some confusion concerning use of the HRPWM with the AUTOCONV feature. I am using F28004x, so following TRM SPRUI33C, example on p.1913.
Step 1 makes sense. I would perform something like this in C:
float duty=0.405;
int period=80;
CMPx = duty*period; // CMPx=32
Step 2 is where the confusion is. In particular, there is a note at the bottom of the example that says:
NOTE: If the AUTOCONV bit (HRCNFG.6) is set and the MEP_ScaleFactor is in the HRMSTEP
register, then CMPAHR / CMPBHR register value = frac (PWMDuty*PWMperiod<<8). The
rest of the conversion calculations are performed automatically in hardware, and the correct
MEP-scaled signal edge appears on the ePWM channel output. If AUTOCONV is not set, the
above calculations must be performed by software.
I'm supposed to compute frac(duty*period<<8)?
Specifically, this is frac( (duty*period)<<8) using order of operations.
frac( (80*0.405)<<8) = frac(32.4 << 8) = frac(8243.2) = 0.2.
This doesn't make sense. Perhaps it is supposed to be frac(PWMduty*PWMperiod) << 8. That would be
frac(32.4)<< 8 = (0.4)<<8 = 102
Can someone advise, what is the correct value to put in the CMPxHR register when AUTOCONV=1?
Regards,
David