Error ADC and Front End Gain
117
SNIU028A – February 2016 – Revised April 2016
Copyright © 2016, Texas Instruments Incorporated
Front End
Averaging is controlled with the EADC control register. To select Averaging mode, write a 1 into the
EADC_MODE bits:
FeCtrl0Regs.EADCCTRL.bit.EADC_MODE = 1; //averaging mode
There are 3 bits, giving a total of 8 modes, all of which will be discussed later in this section.
The simplest mode is mode 0 – 1 sample, no averaging.
To select spatial mode, write a 1 to the AVG_SPATIAL_EN bit:
FeCtrl0Regs.EADCCTRL.bit.AVG_SPATIAL_EN = 1; //spatial averaging mode
A 0 in this bit will select continuous mode.
To select which number of samples to average, use the AVG_MODE_SEL bits. They work as follows:
0 = 2x Averaging (Default)
1 = 4x Averaging
2 = 8x Averaging
FeCtrl0Regs.EADCCTRL.bit.AVG_MODE_SEL = 2; //select 8X averaging
There is also a weighted average control bit available, which gives more weight to the most recent
samples. See
for details.
3.1.6 Enabling EADC and Front End
There are several bits which must all be set to enable the EADC and the entire front end. Most of them
are enabled by default. To save power and reduce noise, the default bits can be cleared if the EADC is
not being used.
The enable bits for EADC 0 are:
FeCtrl0Regs.EADCCTRL.bit.EADC_ENA = 1; //1 is default
FeCtrl0Regs.EADCCTRL.bit.SCFE_ENA = 1; //1 is default
Some modules in the Front End can be used without enabling the EADC.
There is also a bit in the Loop Mux which must be set for the Front End 0 to start.
LoopMuxRegs.GLBEN.bit.FE_CTRL0_EN = 1; //0 is default
The GLBEN register is a special register, with enables for all front ends and all DPWMs in the same
register. It is designed to allow simultaneous start up of all front ends and DPWMs, by writing to the whole
register at once. This is very useful for complex topologies where all FET control waveforms need to start
up simultaneously to prevent malfunction.
union GLBEN_REG glben_temp; //make a temp variable to accumulate desired configuration
glben_temp.bit.FE_CTRL0_EN = 1;
glben_temp.bit.FE_CTRL2_EN = 1;
glben_temp.bit.DPWM0_EN = 1;
glben_temp.bit.DPWM1_EN = 1;
LoopMuxRegs.GLBEN = glben_temp; //enable FE0, FE2, DPWM0, DPWM1
The code above makes a temporary variable called glben_temp, initializes it, and then writes it all to the
GLBEN register at once. It is also possible to do this:
LoopMuxRegs.GLBEN.all = 0x53; //enable FE0, FE2, DPWM0, DPWM1
This is a bit more efficient, but not nearly as readable. The best way would be:
#define FE_CTRL0_EN_BIT 0x100
#define FE_CTRL2_EN_BIT 0x400
#define DPWM0_EN_BIT 1
#define DPWM1_EN_BIT 2
LoopMuxRegs.GLBEN.all = FECTRL0_ FE+CTRL2_ DPWM0_
DPWM1_EN_BIT;
Of course, writing to each bit of the register directly would not accomplish a simultaneous start up. This
could cause a power supply malfunction. For both DPWM and Front End, both local bits and global bits
must be set to enable these peripherals. For a simultaneous startup, it is necessary to set the local bits
before writing to the global register.