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.

CC2530 ADC Issue

Other Parts Discussed in Thread: CC2530

Hi,

    I'm now using the internal cc2530 VDD/3 to measure the voltage with internal ref 1.15v.

    I found that different board test the same voltage ,but the adc value is different.

    For example,the voltage need to be test is 2.84V

    Board 1:the adc value is 1685

    Board 2:he adc value is 1702

    Board 3:he adc value is 1751

   Board 4:he adc value is 1763

   I don't know why the adc value ddifference is so big and I can't find any  information about this issue.

void ReadBattery(void)
{
uint32 value;
ADCIF = 0;
ADCCON3 = (HAL_ADC_REF_125V | HAL_ADC_DEC_512 |HAL_ADC_CHN_VDD3);

while ( !ADCIF );

value = ADCH;
value = (value<< 8)|ADCL;
value = (value>>4);

value = (value * 115*3)/2048

DsInd.alarm[2] = (uint16)value>>8;
DsInd.alarm[3] = (uint16)value;
SampleApp_SendInMessage(); 
}
}

  • Hi,

    The answer is easy and not so easy at the same time.
    If we use 3.3V as being the maximum voltage that your ADC can measure, than, 2.84/3.3 * 2048 = ~1762.
    That means that Board4 would be the closest.
    The furthest one is Board 1 with 1685 which is approximately 4% away from the actual value. This is not so bad but it depends on some conditions.

    There are a few things that you need to look at:
    All ADCs will have a slightly different offset and gain. You will most likely need to calibrate each ADC by obtaining the gain and offset of each board.
    What will be more important is whether your ADC readings are linear: if you apply 1.42V to your ADC, will you read 1/2 of your previous reading?
    I would take several measurements and plot them on a graph and see if they are linear. If they are linear, you can easily obtain an equation that will give you the correct voltage.
    Another important factor is whether your measurement are repeatable. If you always measure the same voltage but your ADC value changes all the time, there might be some other problem. An offset and gain are easily compensated; fluctuating measurements are more problematic.

    Sampling time: Each ADC usually has a capacitor that needs to be charged to properly take a measurement. If your sampling time is too short, this might not allow the capacitor to properly charge itself before the reading. Sampling time that is very long on a signal that varies quickly is also problematic. So you have to find what is best.

    Noise of the signal.
    If the signal that you are reading has a lot of noise, it will be harder to take accurate measurements.

    The article below gives some very good explanations about everything I talked about and more.



    3 quick things to do
    1. Check that your signal is clean
    2. Check that you get the same measurement for the same voltage.
    3. Take several measurements to see if your ADC is linear (to find your gain and offset)

    If you want more info on how to fix these kinds of problems: TI has a great page with many links:



    Hope this helps.
    Michel

  • I had seen similar results when using CC2530 ADC and you can do calibration to every CC2530 to make them consistent.
  • Could you give me some information about the Max difference value of cc2530 offset and gain between different chips,Maybe greater than 4%?
  • Could you give me more information about the MAX different value of the offset between different chips?Maybe larger than 4%?
  • I had seen 6%.
  • I am not sure I understand your question.

    Are you asking what are max differences that we have seen using the cc2530 (There is already an answer for that) from Yikai?

    Or are you asking how to find the gain and offset of an ADC?

    I see that the link that I posted above for the article was broken. Here it is again:
    http://www.ti.com/lit/SBAA004