2.98 Sigma-Delta Analog Digital Converter (SDADC)

The Sigma-Delta Analog-to-Digital Converter (SDADC) converts analog signals to digital values. This peripheral provides below features:

  • 16bit resolution

  • Up to 1,500,000 divided by Over Sampling Ratio (OSR) samples per second

  • Three analog differential inputs

  • Conversion Range:

    • Differential mode: VREF to +VREF

    • Single ended mode: 0V to +VREF

  • Signed results

  • Event triggered conversion (one event input)

  • Optional DMA transfer of conversion settings or result

  • Single, continuous and sequencing options

  • Hardware gain, offset and shift compensation

  • Windowing monitor

Using The Library

SDADC converts enabled channel on software or hardware triggers. It provides both polling and callback methods to indicate the end of conversion to read the converted data from the result register.

  • With polling, the application will need to continuously poll to check if the conversion is completed.

  • With callback, the registered callback function will be called once the conversion is completed. This means the application do not have to poll continuously.

Callback method

This example demonstrates how to read conversion result in the callback function. One channel is enabled and configured to start conversion on hardware trigger.

int16_t result;

/* This function is called after conversion of last channel in
the user sequence */

void SDADC_EventHandler(SDADC_STATUS status, uintptr_t context)

{

 result = SDADC_ConversionResultGet();

}



int main(void)

{

 /* Register callback function for SDADC end of conversion
interrupt*/

 SDADC_CallbackRegister(SDADC_EventHandler, (uintptr_t)NULL);



while(true)

{



}

}

Polling method

This example demonstrates how to start conversion and read the converted data in polled mode. One channel is enabled and configured to start conversion on software trigger.

/* Start conversion */

SDADC_ConversionStart();



/* Wait till ADC conversion result is available */

while(!SDADC_ConversionResultIsReady(CH0))

{



};



/* Read the ADC result */

result = SDADC_ConversionResultGet();

Library Interface

Sigma-Delta Analog Digital Converter peripheral library provides the following interfaces:

Functions

NameDescription
SDADC_InitializeInitializes given instance of SDADC peripheral
SDADC_EnableEnables the SDADC module
SDADC_DisableDisables the SDADC module
SDADC_ConversionStartStarts the SDADC conversion with the software trigger
SDADC_ConversionResultIsReadyReturns the status of the conversion
SDADC_ConversionResultGetReturns the conversion result
SDADC_ConversionSequenceIsFinishedReturns the status of automatic sequence conversion
SDADC_WindowMonitorIsSetReturns the status of the window monitor
SDADC_ComparisonWindowSetReturns the status of automatic sequence conversion
SDADC_CallbackRegisterRegisters the function to be called from interrupt

Data types and constants

NameTypeDescription
SDADC_CALLBACK_OBJECTStructCallback structure
SDADC_STATUSEnumIdentifies interrupt status flags
SDADC_CALLBACKTypedefDefines the function pointer data type and function signature for the SDADC peripheral callback function
Note: Not all APIs maybe implemented. See the specific device family section for available APIs.