Reference DAC

Description

Low-power clocked reference DAC for COMPA and COMPB

The Reference DAC can be used for following, one at a time:

  • Provide reference voltage for COMPB
    • Supported in active, low-power and standby power modes
  • Provide reference voltage for COMPA
    • Supported in active, low-power and standby power modes
  • Precharge an external node that the COMPA input is connected to
    • Any resistive load on this external node will affect the voltage generated by the Reference DAC
    • Only supported in active and low-power power modes

The procedures that set the Reference DAC output value do not compensate for offset and gain errors and non-linearities in the DAC. The maximum output voltage is approximately 95 percent of the DAC reference voltage selected by refdacEnable() .

The DAC runs off the same clock as the Sensor Controller, and hence there are some restrictions:

  • When used as COMPA or COMPB reference in standby mode, the Sensor Controller must always run at 2 MHz before entering standby mode
  • When used to precharge the COMPA input, the Reference DAC output must be inactive while switching between low-power mode at 2 MHz and active mode at 24 MHz

The reference DAC requires extra system resources when operating in the low-power and standby power modes. Select the power mode support needed in refdacEnable() .

Examples

COMPA Reference

// Enable the DAC and start generating the COMPA reference voltage
refdacEnable(REFDAC_PWRMODE_ANY, REFDAC_REF_VDDS);
refdacStartOutputOnCompaRef(cfg.refdacValue0);
refdacWaitForStableOutput();

...

// Stop generating the COMPA reference voltage and disable the DAC
refdacStopOutput();
refdacDisable();

Ultra-Low Power SAR ADC Using COMPA and Reference DAC

// Select COMPA input
compaSelectGpioInput(AUXIO_A_SENSOR_OUTPUT);

// Enable Reference DAC and COMPA, and wait for it to stabilize
refdacEnable(REFDAC_PWRMODE_ANY, REFDAC_REF_VDDS);
refdacStartOutputOnCompaRef(0x80);
compaEnable(COMPA_PWRMODE_ANY);
refdacWaitForStableOutput();

// For each bit, starting with MSB, and going down to the configured resolution
U16 bitsLeft = cfg.resolution;
U16 bvCurrDacBit = 0x80;
U16 dacValue = 0x00;
while (bitsLeft > 0) {

    // Check the COMPA output and update the DAC value
    U16 compaValue;
    compaGetOutput(compaValue);
    if (compaValue != 0) {
        dacValue |= bvCurrDacBit;
    }

    // Get ready for the next bit
    bvCurrDacBit >>= 1;
    bitsLeft -= 1;
    if (bitsLeft > 0) {
        refdacChangeOutputValue(dacValue | bvCurrDacBit);
        refdacWaitForStableOutput();
    }
}

// Disable COMPA and Reference DAC
compaDisable();
refdacStopOutput();
refdacDisable();

// Store the ADC value
output.adcValue = dacValue;

Procedures Overview

Name Brief description
refdacChangeOutputValue() Changes the reference DAC output value while the DAC is active. More …
refdacDisable() Disconnects and disables the Reference DAC. More …
refdacEnable() Enables the Reference DAC. More …
refdacStartOutputOnCompaIn() Starts Reference DAC output on the COMPA input node. More …
refdacStartOutputOnCompaRef() Starts Reference DAC output on the COMPA reference node. More …
refdacStartOutputOnCompbRef() Starts Reference DAC output on the COMPB reference node. More …
refdacStopOutput() Stops the Reference DAC output. More …
refdacWaitForStableOutput() Waits for the Reference DAC output to be stable. More …

Constants

Name Description
REFDAC_PWRMODE_ACTIVE Power mode support: Reference DAC can be used in active power mode only
REFDAC_PWRMODE_ANY Power mode support: Reference DAC can be used in any power mode
REFDAC_REF_ADCREF DAC reference: ADC reference (nominally 1.44 V)
REFDAC_REF_DCOUPL_VOUT_HIGH DAC reference: DCOUPL (nominally 1.27 V), output +1.28 V (only for VDDS > 2.6 V)
REFDAC_REF_DCOUPL_VOUT_LOW DAC reference: DCOUPL (nominally 1.27 V), output +0.00 V
REFDAC_REF_VDDS DAC reference: VDDS

Global Variables

None.

Procedures

refdacChangeOutputValue

Prototype: refdacChangeOutputValue(value)

Changes the reference DAC output value while the DAC is active.

Parameter value(s)

  • value : 8-bit DAC output value (0-255)

refdacDisable

Prototype: refdacDisable()

Disconnects and disables the Reference DAC.

refdacEnable

Prototype: refdacEnable(#pwrModeSupport, #intRef)

Enables the Reference DAC.

This procedure must only be called when the Reference DAC is disabled. To change Reference DAC configuration, call refdacDisable() before re-enabling the Reference DAC.

Parameter value(s)

  • #pwrModeSupport : Support use of DAC in any power mode (REFDAC_PWRMODE_ANY) or active power mode only (REFDAC_PWRMODE_ACTIVE)
  • #intRef : Internal reference selection for the Reference DAC (REFDAC_REF_XYZ)

refdacStartOutputOnCompaIn

Prototype: refdacStartOutputOnCompaIn(value)

Starts Reference DAC output on the COMPA input node. This should only be used to precharge the input node.

This procedure must only be called while the Reference DAC is inactive and ISRC is disabled.

Parameter value(s)

  • value : 8-bit DAC output value (0-255)

refdacStartOutputOnCompaRef

Prototype: refdacStartOutputOnCompaRef(value)

Starts Reference DAC output on the COMPA reference node.

This procedure must only be called while the Reference DAC is inactive.

Parameter value(s)

  • value : 8-bit DAC output value (0-255)

refdacStartOutputOnCompbRef

Prototype: refdacStartOutputOnCompbRef(value)

Starts Reference DAC output on the COMPB reference node.

This procedure must only be called while the Reference DAC is inactive.

Parameter value(s)

  • value : 8-bit DAC output value (0-255)

refdacStopOutput

Prototype: refdacStopOutput()

Stops the Reference DAC output.

This procedure must only be called when the Reference DAC is active.

refdacWaitForStableOutput

Prototype: refdacWaitForStableOutput()

Waits for the Reference DAC output to be stable.

An additional delay is required:

  • At temperatures above 85 degrees C (see datasheet for more information)
  • When using the Reference DAC to pre-charge an external node