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.

VDDS voltage reading in cc26xx



Hello,

I wants to measure VDDS voltage in cc26xx. Which API call get the voltage source?

Regards,

Rajneesh

  • Hi Rajneesh,

    You can find the API in cc26xxware\driverlib\aon_batmon.h

    // Enable battery monitoring
    AONBatMonEnable();

    //Get the VDDS votlage
    AONBatMonBatteryVoltageGet()
  • Hi Christin,

    Thanks for reply,

    I have measured battery voltage as per your suggestion, but its return value 735. How can I calculate 735 in voltage rating?

    Regards,
    Rajneesh

  • Hi Rajneesh.
    The format of value read out is described on page 1335 in the "CC13xx,CC26xx SimpleLink™ Wireless MCU Technical Reference Manual"
    See the BAT register. As explained bit 10:8 are the integer part, and bit 7:0 are the fractional part (as binary fractional value) .

    If the value read is 735 decimal, then this is 0x02DF (hex) which gives 2.871.. volts.

    Rgds,
    Arvin
  • Hi Christin,

    I am trying same function, but I am not receiving any voltage of VDD.
  • I am trying same function, but I am not receiving any voltage of VDD.
    We also have a requirement to read voltage levels from 0 t0 3.3 V.
    Can you suggest anything over this as well?
  • Hi Jayesh,

    Please read Christin answer carefully this will be your answer of question.

    // Include header file in your project.
    #include <driverlib/aon_batmon.h>

    // enable battery monitor enable
    AONBatMonEnable();

    //Get battery voltage (this will return battery voltage in decimal form you need to convert)
    BATstatus = AONBatMonBatteryVoltageGet();

    // convert in Milli volts
    BATstatus = (BATstatus * 125) >> 5;

    //convert in floating point value
    BATvoltage = (float)BATstatus / 1000;

    This will be your Answer.

    Best wishes,
    Rajneesh
  • Can you explain please how this line:

    // convert in Milli volts
    BATstatus = (BATstatus * 125) >> 5;

    Results in a conversion to millivolts?

  • You can read the comment from sensortag project function  static uint8_t battMeasure(void) in  battservice.c

      // Read the battery voltage (V), only the first 12 bits
      percent = AONBatMonBatteryVoltageGet();
    
      // Convert to from V to mV to avoid fractions.
      // Fractional part is in the lower 8 bits thus converting is done as follows:
      // (1/256)/(1/1000) = 1000/256 = 125/32
      // This is done most effectively by multiplying by 125 and then shifting
      // 5 bits to the right.
      percent = (percent * 125) >> 5;
      // Convert to percentage of maximum voltage.
      percent = ((percent* 100) / battMaxLevel);

  • This makes sense. Thanks for the response. Couldn't quite work out the math in my head :)
  • Also, if anyone is still watching this thread:

    If your battery monitor is already running you can simplify your code a bit by reading the registers directly:

    // Convert to from V to mV to avoid fractions.
    // Fractional part is in the lower 8 bits thus converting is done as follows:
    // (1/256)/(1/1000) = 1000/256 = 125/32
    // This is done most effectively by multiplying by 125 and then shifting 5 bits to the right.
    float MeasuredVoltage = (float)(((uint32_t)HWREG(AON_BATMON_BASE + AON_BATMON_O_BAT)*125) >> 5)/1000; // Convert to milivolts, then convert to float