Clarification on nPM1300 Current Measurements

Hello,

I have a few questions regarding the nPM1300 current measurements:

  1. As far as I understand, there are two ways to trigger a current measurement:

    • By writing to the TASKIBATMEASURE register (mentioned only in the register documentation).
    • By enabling auto measurement through ADCIBATMEASEN and triggering a VBAT measurement using TASKVBATMEASURE.

    Could you confirm if this understanding is correct?

  2. Once a measurement is completed, I believe the current measurement results can be found in:

    • ADCVBAT2RESULTMSB
    • The VBAT2RESULTLSB field of the ADCGP1RESULTLSBS register.

    Is this correct?

  3. Regarding the conversion of measurements into a current value, the formula for this is not documented.
    Would the following formula be accurate?

    IBAT=(IBAT_ADC / 1023) × IFS_IBAT

    where:

    • IBAT_ADC is the ADC value derived from the above registers.
    • IFS_IBAT is the full-scale current for IBAT measurement.

    If this formula is incorrect, could you provide the correct one?

  4. I found documentation about the full-scale current (IFS_IBAT) in section 7.1.8 of the PS v1.1.
    Specifically, it seems dependent on the current flow direction returned in the bits `BCHARGERMODE` of register `ADCIBATMEASSTATUS`:

    • For a value of 01 (battery discharging), the full-scale current is calculated as: IFS_IBAT=(Weighted sum of registers BCHGISETDISCHARGEMSB and BCHGISETDISCHARGELSB) × 0.836
    • For a value of 11 (battery charging), the full-scale current is: IFS_IBAT=(Weighted sum of registers BCHGISETMSB and BCHGISETLSB) × 1.25

    I have a few questions here:

    • Are 01 and 11 binary values, and are these the only two possible values for BCHARGERMODE? I am currently reading 00.
    • When referring to the "weighted sum" of the respective charge and discharge current settings registers, does this include only the 10-bit value, or is there additional processing involved?

The voltage measurements are well-documented, but I found the current measurement documentation lacking.

Thank you for your assistance!

Parents
  • Hi Badr

    I'm looking into the issue and will need to ask internally so I will get back to you over the weekend

    Regards

    Runar

  • Point 1 is correct

    You are correct in that the current documentation do not allow you to decode the current measurement. Point 2 is correct

    Point 3 is correct. 

    Regarding the full scale battery discharge current limit and current measurement full-scales are related but not the same. We have not provided this information the product specification. It might be possible to read out from the driver implementation but i'm not sure. 

    For point 4. 

    Can you provide all the 8 bit register that you read? We need to verify the result. If you read 00 it means that the charger is either in reset or in softstart. 

    Regards

    Runar

  • Hey, I'm in a similar situation. With a npm1300 I'm able to charge (for instance, the LED showing charging status is on, BCHGCHARGESTATUS is reporting the different steps..... ) but the battery current reporting is not working properly: IBAT always 0, and  ADCIBATMEASSTATUS is 00 (it should be 01 or 11).

    Could you elaborate a little bit more about "f you read 00 it means that the charger is either in reset or in softstart"

    Thanks!

Reply
  • Hey, I'm in a similar situation. With a npm1300 I'm able to charge (for instance, the LED showing charging status is on, BCHGCHARGESTATUS is reporting the different steps..... ) but the battery current reporting is not working properly: IBAT always 0, and  ADCIBATMEASSTATUS is 00 (it should be 01 or 11).

    Could you elaborate a little bit more about "f you read 00 it means that the charger is either in reset or in softstart"

    Thanks!

Children
  • I am using the code below to measure the voltage and current. Note the two second delay. It could be reduced to one second. The calls to movingAverage and get_battery_percent are not pertinent.

    int npm1300_vbat_measure()

    {

      uint8_t temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8, temp9;

      uint16_t temp16, temp17;

      uint16_t lookup_value;

      npm1300_write_byte(ADCCONFIG, 1); // 1 second auto measurement updates

      npm1300_write_byte(TASKIBATMEASURE, 1); // 1 second auto measurement updates for IBAT

      npm1300_write_byte(ADCIBATMEASEN, 1); // enable IBAT measurements

      npm1300_write_byte(TASKVBATMEASURE, 1); // 1 second auto measurement updates for VBAT

      npm1300_toggle_led(); // 2 second delay - mandatory

    npm1300_read_byte(EVENTSADCSET, &temp3);

    if (temp3) npm1300_write_byte(EVENTSADCSET,0);

    npm1300_read_byte(ADCVBATRESULTMSB, &temp1);

    npm1300_read_byte(ADCVBAT2RESULTMSB, &temp4);

    npm1300_read_byte(ADCGP1RESULTLSBS, &temp2);

    npm1300_read_byte(ADCIBATMEASSTATUS, &temp5);

    npm1300_read_byte(BCHGISETMSB, &temp6);

    npm1300_read_byte(BCHGISETLSB, &temp7);

    npm1300_read_byte(BCHGISETDISCHARGEMSB, &temp8); // discharging current limit MSB, default is 1340mA, get MSB, LSB and multiply by 3.23

    npm1300_read_byte(BCHGISETDISCHARGELSB, &temp9); // discharging current limit LSB, default is 1340mA

      temp16 = temp1;

      lookup_value = ((temp16 << 2)|(temp2 & 3)) << 6; // make it a 16-bit value

      float vbat = lookup_value;

      vbat *= 5.0;

      vbat /= 1023.0;

      vbat /= 64.0;

    //  DEBUG_PRINTF("NPM1300: VBAT MEAS: %4.2fV Lookup Value: %d Percent Remaining: %d IBAT: %04X\n", vbat, lookup_value, get_battery_percent(lookup_value), (temp4 << 1) + ((temp2 & 0x4)>> 2));

      int percent = get_battery_percent(lookup_value);

      temp16 = temp8; temp16 <<= 1; temp16 += temp9 & 1;

      temp17 = temp4; temp17 <<= 2; temp17 += (temp2 & 0x0300) >> 8;

      float ibat = temp16 * temp17;

      ibat /= 1023;

      float aibat = movingAverage(ibat, ibat_index);

      if (ibat_index > IBAT_WINDOW_SIZE) ibat_index = IBAT_WINDOW_SIZE;

      ibat_index++;

      DEBUG_PRINTF("%d,%d,%02X,%02X,%02X,%02X,%4.2f,%4.2f,%4.2f\n", xTaskGetTickCount(), percent, temp1, temp4, temp2, temp5, vbat, ibat, aibat);

    npm1300_write_byte(EVENTSADCCLR, 0x41);

    return percent;

    }

  • Hi, 

    please create a new ticket and we can take it there

    Regards

    Runar

Related