nPM1300 Configuration

Hi,

I would like your support in reviewing and helping define the correct configuration for the NPM1300 charger in our application.

Here is the current configuration we are using:

npm1300_charger: charger {
    compatible = "nordic,npm1300-charger";
    status = "okay";
    term-microvolt = <4100000>;
    term-warm-microvolt = <4000000>;
    current-microamp = <130000>;
    dischg-limit-microamp = <1340000>;
    vbus-limit-microamp = <500000>;
    thermistor-ohms = <10000>;
    thermistor-beta = <3435>;
    charging-enable;
};

We are using the following battery: renata ICP621333PA-01 3.7V / 230mAh

Could you please confirm whether this configuration is appropriate for the battery in use? I noticed that the PMIC offers additional protection and safety configurations. If possible, I would appreciate your guidance on defining a recommended and more complete set of parameters.

We are also encountering a couple of issues:

  1. Occasionally, the PMIC does not detect the USB-C charger connection during boot.

  2. When the USB connection is not recognized, the fuel gauge reports 0% state of charge (SOC).

Any advice or suggestions to address these issues would be greatly appreciated.

Parents
  • Hello,

    Sorry for the late reply!

    There were some issues detecting the VBUS status register in some NCS versions, and I believe this was present on v2.7.0.

    I suggest that on startup, you check the register directly, and then use the events to be notified on changes on the USB connection.

    You can read the register using this snippet:

    https://github.com/nrfconnect/sdk-zephyr/blob/v3.6.99-ncs2/drivers/sensor/nordic/npm1300_charger/npm1300_charger.c#L301

    ret = mfd_npm1300_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_STATUS, &data->vbus_stat);

    Alternatively, you can read it more directly like it is done here:

    https://github.com/nrfconnect/sdk-nrf/blob/v2.7.0/samples/pmic/native/npm1300_one_button/src/main.c#L64-L72

    	if (pins & BIT(NPM1300_EVENT_VBUS_DETECTED)) {
    		printk("Vbus connected\n");
    		vbus_connected = true;
    	}
    
    	if (pins & BIT(NPM1300_EVENT_VBUS_REMOVED)) {
    		printk("Vbus removed\n");
    		vbus_connected = false;
    	}

    Best regards,

    Edvin

  • Thank Edvin, this seems to work well!

    I have another issue related to the npm1300 driver. occasionally this function - hal_fg_init() returns false.

    Is there a problem in this function? I also tried a retry mechanism on this function, but when it fails, it always fail until the next reboot. 

    int hal_fg_init(void)
    {
        struct sensor_value value;
        struct nrf_fuel_gauge_init_parameters parameters = {
            .model = &battery_model,
            .opt_params = NULL,
        };
        int32_t chg_status;
        bool found = false;
    
        if (fuelgauge_device != NULL) {
            LOG_INF("fuel gauge HAL already initialized");
            return 0;
        }
    
        LOG_INF("initialize NPM1300 fuel gauge HAL (version: \"%s\", battery: \"%s\")",
                nrf_fuel_gauge_version, battery_model.name);
    
        fuelgauge_device = DEVICE_DT_GET(FUELGAUGE_CONTROLLER0_NODE);
        if (fuelgauge_device) {
            if (device_is_ready(fuelgauge_device)) {
                LOG_INF("found fuel gauge controller \"%s\"", fuelgauge_device->name);
                found = true;
            } else {
                LOG_ERR("Fuel gauge controller \"%s\" is not ready", fuelgauge_device->name);
            }
        }
    
        if (found == false) {
            LOG_ERR("no fuel gauge controller found");
            return -1;
        }
    
        if (read_npm1300_fuelgauge(fuelgauge_device, &parameters.v0, &parameters.i0, &parameters.t0,
                                   &chg_status) < 0) {
            return -1;
        }
    
        /* Store charge nominal and termination current, needed for ttf calculation */
        sensor_channel_get(fuelgauge_device, SENSOR_CHAN_GAUGE_DESIRED_CHARGING_CURRENT, &value);
        max_charge_current = (float)value.val1 + ((float)value.val2 / 1000000);
        term_charge_current = max_charge_current / 10.f;
    
        nrf_fuel_gauge_init(&parameters, NULL);
    
        ref_time = k_uptime_get();
    
        if (configure_npm1300_events() < 0) {
            return -1;
        }
    
        return 0;
    }
    

  • Are you able to see what part of this function that returns an error? Perhaps if you assign different return values for the different checks (for debugging purposes), and print the return value after the hal_fg_init() has returned? Which check is it that fails?

    Best regards,

    Edvin

  • Hi Edvin,

    so, the part that is failing is device_is_ready(fuelgauge_device) function returns sometimes false. statistically its one out a few resets process. Unfortunately, this happens although the device is ready, and removing this check solves the problem. We have the same issue with the IMU driver as well but much less often than the fuelgague.

    So, I'm wondering, is this check redundant? what is good for? should I remove this check for all of the drivers (we have quite a few of those checks)?

Reply
  • Hi Edvin,

    so, the part that is failing is device_is_ready(fuelgauge_device) function returns sometimes false. statistically its one out a few resets process. Unfortunately, this happens although the device is ready, and removing this check solves the problem. We have the same issue with the IMU driver as well but much less often than the fuelgague.

    So, I'm wondering, is this check redundant? what is good for? should I remove this check for all of the drivers (we have quite a few of those checks)?

Children
No Data
Related