Table 4-4. CMPA versus Duty (left), and [CMPA:CMPAHR] versus Duty (right)
CMPA
(count)
Duty
High Time
(ns)
CMPA
(count)
CMPAHR
(count)
Duty
High Time
(ns)
17
23.61%
188.9
21
31
29.86%
238.88
18
25.0%
200.0
21
32
29.88%
239.06
19
26.39%
211.1
21
33
29.91%
239.24
20
27.78%
222.2
21
34
29.93%
239.42
21
29.17%
233.4
21
35
29.95%
239.60
22
30.56%
244.5
21
36
29.97%
239.78
23
31.94%
255.5
21
37
30.00%
239.96
24
33.33%
266.6
21
38
30.02%
240.14
25
34.72%
277.8
21
39
30.04%
240.32
Required
21
40
30.06%
240.50
21.6
30.0%
240.0
21
41
30.09%
240.68
(1)
System clock, SYSCLKOUT and TBCLK = 90 MHz, 11.1 ns
(2)
For a PWM Period register value of 72 counts, PWM Period = 72 x 11.1 ns = 800 ns, PWM frequency = 1/800 ns = 1.25 MHz
(3)
Assumed MEP step size for the above example = 180 ps
See the device-specific data manual for typical and maximum MEP values.
4.2.3.2 Scaling Considerations
The mechanics of how to position an edge precisely in time has been demonstrated using the resources of the
standard CMPA and MEP (CMPAHR) registers. 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. This section describes the mapping
from a per-unit duty cycle only. The method for mapping from a per-unit period is described in
To do this, first examine the scaling or mapping steps involved. It is common in control software to express
duty cycle in a per-unit or percentage basis. This has the advantage of performing all needed math calculations
without concern for the final absolute duty cycle, expressed in clock counts or high time in ns. Furthermore, it
makes the code more transportable across multiple converter types running different PWM frequencies.
To implement the mapping scheme, a two-step scaling procedure is required.
Assumptions for this example:
System clock , SYSCLKOUT
= 11.1 ns (90 MHz)
PWM frequency
= 1.25 MHz (1/800 ns)
Required PWM duty cycle,
PWMDuty
= 0.300 (30.0%)
PWM period in terms of coarse steps,
PWMperiod
(800 ns/ 11.1 ns)
= 72
Number of MEP steps per coarse step at
180 ps ( 11.1 ns/ 180 ps),
MEP_ScaleFactor
= 61
Value to keep CMPAHR within the range of 1-255 and
fractional rounding constant (default value). In the event that
frac(
PWMDuty * PWMperiod
) * MEP_ScaleFactor results in
a value with a decimal portion ≥ 0.5, this rounding constant
will round the CMPAHR value up 1 MEP step.
= 0.5 (0 080h in Q8 format)
High-Resolution Pulse Width Modulator (HRPWM)
SPRUH18I – JANUARY 2011 – REVISED JUNE 2022
TMS320x2806x Microcontrollers
385
Copyright © 2022 Texas Instruments Incorporated
Содержание TMS320 2806 Series
Страница 2: ......