SNIU028D February 2016 – September 2020 UCD3138 , UCD3138064 , UCD3138064A , UCD3138128 , UCD3138A , UCD3138A64
The reference voltage for the Front End is set by the DAC, sometimes called the EADC DAC. This is a 10 bit analog to digital converter, with a nominal step size of 1.5625 millivolts per bit. The DAC input is a unsigned 10 bit number, giving a range from 0 to 1.6 Volts.
In the simplest configuration, the DAC is set by writing to the EADCDAC register:
FeCtrl0Regs.EADCDAC.bit.DAC_VALUE = 100 * 16;//set 10 bit DAC to 100 (.15625 Volts)
The 16X multiply is necessary because the DAC logic also supports a 4 bit dither capability.
The DAC_VALUE bit has 14 total bits - 10 actual DAC bits, and 4 bits that are used for dither:
13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
DAC Value | Dither |
This dither has a 4 bit counter driven by a selected DWPM signal, which will switch back and forth between 2 DAC values. For example, if the DAC value is set to 100.75 *16, there will be a 0b11000100 (equivalent to 100) in the 10 DAC bits, and a 0b1100 (equivalent to 12 or 0.75 x 16) in the 4 dither bits.
The dither logic will put out a 100 for 4 counts and 101 for 12 counts. This will give an average of 100.75. Here is the waveform:
The dither counter will increment at the start of a pulse on DPWMA and/or DPWMB. The specific DPWM pins used are selected in the FECTRLxMUX registers in the Loop Mux.
For example, to set the rising edge of DPWM3B to trigger DAC dither on Front End 2:
LoopMuxRegs.FECTRL2MUX.bit.DPWM3_B_TRIG_EN = 1;
//set DPWM3B up to trigger dither.
Note that if the DPWM pin is not active, because of anything from a zero filter output to a fault, the dither counter will not be incremented.
To enable dither, the DAC_DITHER_EN bit must be set:
FeCtrl0Regs.EADCDAC.bit.DAC_VALUE = (int)(100.25 * 16);
//set 10 bit DAC to 100.25 (0.156640625 Volts)
FeCtrl0Regs.EADCDAC.bit.DAC_DITHER_EN = 1;//enable dither
The DAC can also be controlled by other DACs, by the output of filters, or by the constant power module.
The External DAC Control register in the Loop Mux can be used to select which DAC source is used.
There are several options:
0 = DAC 0 Setpoint Selected
1 = DAC 1 Setpoint Selected
2 = DAC 2 Setpoint Selected
3 = Output of Constant Power Module Selected
4 = Filter 0 Output Selected
5 = Filter 1 Output Selected
6 = Filter 2 Output Selected
LoopMuxRegs.EXTDACCTRL.bit.DAC0_SEL = 5; //control DAC 0 with Filter 1
To enable external DAC Control, it is also necessary to set the enable bit for the specific DAC:
LoopMuxRegs.EXTDACCTRL.bit.EXT_DAC0_EN = 1; //enable external DAC for DAC 0
Filter output is used to control the DAC when two filters are used together, typically in average current mode control, where the voltage error goes to a voltage loop filter, and the output of the voltage loop filter controls the DAC for a current loop filter.
The actual value being used for the DAC at any given time can be read from the DAC Status register – DACSTAT.
dac_value = FeCtrl0Regs.DACSTAT.bit.DAC_VALUE;