CC13xx Driver Library
[aux_adc] AUX Analog to Digital Converter

Functions

void AUXADCDisable (void)
 Disables the ADC. More...
 
void AUXADCEnableAsync (uint32_t refSource, uint32_t trigger)
 Enables the ADC for asynchronous operation. More...
 
void AUXADCEnableSync (uint32_t refSource, uint32_t sampleTime, uint32_t trigger)
 Enables the ADC for synchronous operation. More...
 
void AUXADCDisableInputScaling (void)
 Disables scaling of the ADC input. More...
 
void AUXADCFlushFifo (void)
 Flushes the ADC FIFO. More...
 
static void AUXADCGenManualTrigger (void)
 Generates a single manual ADC trigger. More...
 
static uint32_t AUXADCGetFifoStatus (void)
 Returns flags indicating the status of the ADC FIFO. More...
 
uint32_t AUXADCReadFifo (void)
 Waits for and returns the first sample in the ADC FIFO. More...
 
uint32_t AUXADCPopFifo (void)
 Returns the first sample in the ADC FIFO, without waiting. More...
 
static void AUXADCSelectInput (uint32_t input)
 Selects internal or external input for the ADC. More...
 
int32_t AUXADCGetAdjustmentGain (uint32_t refSource)
 Returns the gain value used when adjusting for ADC gain/offset. More...
 
int32_t AUXADCGetAdjustmentOffset (uint32_t refSource)
 Returns the offset value used when adjusting for ADC gain/offset. More...
 
int32_t AUXADCValueToMicrovolts (int32_t fixedRefVoltage, int32_t adcValue)
 Converts an "adjusted" ADC value to microvolts. More...
 
int32_t AUXADCMicrovoltsToValue (int32_t fixedRefVoltage, int32_t microvolts)
 Converts a number of microvolts to corresponding "adjusted" ADC value. More...
 
int32_t AUXADCAdjustValueForGainAndOffset (int32_t adcValue, int32_t gain, int32_t offset)
 Performs ADC value gain and offset adjustment. More...
 
int32_t AUXADCUnadjustValueForGainAndOffset (int32_t adcValue, int32_t gain, int32_t offset)
 Performs the inverse of the ADC value gain and offset adjustment. More...
 

Detailed Description

Function Documentation

int32_t AUXADCAdjustValueForGainAndOffset ( int32_t  adcValue,
int32_t  gain,
int32_t  offset 
)

Performs ADC value gain and offset adjustment.

This function takes a measured ADC value compensates for the internal gain and offset in the ADC.

Parameters
adcValue12-bit ADC unadjusted value
gainGain adjustment value provided by AUXADCGetAdjustmentGain()
offsetOffset adjustment value provided by AUXADCGetAdjustmentOffset()
Returns
12-bit ADC adjusted value

Definition at line 299 of file aux_adc.c.

void AUXADCDisable ( void  )

Disables the ADC.

This function must be called:

Definition at line 87 of file aux_adc.c.

Here is the call graph for this function:

void AUXADCDisableInputScaling ( void  )

Disables scaling of the ADC input.

By default, the ADC operates internally on a version of the input signal that has been scaled down by a factor 1408 / 4095. This function disables that scaling, allowing for a trade-off between dynamic range and and resolution.

Note
This function must only be called while the ADC is disabled, before calling AUXADCEnableSync() or AUXADCEnableAsync().
Different input maximum ratings apply when input scaling is disabled. Violating these may damage the device.

Definition at line 183 of file aux_adc.c.

Here is the call graph for this function:

void AUXADCEnableAsync ( uint32_t  refSource,
uint32_t  trigger 
)

Enables the ADC for asynchronous operation.

In asynchronous operation, the ADC samples continuously between conversions.

The ADC trigger starts the conversion. Note that the first conversion may be invalid if the sampling period is too short.

ADC input scaling is enabled by default after device reset, and is also re- enabled by AUXADCDisable(). To disable input scaling, call AUXADCDisableInputScaling() before calling AUXADCEnableAsync().

Parameters
refSourceADC reference source:
triggerADC conversion trigger:

Definition at line 111 of file aux_adc.c.

Here is the call graph for this function:

void AUXADCEnableSync ( uint32_t  refSource,
uint32_t  sampleTime,
uint32_t  trigger 
)

Enables the ADC for synchronous operation.

In synchronous operation, the ADC is idle between a conversion and subsequent samplings.

The ADC trigger starts sampling with specified duration, followed by the conversion. Note that the first conversion may be invalid if the initial sampling period is too short.

ADC input scaling is enabled by default after device reset, and is also re- enabled by AUXADCDisable(). To disable input scaling, call AUXADCDisableInputScaling() before calling AUXADCEnableSync().

Parameters
refSourceADC reference source:
sampleTimeADC sampling time:
triggerADC conversion trigger:

Definition at line 145 of file aux_adc.c.

Here is the call graph for this function:

void AUXADCFlushFifo ( void  )

Flushes the ADC FIFO.

This empties the FIFO and clears the underflow/overflow flags.

Note: This function must only be called while the ADC is enabled.

Definition at line 194 of file aux_adc.c.

static void AUXADCGenManualTrigger ( void  )
inlinestatic

Generates a single manual ADC trigger.

For synchronous mode, the trigger starts sampling followed by conversion. For asynchronous mode, the trigger starts conversion.

Definition at line 302 of file aux_adc.h.

int32_t AUXADCGetAdjustmentGain ( uint32_t  refSource)

Returns the gain value used when adjusting for ADC gain/offset.

The function returns the gain value to be used with AUXADCAdjustValueForGainAndOffset() or AUXADCUnadjustValueForGainAndOffset(). The gain value is found during chip manufacturing and is stored in the factory configuration, FCFG1.

Parameters
refSourceADC reference source:
Returns
The gain value to be used in adjustments

Definition at line 234 of file aux_adc.c.

int32_t AUXADCGetAdjustmentOffset ( uint32_t  refSource)

Returns the offset value used when adjusting for ADC gain/offset.

The function returns the offset value to be used with AUXADCAdjustValueForGainAndOffset() or AUXADCUnadjustValueForGainAndOffset(). The offset value is found during chip manufacturing and is stored in the factory configuration, FCFG1.

Parameters
refSourceADC reference source:
Returns
The offset value to be used in adjustments

Definition at line 253 of file aux_adc.c.

static uint32_t AUXADCGetFifoStatus ( void  )
inlinestatic

Returns flags indicating the status of the ADC FIFO.

The flags indicate FIFO empty, full and almost full, and whether overflow/underflow has occurred.

Returns
A combination (bitwise OR) of the following flags:

Definition at line 324 of file aux_adc.h.

int32_t AUXADCMicrovoltsToValue ( int32_t  fixedRefVoltage,
int32_t  microvolts 
)

Converts a number of microvolts to corresponding "adjusted" ADC value.

This function can only be used when measuring with fixed ADC reference (AUXADC_REF_FIXED). The specified reference voltage accounts for whether the sampled ADC input is scaled down before conversion or not.

Parameters
fixedRefVoltageFixed reference voltage, in microvolts
microvoltsThe number of microvolts
Returns
The corresponding expected ADC value (adjusted for ADC gain/offset)

Definition at line 285 of file aux_adc.c.

uint32_t AUXADCPopFifo ( void  )

Returns the first sample in the ADC FIFO, without waiting.

This function does not wait, and must only be called when there is at least one sample in the ADC FIFO. Otherwise the call will generate FIFO underflow (AUXADC_FIFO_UNDERFLOW_M).

Returns
The first (12-bit) sample from the ADC FIFO, or an undefined value if the FIFO is empty

Definition at line 221 of file aux_adc.c.

uint32_t AUXADCReadFifo ( void  )

Waits for and returns the first sample in the ADC FIFO.

This function waits until there is at least one sample in the ADC FIFO. It then pops and returns the first sample from the FIFO.

Note
This procedure will deadlock if called without setting up ADC trigger generation in advance. The trigger can either be manual or periodical (using a GPT).
Returns
The first (12-bit) sample from the ADC FIFO

Definition at line 206 of file aux_adc.c.

static void AUXADCSelectInput ( uint32_t  input)
inlinestatic

Selects internal or external input for the ADC.

Note that calling this function also selects the same input for AUX_COMPB.

Parameters
inputInternal/external input selection:

Definition at line 381 of file aux_adc.h.

int32_t AUXADCUnadjustValueForGainAndOffset ( int32_t  adcValue,
int32_t  gain,
int32_t  offset 
)

Performs the inverse of the ADC value gain and offset adjustment.

This function finds the expected measured ADC value, without gain and offset compensation, for a given "ideal" ADC value. The function can for example be used to find ADC value thresholds to be used in Sensor Controller task configurations.

Parameters
adcValue12-bit ADC adjusted value
gainGain adjustment value provided by AUXADCGetAdjustmentGain()
offsetOffset adjustment value provided by AUXADCGetAdjustmentOffset()
Returns
12-bit ADC unadjusted value

Definition at line 320 of file aux_adc.c.

int32_t AUXADCValueToMicrovolts ( int32_t  fixedRefVoltage,
int32_t  adcValue 
)

Converts an "adjusted" ADC value to microvolts.

This function can only be used when measuring with fixed ADC reference (AUXADC_REF_FIXED). The specified reference voltage accounts for whether the sampled ADC input is scaled down before conversion or not.

Parameters
fixedRefVoltageFixed reference voltage, in microvolts
adcValueThe ADC value
Returns
The corresponding number of microvolts

Definition at line 272 of file aux_adc.c.

Macro Definition Documentation

#define AUXADC_FIFO_ALMOST_FULL_M   (AUX_ANAIF_ADCFIFOSTAT_ALMOST_FULL_M)

Definition at line 116 of file aux_adc.h.

#define AUXADC_FIFO_EMPTY_M   (AUX_ANAIF_ADCFIFOSTAT_EMPTY_M)

Definition at line 115 of file aux_adc.h.

#define AUXADC_FIFO_FULL_M   (AUX_ANAIF_ADCFIFOSTAT_FULL_M)

Definition at line 117 of file aux_adc.h.

#define AUXADC_FIFO_OVERFLOW_M   (AUX_ANAIF_ADCFIFOSTAT_OVERFLOW_M)

Definition at line 119 of file aux_adc.h.

#define AUXADC_FIFO_UNDERFLOW_M   (AUX_ANAIF_ADCFIFOSTAT_UNDERFLOW_M)

Definition at line 118 of file aux_adc.h.

#define AUXADC_FIXED_REF_VOLTAGE_NORMAL   4300000

Definition at line 160 of file aux_adc.h.

#define AUXADC_FIXED_REF_VOLTAGE_UNSCALED   1478500

Definition at line 161 of file aux_adc.h.

#define AUXADC_REF_FIXED   (0 << ADI_4_AUX_ADCREF0_SRC_S)

Definition at line 107 of file aux_adc.h.

Referenced by AUXADCGetAdjustmentGain(), and AUXADCGetAdjustmentOffset().

#define AUXADC_REF_VDDS_REL   (1 << ADI_4_AUX_ADCREF0_SRC_S)

Definition at line 108 of file aux_adc.h.

#define AUXADC_SAMPLE_TIME_10P6_US   5

Definition at line 143 of file aux_adc.h.

#define AUXADC_SAMPLE_TIME_10P9_MS   15

Definition at line 153 of file aux_adc.h.

#define AUXADC_SAMPLE_TIME_170_US   9

Definition at line 147 of file aux_adc.h.

#define AUXADC_SAMPLE_TIME_1P37_MS   12

Definition at line 150 of file aux_adc.h.

#define AUXADC_SAMPLE_TIME_21P3_US   6

Definition at line 144 of file aux_adc.h.

Referenced by AUXADCEnableSync().

#define AUXADC_SAMPLE_TIME_2P73_MS   13

Definition at line 151 of file aux_adc.h.

#define AUXADC_SAMPLE_TIME_2P7_US   3

Definition at line 141 of file aux_adc.h.

#define AUXADC_SAMPLE_TIME_341_US   10

Definition at line 148 of file aux_adc.h.

#define AUXADC_SAMPLE_TIME_42P6_US   7

Definition at line 145 of file aux_adc.h.

#define AUXADC_SAMPLE_TIME_5P3_US   4

Definition at line 142 of file aux_adc.h.

#define AUXADC_SAMPLE_TIME_5P46_MS   14

Definition at line 152 of file aux_adc.h.

#define AUXADC_SAMPLE_TIME_682_US   11

Definition at line 149 of file aux_adc.h.

#define AUXADC_SAMPLE_TIME_85P3_US   8

Definition at line 146 of file aux_adc.h.

#define AUXADC_TRIGGER_GPT0A   (EVENT_AUXSEL0_EV_GPT0A)

Definition at line 127 of file aux_adc.h.

#define AUXADC_TRIGGER_GPT0B   (EVENT_AUXSEL0_EV_GPT0B)

Definition at line 128 of file aux_adc.h.

#define AUXADC_TRIGGER_GPT1A   (EVENT_AUXSEL0_EV_GPT1A)

Definition at line 129 of file aux_adc.h.

#define AUXADC_TRIGGER_GPT1B   (EVENT_AUXSEL0_EV_GPT1B)

Definition at line 130 of file aux_adc.h.

#define AUXADC_TRIGGER_GPT2A   (EVENT_AUXSEL0_EV_GPT2A)

Definition at line 131 of file aux_adc.h.

#define AUXADC_TRIGGER_GPT2B   (EVENT_AUXSEL0_EV_GPT2B)

Definition at line 132 of file aux_adc.h.

#define AUXADC_TRIGGER_GPT3A   (EVENT_AUXSEL0_EV_GPT3A)

Definition at line 133 of file aux_adc.h.

#define AUXADC_TRIGGER_GPT3B   (EVENT_AUXSEL0_EV_GPT3B)

Definition at line 134 of file aux_adc.h.

#define AUXADC_TRIGGER_MANUAL   (EVENT_AUXSEL0_EV_NONE)

Definition at line 126 of file aux_adc.h.

Referenced by AUXADCEnableAsync(), and AUXADCEnableSync().