How to setup nPM2100 Task_ADC to get Average readings without resend Task_ADC

Hi all,

I already successfully read the instant mode VBAT from my PMIC, nPM2100, but I would like to have more precise VBat readings.

1. I used this set up for my avg16

// 1) Set VBAT measurement AVG16
    npm2100_write(NPM2100_REG_CONFIG, NPM2100_ADC_AVG16);
// 2) Start conversion
    npm2100_write(NPM2100_REG_TASKS_ADC, 0x01);

And every 20 seconds I read the result from 0x9B

// Read VBAT result (8-bit), vbat = adc.readvbat * 3.2/255, 
// i.e adc.readvbat = 114 => vbat = 114 * 3.2/255 = 1.43
    npm2100_read(NPM2100_REG_READAVGVBAT, &result);

But I only got the battery result reading for 1 time.  After that the result always zero (0).

However, if I kept sending the same set up, then my reading will return the battery's values.

Is there a way for me to do the set up only once and continue to reads all the needed parameters like VBAT, VOUT, TEMP, DROOP etc..

2. The information in the data sheet provide for the VBAT calculation using 3.2V, is this because the VBATrange is from 0 to 3.2V?  But the input allow 0.7V up to 3.4V? 

3. From #2 Is there any document or procedure for me to perform the offset calculation to address for the real battery's monitor?

  • Hi,

    The behavior you see is expected and matches how the nPM2100 ADC is designed.

    1. On nPM2100, all ADC measurements are task-triggered. So when AVG16 is selected in ADC.CONFIG, the ADC performs one conversion sequence only when ADC.TASKS_ADC is written. For AVG16, this means 16 samples are taken, averaged once, and the result is written to ADC.AVERAGE (0x9B). After that, the ADC stops and the result is not refreshed. Therefore, to get a new VBAT/VOUT/TEMP/DROOP reading, ADC.TASKS_ADC must be triggered again each time. For Example:

    // one-time init
    npm2100_write(NPM2100_REG_CONFIG, NPM2100_ADC_AVG16);
    
    while (1) {
        npm2100_write(NPM2100_REG_TASKS_ADC, 0x01);  // trigger a new AVG16 conversion
    
        // wait for conversion complete (either fixed delay from datasheet, or poll STATUS if available)
    
        npm2100_read(0x9B /* AVERAGE */, &result);   // read averaged result
        sleep(20);
    }
    

    You can configure AVG16 once, but the conversion task must be retriggered for every new measurement.

    2 The 3.2 V value in the VBAT conversion formula is the ADC full-scale reference used for voltage conversion. It does not define the electrical input range of the VBAT pin. The VBAT pin is specified to operate from 0.7 V up to 3.4 V, while the ADC conversion is scaled such that an ADC code of 255 corresponds to 3.2 V. Above this level, the PMIC continues to operate normally, but the ADC reading may saturate or lose accuracy.

    3. There is no documented user-programmable ADC gain or offset calibration procedure for VBAT on nPM2100 beyond the factory calibration. If additional accuracy is required, any correction can be applied in the host firmware (for example, using a measured offset or gain factor).

    Best Regards,
    Syed Maysum

  • Thank you  

    Regard #3 the OFFSETFACTORY upon reset from datasheet it always is zero meaning there is no offset at all.  I used my 1.5V power supply for my VBAT and I got 1.40V 1.42V from ADC count using the provided formula (ADC_COUNT * 3.2V / 255).  Is there anyway I can get my ADC counts closer to the actual VBAT 1.5V?

  • Hi,

    Thanks for the details. An ADC result of around 1.40 to 1.42 V when applying 1.5 V is outside the typical +-2 % accuracy range, so it makes sense to look at calibration. In addition to the default factory offset, the nPM2100 supports on demand ADC offset recalibration, as described in the System Monitor chapter of the datasheet. The procedure is:

    1. Select Offset measurement mode in ADC.CONFIG
    2. Trigger a conversion using ADC.TASKS_ADC
    3. The measured offset is stored in ADC.OFFSETMEASURED
    4. Configure ADC.OFFSETCFG to enable offset correction and select OFFSETMEASURED instead of the factory offset

    Using the measured offset can improve VBAT accuracy. Please note that this calibration is not retained across reset, so it needs to be repeated after each reset or power-up. The sequence is lightweight (one ADC conversion and a few register writes) and hopefully may able to improve accuracy.

    Best Regards,
    Syed Maysum

Related