SNIU028D February 2016 – September 2020 UCD3138 , UCD3138064 , UCD3138064A , UCD3138128 , UCD3138A , UCD3138A64
The EADC takes either 16 or 32 cycles of the 250 MHz high speed clock to complete an analog to digital conversion. The timing logic runs continuously, producing samples every 64 or 128 ns. This gives maximum sample rates of 16 MHz and 8 MHz respectively. The sample trigger, when it occurs, takes the latest sample. It does not trigger the start of a conversion.
To set the EADC speed, use the Switched Cap Front End (SCFE) Divide by 2 (SCFE_DIV_2) bit in the EADC Control register. Setting the bit divides the sample period by 2. The bit is set by default, giving a nominal 64 ns sample period. Clearing the bit doubles the period:
FeCtrl0Regs.EADCCTRL.bit.SCFE_CLK_DIV_2 = 0; //clear for 128 ns sample interval.
By default the EADC switched cap filter runs continuously at a fixed rate. If the period is not an integer multiple of this rate, the sample time could shift around within a 64 nanosecond window.
To avoid this, set the Frame Sync Enable bit:
FeCtrl0Regs.EADCCTRL.bit.FRAME_SYNC_EN = 1;
//resync EADC sampling to frame boundary at start of each frame.
The frame start signal comes from 1 or more DPWMs. DPWM selection is done in the Front End Control Mux Registers in the Loop Mux. Each Front end has a Front End Control Mux register which controls many inputs to the Front End, including the frame sync for the EADC sampling reset.
For example, to use DPWM3 frame sync for Front End 2:
LoopMuxRegs.FECTRL2MUX.bit.DPWM3_FRAME_SYNC_EN = 1;
There is a bit which initializes the state machine counter for the front end to a non-zero value. This should be left at 0, however. Other numbers will cause unexpected results.
FeCtrl0Regs.EADCCTRL.bit.SCFE_CNT_INIT = 0; //leave at 0.