Part Number: TMS320F28P659DK-Q1
Other Parts Discussed in Thread: C2000WARE
Hi,
I've been having issues understanding the operation of the hrpwm_ex4_duty_updown_sfo example for F28P65x, SDK version 5.01.
The example seems like it should increment between 4% and 96%, with increments of 0.01%.
I see this generally working, although I see that when HR 8bit register rolls over from 0xFF to 0x01, that the duty cycle jumps 0.5%.
The example runs PWM at a Frequency of 505kHz, with TBPRD = 99, therefore i expect course PWM to have a duty cycle resolution of ~1%. I might be wrong here, but the HRPWM should then be able to achieve 1%/255 (8bit register), which equals 0.0000396%?
The table below shows some measurements i have collected using an oscilloscope, with timebase period equal to 100. I am manipulating the CMPA register using the debugger.
CMPA |
HR (8bit) |
Duty Cycle |
CMPA |
HR(8bit) |
Duty Cycle |
|
| 71 | 1 | 28.53% | 70 | 1 | 29.54% | |
| 71 | 128 | 28.28% | 70 | 128 | 29.29% | |
| 71 | 255 | 28% | 70 | 255 | 29% |
As shown above when CMPA = 71 and HR reg = 1, duty cycle equals 28.54%. When CMPA=70 and HR reg = 255, duty cycle = 29%, therefore there is a gap of 0.5% that the HRPWM is unable to achieve?
I have also tested this with hrpwm_ex1_duty_sfo, and i see the same thing, although timebase period and duty cycles are different.
Another thing that confuses me is that the frequency of PWM is 505kHz, which uses TBPRD=99, but the counter compare is calculated using a TBPRD=100. Why is this? Why do I not seem to need to do this for non-HRPWM up-down count PWM?
Many Thanks,
Andrew