SNIU028D February 2016 – September 2020 UCD3138 , UCD3138064 , UCD3138064A , UCD3138128 , UCD3138A , UCD3138A64
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_EN_BIT + FE+CTRL2_EN_BIT + DPWM0_EN_BIT +
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.