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.

CC2640R2F: ADC accuracy problem

Part Number: CC2640R2F


Hi,

My customer is using ADC of CC2640R2.
They are trying to measure the voltage with the ADC.
However, the actual calculated value and the calculation result of the ADC do not match.

input voltage: 3.09 V,   VDDS: 3.31 V,
1. AD conversion value acquired from the ADC driver: 3713
2. Calculated value = input voltage / (VDDS / AD conversion maximum value (4096)) 
                                    = 3.09 [V] / (3.31 [V] / 4096) = 3823

Difference between 1 and 2 : 110


The ADC settings are as follows.
 - adcDIO : Board_DIO7_ANALOG
 - adcCompBInput : ADC_COMPB_IN_AUXIO7
 - inputScalingEnabled : true
 - refSource : ADCCC26XX_VDDS_REFERENCE
 - samplingDuration : ADCCC26XX_SAMPLING_DURATION_2P7_US
 - triggerSource : ADCCC26XX_TRIGGER_MANUAL

Since my customer uses the function of "adcReadFifo()",
I advised the use of the function of AUXADCAdjustValueForGainAndOffset (),
but received the following question.
Could you give me advice?

1. In order to acquire the correct AD conversion value,
     is it necessary to correct the value read from the AD conversion register (AUX_ANAIF: ADCFIFO) by using the manufacturing offset and gain error?

2. Does the Technical Reference Manual or other documents indicate that it is necessary to correct offset and gain error at the time of manufacture?
    If there is a description, please tell me where it is.

3. The offset value and the gain error register value (FCFG1:SOC_ADC_ABS_GAIN, FCFG1:SOC_ADC_REL_GAIN, FCFG1:SOC_ADC_OFFSET_INT)
     are set at the time of manufacture and are not changed afterwards, are they correct?
    If the value is changed by some kind of hardware processing, please tell me the conditions to be changed.

4. Please tell me the reason for adding 16384 and the reason for dividing it by 32768
     for the calculation formula of AUXADCAdjustValueForGainAndOffset () function.
     AdcValue = (((adcValue + offset) * gain) + 16384) / 32768

5. Please tell me the AD conversion error including the error of offset and gain error.

I would be pleased if you could answer each of the above five questions.

Best Regards,
Miyashiro

  • Hello Masato,

    1) Yes.

    2) There is a short statement in the TRM section 17.4.8 ADC - 17.4.8.1 Introduction:

    "The ADC is production-trimmed and it is possible to compensate for ADC gain and offset errors in software by reading the factory configuration page (see Section 9.2)."

    3) Correct. They are not changed as FCFG remain unchanged after production.

    4) The gain part is shifted up by 15 bits before being stored in FCFG. The calculation is used with integers and are not floating point. To get better precision the 32 bits signed integer is used for the calculation where the fractional part are in bit position <14:0>. By adding 16384 the fractional part will be rounded up if they are more than half of 2^14 before the result is divided (right shift by 15) to end up in the 12 bit range.

    5) The accuracy is stated in the data sheet as well as typical offset and gain errors. Every chip is calibrated during production and have different offset/gain errors which are then stored in FCFG.

  • Hi Eirik,

    I appreciate your quick response, you've been so helpful.
    Thank you very much for your understandable explanations.
    I will reply to my customer.
    If there is anything I do not understand something please let me ask a question.

    Best Regards,
    Miyashiro