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.

CC2541 adc gives false readings with POWER_SAVING

Other Parts Discussed in Thread: CC2541, CC2538

Hello

I am currently trying to get the battery monitor working with CC2541 (sensor tag). The problem is that when POWER_SAVING is defined, the adc returns usually a static reading regardless of the VDD. However when the define is removed it works just fine. I pasted the code i used to read the values from adc below.

I have not found anything in the manuals or guides that says the ad converter cannot work if the power savings macro is used. However i presume that the problem lies with the clock management during the conversion. Any help is appreciated.

void HalMyAdcRead(void)
{  
    uint32 calib = *(uint8 *)0x7826<<7; // value from info page
    calib <<= 1;
    calib |= *(uint8 *)0x7827;
    calib *= 100;  //for accuracy, to be divided out later
    
    //read adc value
    ADCCON2 = 0x3F;   //12 bits resolution, internal ref, channel = vdd/3                
    ADCCON1 = 0x73;   //start conversion
    while(!(ADCCON1 & 0x80));  //wait for conversion
    v = ADCL;  //read adc value                       
    v |= (((uint16) ADCH) << 8); 
    

    v = 30000* v / calib;  // 3 (ideal voltage) * 1000 (for accuracy) * v (adc reading) / calib
    battery = (uint16) v;  

}

  • Hi Petterri,
    Perhaps this link will help you, if you have not yet already tried it: www.ti.com/.../toolssoftware (Look at "Software (5)" ). In the downloads there, TI might have a document that deals just with power management. (I say "might have" because I use the CC2538, and TI's downloads may be of a similar kind for the CC2541. ) For the CC2538 there was a good document for power management. I know that with these devices, there are different power saving modes, one of which may not allow use of the ADC. See if you can find such a document for your device. Hope that this helps.
  • Hi Petteri,

    This is probably because you enable the DCDC converter when you define POWER_SAVING. Thus the voltage supply to the CC2541 is always 2.1 V which is what you'll measure with the ADC.

    To read the actual battery voltage you must first turn the DCDC into bypass mode.

    Search the forum, there is an other thread here discussing the same topic.

    Cheers,
    Fredrik
  • Hi Frederik,

    I have disabled the dc/dc converter and measured the voltage on pin AVDD5 that it is changing. I have used a lab power supply to power the device for the purposes of testing the ad converter.

    EDIT:

    I did add a row of code to the adc read function do disable pin 0_7. This did the trick as you suggested. I did not notice that there were other places in the codebase that enabled the dc/dc converter. I did use a fluke multimeter to measure the pin originally, but it seems that it did not pick up the rapid pulsing of the voltage.

  • Hi Petteri,

    Seems like the problem is solved. Remember to enable the DCDC converter when you have completed the measurement.

    The DCDC will be enabled when the chip is active and in bypass when the chip is in LPM2. You will need an oscilloscope to see the switching on P0_7.

    Cheers