Jump to main content

##

# 3.7.22 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

Name | Description
--- | ---
SDADC_Initialize | Initializes given instance of SDADC peripheral
SDADC_Enable | Enables the SDADC module
SDADC_Disable | Disables the SDADC module
SDADC_ConversionStart | Starts the SDADC conversion with the software trigger
SDADC_ConversionResultIsReady | Returns the status of the conversion
SDADC_ConversionResultGet | Returns the conversion result
SDADC_ConversionSequenceIsFinished | Returns the status of automatic sequence conversion
SDADC_WindowMonitorIsSet | Returns the status of the window monitor
SDADC_ComparisonWindowSet | Returns the status of automatic sequence conversion
SDADC_CallbackRegister | Registers the function to be called from interrupt

Data types and constants

Name | Type | Description
--- | --- | ---
SDADC_CALLBACK_OBJECT | Struct | Callback structure
SDADC_STATUS | Enum | Identifies interrupt status flags
SDADC_CALLBACK | Typedef | Defines the function pointer data type and function signature for the SDADC peripheral callback function