This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640 ADC Accuracy issue

Hi,

I am trying to read an analog input from a temperature sensor using the sensor controller. I modifiied the adc_data_logger example to function as below:

- change the ADC sensor output to the I/O that is connected to the temperature sensor.

- Disable scaling. (using 1.44V reference voltage)

- removed the ring buffer, directly read adc fifo to output.adcValue.

- Enable system CPU alert once ADC conversion is done.

My execution code as below:

/*******************************************************************/

// Disable input scaling

adcDisableInputScaling();

// Enable the ADC

adcEnableSync(ADC_REF_FIXED, ADC_SAMPLE_TIME_2P7_US, ADC_TRIGGER_MANUAL);

// Sample the sensor

adcGenManualTrigger();

adcReadFifo(output.adcValue);

// Disable the ADC

adcDisable();

// Notify the driver

fwGenAlertInterrupt();

// Schedule the next execution

fwScheduleTask(1);

/******************************************************************/

The temperature voltage is suppose to be 0.972V as measured from the meter but the ADC conversion result is about 0.93V ~ 0.94V. This result shows that there is an error rate of 3~4%.

Is there anything I miss out or wrongly implemented?

I read the ADC help from Sensor Controller Studio and there is a statement mentioned below:

The ADC values returned by adcReadFifo() are not compensated for offset and gain errors in the ADC. This compensation, using factory configuration data stored during chip production, can be done by using the AUX_ADC DriverLib module on the System CPU to:

  • Adjust ADC values sampled by the Sensor Controller (through the output data structure)
  • Unadjust ADC threshold values to be used in Sensor Controller task code (through the cfg data structure)

1) May I know how this can be done? I am using ble_cc26xx_2_00_00_42893.

2) Any other advises is also appreciated.

  • Hi,

    I realized that when I supply 1.44V into the analog input I actually get a lesser ADC value instead of 4095. For me to get 4095 my analog input voltage need tot be around 1.495V.

    1) Is this 1.495V the actual reference voltage after scaling is disabled?
    2) Are there any factory offset value that can compensate to the measured ADC value?
  • Hello Alan,
    1) Be very careful when disabling scaling as you might quite easily cause damage to the internal circuitry when you input voltages higher than the the maximum rating, which is 1.49V. In your case you already breached this limit. We usually recommend not to disable input scaling.

    2) If you look at the latest driverlib in the (www.ti.com/.../CC26XXWARE). You can find the needed functions used in the code snippet below from the driverlib files aux_adc.h and aux_adc.c. I think the next BLE stack release (2.1) will use this version of driverlib or a later one.

    int32_t adcOffset = AUXADCGetAdjustmentOffset(AUXADC_REF_VDDA_REL);
    int32_t adcGainError = AUXADCGetAdjustmentGain(AUXADC_REF_VDDA_REL);
    int32_t adcCorrectedValue;
    adcCorrectedValue = AUXADCAdjustValueForGainAndOffset((int32_t) scifTaskData.adcDataLogger.output.pSamples[tail], adcGainError, adcOffset);

    In your case as you disable the scaling you can use the following function to convert to microvolts:
    adcMicroVoltValue = AUXADCValueToMicrovolts(AUXADC_FIXED_REF_VOLTAGE_UNSCALED, adcCorrectedValue );