
GR716-DS-UM, May 2019, Version 1.29
104
www.cobham.com/gaisler
GR716
been calculated we store the data in the status register of the ADC and begin to collect data for the
next temperature measurement.
To further enhance the ENOB the system can make use of the pre-amplifier or/and use dithering i.e.
introduce random noise to the external signal.
Example of setting up the ADC for oversampling of a temperature sensor:
This examples assume the system requires to sample a temperature sensor once every second with the
accuracy of 14 bits and a system clock of 20Mhz.
Configuration and setup steps:
•
Setup a timer to generate a tick/sync event with the frequency of 512Hz to oversample by a fac-
tor of 8. For this example we assume Timer unit 1 and counter 2 is used. See documentation for
timer section.
•
Register bit fields configuration for using ADC channel #0 (Single ended measurement is
assumed i.e. pre-amplifier must be bypassed)
ACFG.AC = 8
// ADC clock should be set to maximum of 3Mhz. Here we use 2.5Mhz i.e. 20Mhz/8
ACFG.AE = 1 // Enable ADC
ACFG.AI = 0x0
// Channel #0
ACFG.AM = 0x1
// Single ended mode
ASAMPC.AO = 0x3F // Oversample by 63+1 i.e. add 3 extra ENOB
ASEQC.SQ = 0x1
// Enable synchronization to synchronization source
ASEQC.SE = 0x1
// Enable sequencer
ASEQC.SC = 0x1
// Enable continuously sampling i.e. Software needs to disable sampling manually
ASYNC.S10 = 0x1
// Synchronize i.e. sample value when counter 2 in timer unit 1 generates a ’tick
ACFG.AS = 0x1
// Start sampling i.e. listen for sync defined in sync register
This will generate a new interrupt and temperature reading from e.g. an external temperature sensor
once every second with 14 bit resolution.
The correct sequence should be as the following address and data table:
12.2.4 Using the DMA to sample long sequences
The build-in DMA controller can be used in order to support long autonomous sampling (or low noise
sampling) with out processor intervention.
For this example we extend the previous example in chapter 12.2.3 by using the DMA to transfer 8
samples from the ADC to the local memory before interrupting the processor. The DMA can be pro-
grammed to transfer a pre-defined or infinite number samples. (The software needs to disable the
DMA if infinite transfer mode is enabled and no interrupt). The DMA controller can be programmed
to generate an interrupt after each transfer or at the end of the transfer. In this example we only gener-
ate an interrupt when all samples has been transfered in order to minimize the interrupt load.
In order to accomplish this we need to:
•
Setup timer and ADC according to chapter 12.2.3
TABLE 91. Example of using on-board ADC to oversample an external analog source
Address
Data
Description
---
---
0x80400018
0x00000009
ADC0 - Mask register (Enable events from ADC0)
0x8040000C
0x00000800
ADC0 - Select trigger (counter 2 in timer unit 1)
0x80400008
0xB0000000
ADC0 - Sequencer control (Enable synchronization to ext trigger,
continuously enabled)
0x80400004
0x0000003F
ADC0 - Sampling configuration (Oversampling, no consecutive)
0x80400000
0x0008C001
ADC0 - Configuration (Speed, Channel, Enable)
---
---