38.7.5 SARCORE Control

Table 38-12. Register Bit Attribute Legend
SymbolDescriptionSymbolDescriptionSymbolDescription
RReadable bitHCCleared by Hardware(Grey cell)Unimplemented
WWritable bitHSSet by HardwareXBit is unknown at Reset
KWrite to clearSSoftware settable bit
Name: CORCTRL
Offset: 0x020
Reset: 0x00000C00
Property: RW

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 SARCORE 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_ADC 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/75 MHz = 13.33 ns, SAMC = 0x1, SELRES = 0x3 = 12 bits, AIN0 used only ADC throughput rate

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

= 1 / 16TAD

= 1 / (16 * 13.33e-9)

= 4.6875 msps

Example 2: (Non Interleaved Mode)

TAD = 1/ADC_CLK = 1/75 MHz = 13.33 ns, SAMC = 0x1, SELRES = 0x3 = 12 bits, AIN0 and AIN3 in single ended mode used ADC throughput rate

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

= (1 / 16TAD) / 2

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

= 4.6875e+6

= 2.34375 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 ADC0 is Ftpr >= 100 ksps.
  3. For optimal performance and accuracy, the user must select the maximum TAD clock supported by the device as specified in the ADC electrical specs:

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

  4. If the user wishes to control the ADC throughput rate, they must do so by modulating either CORCTRLn.SAMC or the EVSYS trigger interval or both. Do not try to do so by reducing the TAD clock frequency as this will increase the ADC conversion time allowing the charge on the ADC holding capacitor from the sampled analog input signal to leak off, attenuating the ADC result accuracy.
ValueDescription
1111111254·TQ = TAD
......
0000011TQ = TAD
0000010TQ = TAD
0000001TQ = TAD
0000000 Reserved

Bit 22 – SCNRTDS SCAN Re-trigger Disable

Note:
  1. This bit is Enabled Protected: (Writes are ignored when CTRLA.ENABLE = 1). Returns a bus error.
ValueDescription
0Allows 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 INTENCLR.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.
1Prevents an early scan trigger (arriving before of the end of the current scan) from starting a new scan cycle. The scan will include all channels which have their CHNCFG4.TRGSRCk set to point to the Scan Trigger, i.e., CHNCFG4.TRGSRCy[3:0] = 4’b0011, and have their associated CHNCFG2.CSSk bit set.

Bit 21 – STRGLVL Scan Trigger Level Sensitivity

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

STRGLVL functions as follows:

ValueDescription
0SCANTRG 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.

1SCANTRG 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 selection

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

Note:
  1. This bit is Enabled Protected: Writes are ignored when CTRLA.ENABLE = 1 returns a bus error.
  2. In order to utilize CORCTRLn.STRGSRC=0x4, user must configure the following registers:
    1. CTRLC.CNT.
    2. CHNCFG2n.CSSx.
    3. CHNCFG4/5n.TRGSRCx=0x3.
    4. CTRLB.SWCNVEN = 0.
ValueNameDescription
0NO_TRIGGERNo Trigger (NOP)
1GLOBAL_SOFTWARE_TRIGGERGlobal Software Trigger
2GLOBAL_LEVEL_TRIGGERGlobal Level Software Trigger
4SYNC_TRIGGERSynchronous Trigger (STRIG)
5EVENT_USER0ADC Trigger Event User 0
6EVENT_USER1ADC Trigger Event User 1
7EVENT_USER2ADC Trigger Event User 2
8EVENT_USER3ADC Trigger Event User 3
9EVENT_USER4ADC Trigger Event User 4
10EVENT_USER5ADC Trigger Event User 5
11EVENT_USER6ADC Trigger Event User 6
12EVENT_USER7ADC Trigger Event User 7
13EVENT_USER8ADC Trigger Event User 8
14EVENT_USER9ADC Trigger Event User 9
15EVENT_USER10ADC Trigger Event User 10

Bit 15 – EIRQOVR Interrupt Type Select

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

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

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 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 =72 Mhz, ADC CTL_CLK = 36 MHz and ADC TAD Clk = 18 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, hence 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
0x0Generate interrupt 1 TAD clock before end of ADC conversion
0x1Generate interrupt 2 TAD clocks before end of ADC conversion
0x2Generate interrupt 3 TAD clocks before end of ADC conversion
0x3Generate interrupt 4 TAD clocks before end of ADC conversion
0x4Generate interrupt 5 TAD clocks before end of ADC conversion
0x5Generate interrupt 6 TAD clocks before end of ADC conversion
0x6Generate interrupt 7 TAD clocks before end of ADC conversion
0x7Generate interrupt 8 TAD clocks before end of ADC conversion

Bits 11:10 – SELRES[1:0] Selects Resolution

Note:
  1. This bit is Enabled Protected: (Writes are ignored when CTRLA.ENABLE = 1). Returns a bus error.
ValueNameDescription
06_BITS6 bits
18_BITS8 bits
210_BITS10 bits
312_BITS12 bits (power-on default)

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

The sample time required depends on the external analog signal source impedance. (See 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.

ADC Throughput Rate

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

Note:
  1. All channels share the same SAMC setting.
  2. The sampling sequence starts with a trigger event.
  3. The internal sampling cap is not discharged between samples.
  4. These bits are Enabled Protected: Writes are ignored when CTRLA.ENABLE = 1 returns a bus error.
  5. When IVREF is to be sampled (SAMC value + 2) * TAD must be ≧ 30 us.
ValueDescription
11111111111025 TADn
......
00000000013 TADn
0000000000Reserved