26.3.17 ADC Programming Model
The ADC configuration registers are considered static and can only be updated when (1) ADC is in SYNC mode and (2) ADC is idle.
ADC is considered busy when it is doing conversions (either the SINGLEACT or SCANACT status flag is high) or when it is warmed up
(one of the following status flags is high: WARM, SINGLEREFWARM, SCANREFWARM). The following registers are considered ADC
configuration registers: CMU_ADCCTRL, ADCn_CTRL, ADCn_SINGLECTRL, ADCn_SINGLECTRLX, ADCn_SCANCTRL,
ADCn_SCANCTRLX, ADCn_SCANINPUTSEL, ADCn_SCANNEGSEL, ADCn_IEN, ADCn_BIASPROG, ADCn_SCANMASK,
ADCn_CAL and ADCn_CMPTHR.
From reset, the ADC is in SYNC mode by default. The user can program the configuration registers as needed. If PRS is to be used,
PRSEN in ADCn_SINGLECTRL/ADCn_SCANCTRL should be set after all other configuration is complete. Once configuration is com-
plete, the ADC is ready to receive triggers. The user must ensure that no LESENSE triggers come in during the time the ADC configu-
ration registers are being updated.
After the ADC has been used to perform conversions, the user must ensure that the ADC is idle before updating the configuration regis-
ters. The first step is to ensure that no new triggers (PRS, LESENSE) are being issued. It can take a few cycles from when a trigger is
received to when SINGELACT/SCANACT flags go high due to synchronization requirement. If it is unclear when the triggers were is-
sued and if those are under synchronization or not, the user should add a small delay before checking the status flags. If the SINGLE-
ACT/SCANACT status flags are high, the corresponding STOP command should be issued and the user should wait until the SINGLE-
ACT/SCANACT flags go low. If the ADC was warmed up, then the WARMUPMODE should be changed to NORMAL and then the user
should wait on WARM, SINGLEREFWARM and SCANREFWARM flags until those go low. Now the ADC is idle.
If both LESENSE scan and PRS/software scan conversions are taking place, then since there are two scans occurring, the SCAN
STOP command needs to be issued twice. The user can check the SCANPENDING status flag. If the flag is set then the user needs to
send out 2 SCAN STOP commands. After sending out the first SCAN STOP, the user needs to wait until the SCANPENDING flag goes
low. Then the second SCAN STOP command should be issued and the user should wait on the SCANACT status flag to go low.
Note:
When switching ADCCLKMODE in the ADCn_CTRL register, use the appropriate sequence below:
• SYNC to ASYNC:
1. Disable ADC interrupts
2. Clear the FIFOs
3. Switch the ADCCLKMODE
Note:
If the ADC is to be used in ASYNC clock mode with WARMUPMODE set to KEEPADCWARM, then both ADCCLKMODE
and WARMUPMODE fields in the ADCn_CTRL register should be set to the desired values in the same register write. This will
ensure that the ADC power-on sequence is valid.
• ASYNC TO SYNC:
1. Disable ADC interrupts
2. Switch the ADCCLKMODE
3. Clear the FIFOs
The FIFOs are cleared by writing 1 to the ADCn_SCANFIFOCLEAR and ADCn_SINGLEFIFOCLEAR registers.
When switching from ASYNC to SYNC, ensure that the ASYNC clock is turned off before doing the switch.
Reference Manual
ADC - Analog to Digital Converter
silabs.com
| Building a more connected world.
Rev. 1.1 | 870