Hello,
I wants to measure VDDS voltage in cc26xx. Which API call get the voltage source?
Regards,
Rajneesh
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.
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);
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