SNIU028D February 2016 – September 2020 UCD3138 , UCD3138064 , UCD3138064A , UCD3138128 , UCD3138A , UCD3138A64
Here is the final stage of the filter:
This stage converts the filter output to match the input requirements of the DPWM. Two different calculations are performed sequentially, using the same multiplier, but with different settings. One calculation provides a DPWM duty value, and the other provides a DPWM period value. In many topologies, only the duty value is used. In LLC, both values are used.
At the start of this stage, the PID output is multiplied by one of several 14 bit unsigned numbers, giving a 38 bit output. For the Filter Duty calculation, there are 4 numbers which can be used. See Section 4.4.8 for a discussion of these numbers. For the Filter Period calculation, only 2 numbers can be selected.
After the multiplication, there is a 38 bit signed result. Negative values are clamped to zero and the sign bit is removed. This gives a 37 bit positive result. This number is rounded to the 18 most significant bits. This section is the same for both calculations.
After rounding and clamping, the two outputs are handled differently. The Filter Duty value is clamped using the values in the Filter Output Clamp High Register (FILTEROCLPHI) and the Filter Output Clamp Low Register (FILTEROCLPLO). After that, the Filter Duty value is used by the DPWM as a time value. It is considered a 14.4 bit value, with the low 4 bits going to the high resolution section of the DPWM. So the resolution of the Filter Duty value is 250 psec.
The Filter Period value gets no clamp. The DPWM Period does not support high resolution, so the low 4 bits from the 18 bit result are truncated. The Filter Period only presents the high 14 bits to the DPWM, giving a resolution of a nominal 4 nanoseconds.
Here is an example of a typical use of the Filter Output Stage:
Filter YN (50% Duty) 0x400000 or 4194304
X DPWM Period (100 kHz) 0x9C4 or 2500
=
0x271000000 or 10485760000
Shift right by 19 bits and round: 0
x4E20 or 20000
This result is what goes to the DPWM, with high resolution.
To convert it back to the period scale and check results, we can divide by 16, which is the same as shifting right by 4 bits. This gives:
0x4e2 or 1250,
which is half the period, so we do get a 50% duty cycle.