43.7.5 ADC Module Core Control Registers

Table 43-10. Register Bit Attribute Legend
Symbol Description Symbol Description Symbol Description
R Readable bit HC Cleared by Hardware (Grey cell) Unimplemented
W Writable bit HS Set by Hardware X Bit is unknown at Reset
K Write to clear S Software settable bit
Name: CONFIG[0].CORCTRL
Offset: 0x20
Reset: 0x00000C00
Property: Write-Protected, Enable-Protected

Bit 3130292827262524 
  ADCDIV[6:0] 
Access R/WR/WR/WR/WR/WR/WR/W 
Reset 0000000 
Bit 2322212019181716 
  SCNRTDSSTRGLVL STRGSRC[3:0] 
Access R/WR/WR/WR/WR/WR/W 
Reset 000000 
Bit 15141312111098 
 EIRQOVREIS[2:0]SELRES[1:0]SAMC[9:8] 
Access R/WR/WR/WR/WR/WR/WR/WR/W 
Reset 00001100 
Bit 76543210 
 SAMC[7:0] 
Access R/WR/WR/WR/WR/WR/WR/WR/W 
Reset 00000000 

Bits 30:24 – ADCDIV[6:0] Division Ratio for ADC Clock

ADCDIV provides the ADC analog functional clock referred to as the ADC clock or TAD, (i.e., the period of the ADC clock). It divides CTL_CLK output clock from (GCLK_ADC Period * (CTRLD.CTLCKDIV+1)) with period = TQ to produce the resulting ADC_CLK for ADC sampling and converting. It will have the period TAD given by the formula:

TAD = (GCLK_ADCx Period * (CTRLD.CTLCKDIV+1)) * (2 * ADCDIV)

Note: The ADC throughput rate FTPR = [1 / ((SAMC+2) * TAD) + ((#bits of resolution selected+1)*TAD)] / # of active AINx inputs.

Example 1:

TAD = 1/ADC_CLK = 1/(GCLK_ADCx Period * (CTRLD.CTLCKDIV+1)) * (2 * ADCDIV)

TAD = 1/ADC_CLK = 1/60 MHz = 16.6667 ns, SAMC = 0x4, SELRES = 0x3 = 12 bits, AIN0 active only.

ADC throughput rate:

FTPR = [1 / (6TAD + 13TAD)] / 1

= 1 / 19TAD

= 1 / (19 * 16.6667e-9)

= 3.157894 msps

Example 2: (Non Interleaved Mode)

TAD = 1/ADC_CLK = 1/(GCLK_ADCx Period * (CTRLD.CTLCKDIV+1)) * (2 * ADCDIV)

TAD = 1/ADC_CLK = 1/60 MHz = 16.6667 ns, SAMC = 0x4, SELRES = 0x3 = 12 bits, AIN0 and AIN3 in single ended mode active.

ADC throughput rate:

FTPR = [1 / (6TAD + 13TAD)] / 2

= (1 / 19TAD) / 2

= (1 / (16 * 16.6667e-9)) / 2

= 1.578947 msps

Note:
  1. This bit is Enabled Protected : (Writes are ignored when CTRLA.ENABLE = 1) . Returns a bus error.
  2. The minimum sample rate for ADC is Ftpr >= 100 ksps.
ValueDescription
1111111 254·TQ = TAD
... ...
0000011 TQ = TAD
0000010 TQ = TAD
0000001 TQ = TAD
0000000 Reserved

Bit 22 – SCNRTDS SCAN Retrigger Disable for ADC

Note:
  1. This bit is Enabled Protected: (Writes are ignored when CTRLA.ENABLE = 1). Returns a bus error.
ValueDescription
0 Allows the scan cycle to restart from the beginning, lowest CSSn channel even before all of the scan channels have been measured if a new scan trigger arrives before then. If this happens then the INTENCLRn.EOSRDY flag will be set when the current scan is interrupted, and the new scan starts from the beginning of the lowest CSSn channel selected.
1 Prevents an early scan trigger (arriving before of the end of the current scan) from starting a new scan cycle. The scan will includes all channels associated with ADCn which have their CHNCFG4n.TRGSRCk set to point to the Scan Trigger, i.e., CHNCFG4n.TRGSRCy[3:0] = 4’b0011, and have their associated CHNCFG2n.CSSk bit set.

Bit 21 – STRGLVL Scan Trigger High Level Sensitivity for the ScanTrigger of the ADCn (STRIGn)

Note:
  1. This bit is Enabled Protected (Writes are ignored when CTRLA.ENABLE = 1). Returns a bus error.

STRGLVL functions as follows:

ValueDescription
0 SCANTRG is Positive Edge Active(the power-up value for backwards compatibility).

A positive edge on the SCANTRG will initiate a single but complete scan of all included channels.

1 SCANTRG is High Level Active. So long as SCANTRG stays high, the entire scan will re-trigger.

Bits 19:16 – STRGSRC[3:0] SCAN Trigger Source Select for the SCANTRG

These bits select the trigger source for the scan trigger SCANTRG serving ADCn. The trigger STRIGn serves all the channels k which are associated to ADCn, have their CHNCFG{4|5}n.TRGSRCk = 4’h0011, and have their Channel Scan Select bit set (CHNCFG2n.CSSk = 1’b1).

Note:
  1. This bit is Enabled Protected: (Writes are ignored when CTRLA.ENABLE = 1). Returns a bus error.
ValueDescription
0000 No trigger (NOP)
0001 Global Software Trigger (CTRLB.GSWTRG) - self-cleared on the next APB clock cycle.
0010 Level Software Trigger (CTRLB.LSWTRG) - NOT self-cleared.
0011 Reserved
0100 Synchronous Trigger (CTRLC.CNT)
Note: In order to utilize CORCTRL.STRGSRC = 0x4, the user must configure the following registers:
  • CTRLC.CNT
  • CHNCFG2n.CSSx
  • CHNCFG4n.TRGSRCx = 0x3
  • CTRLB.SWCNVEN = 0
0101 - 1111 ADC Trigger Event User 0 – 10

Bit 15 – EIRQOVR Interrupt Type Selection

Note:
  1. This bit is Enabled Protected: (Writes are ignored when CTRLA.ENABLE = 1). Returns a bus error.
ValueDescription
0 Use normal ADC interrupts
1 Use early ADC interrupts as defined by CORCTRLn.EIS bits

Bits 14:12 – EIS[2:0] Early Interrupt Select Bits for ADCn

These bits select the number of core clocks and TAD clocks prior to the end of conversion at which the early interrupt is generated. All channels serviced by ADCn share the same EIS setting.

The interrupt is generated ((EIS +1) x TAD) ADC Module clocks prior to end of conversion.

Note:
  1. This bit is Enabled Protected: (Writes are ignored when CTRLA.ENABLE = 1). Returns a bus error.
  2. Early interrupt is a feature that can be useful in ADC very high speed data acquisitions to mask the MCU interrupt latency delay.

    Example: CPU MCLK =200 MHz, ADC CTL_CLK = 60 MHz and ADC TAD Clk = 30 MHz.

    Hypothetically, if it took the CPU 20 MCLK cycles to service an interrupt, then theoretically the ADC early interrupt EIS could be set to 4, so that the ISR latency was masked. The CPU could then read the ADC result almost immediately from within the Interrupt Service Routine (ISR), when the result was ready, without any concern for overwriting the current result or FIFO with the next ADC conversion result.

Note: Depending on the bit resolution selection field SELRES, the allowed maximum EIS values are as follows:
  • 12-bit Resolution, all 8 possible settings are allowed, 0 - 7
  • 10-bit Resolution, all 8 possible settings are allowed, 0 - 7
  • 8-bit Resolution, only the 6 lowest settings are allowed, 0 - 5
  • 6-bit Resolution, only the 4 lowest settings are allowed, 0 - 3

The hardware will utilize the maximum allowed EIS setting if the user sets the EIS value that is too big.

CAUTION: Do not set the EIS to large or the interrupt can occur before the ADC conversion is complete and the CPU could read the previous ADC conversion result instead of the one in progress.
ValueDescription
0x0 Generate interrupt 1 TAD clock before end of ADC conversion
0x1 Generate interrupt 2 TAD clocks before end of ADC conversion
0x2 Generate interrupt 3 TAD clocks before end of ADC conversion
0x3 Generate interrupt 4 TAD clocks before end of ADC conversion
0x4 Generate interrupt 5 TAD clocks before end of ADC conversion
0x5 Generate interrupt 6 TAD clocks before end of ADC conversion
0x6 Generate interrupt 7 TAD clocks before end of ADC conversion
0x7 Generate interrupt 8 TAD clocks before end of ADC conversion

Bits 11:10 – SELRES[1:0] ADC Resolution for the ADCn

Note:
  1. This bit is Enabled Protected: (Writes are ignored when CTRLA.ENABLE = 1). Returns a bus error.
ValueDescription
00 6 bits
01 8 bits
10 10 bits
11 12 bits (power-on default)

Bits 9:0 – SAMC[9:0] Sample Count

The sample time required depends on the external analog signal source impedance. Refer to the ADC electrical characteristics of SAMC values required based on external source impedance. If the external analog source impedance is unknown or if your getting inconsistent ADC results consider increasing the SAMC sample time at the cost of a lower ADC throughput rate of course.

ADCn Throughput Rate:

FTPR = [1 / ((SAMC value +2) * TAD) + ((#bits of resolution selected+1)*TAD)] / # of active AINx inputs on ADCn

Note:
  1. All channels serviced by ADCn share the same SAMC setting.
  2. The sampling sequence starts with a trigger event.
  3. The internal sampling cap is not discharged between samples. These bits are Enabled Protected: Writes are ignored when CTRLA.ENABLE = 1 returns a bus error.
  4. When IVREF is to be sampled ( Internal - ADC3 Module - Channel 6), (SAMC value + 2) * TAD must be ≧ 30 us.
ValueDescription
1111111111 1025 TADn
... ...
0000000001 3 TADn
0000000000 Reserved