SoC values after battery profiling

Hello

Awhile back I profiled my battery using power up app @ 4C 25C and 45C for a battery between 2.75V and 4.2V battery model is attached in zip.

The profiles themselves seem okay, so i think the measurement went well (see graphs below), however in practice i have a couple of problems:

1) Batteries never charge to 100%. I can confirm this by using the PPK2 to power my system instead of the battery. if i set the voltage to 4.2V source mode the SoC measurement comes back as 98% even though my profiles are all set up for VTerm = 4.2V so surely this should give me 100%?

My firmware is set up to listen to events from the NPM1300 to control the LED status and i never seem to get the battery charged event.

2) battery voltages sometimes seem to shift quite a bit post charge. Like they'll get to 98% and quite quickly drop to something like 94%. I've checked the power draw of my PCBs and they are all good, drawing the expected 15uA so I don't think this drop is real.

How does the SoC measurement work, i.e. is there smoothing or do the values update quite rapidly? I'm wondering if it's susceptible to spikes on the VBat supply.

Related to that, i was reviewing my implementation of the NPM1300 versus the EK and I can see I missed putting a capacitor on the battery directly so I wonder if this might make it susceptible to spikes that would cause the battery voltage to dip when a measurement is taken?

I've also included my npm1300 code.

battery_model.zip

/** ============================================================================
 *  @file       power.c
 *
 *  @brief      Power management
 *
 *  ============================================================================
 */

/*******************************************************************************
 * INCLUDES
 *******************************************************************************/
#include <stdlib.h>

#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/regulator.h>
#include <zephyr/drivers/sensor.h>
#include <zephyr/drivers/sensor/npm1300_charger.h>
#include <zephyr/dt-bindings/regulator/npm1300.h>
#include <zephyr/drivers/mfd/npm1300.h>
#include "fuel_gauge.h"
#include <zephyr/sys/reboot.h>

/* Project Specific files */
#include "power.h"
#include "tWatchdog.h"
#include "tApplication.h"
#include "tAuditLog.h"

#include "extperiph/sensori2c.h" //PMIC_I2C_instance

/*******************************************************************************
 * CONSTANTS AND MACROS
 *******************************************************************************/
#define SENSOR_SELECT()     SensorI2C_Select(SENSOR_I2C_1, 0x68)
#define SENSOR_DESELECT()   SensorI2C_Deselect()

LOG_MODULE_REGISTER(nept_Power);

K_MUTEX_DEFINE(power_ready_mutex);    
K_CONDVAR_DEFINE(power_ready_condvar); 

#define FUEL_GAUGE_PERIOD_VBUS_NOT_PRESENT_MS 60000
#define FUEL_GAUGE_PERIOD_VBUS_PRESENT_MS 5000

#define REG_MAIN_BASEADDR 0x0
#define REG_TASKSWRESET 0x1
#define REG_EVENTSADCSET 0x2
#define REG_EVENTSADCCLR 0x3
#define REG_INTENEVENTSADCSET 0x4
#define REG_INTENEVENTSADCCLR 0x5
#define REG_EVENTSBCHARGER0SET 0x6
#define REG_EVENTSBCHARGER0CLR 0x7
#define REG_INTENEVENTSBCHARGER0SET 0x8
#define REG_INTENEVENTSBCHARGER0CLR 0x9
#define REG_EVENTSBCHARGER1SET 0xa
#define REG_EVENTSBCHARGER1CLR 0xb
#define REG_INTENEVENTSBCHARGER1SET 0xc
#define REG_INTENEVENTSBCHARGER1CLR 0xd
#define REG_EVENTSBCHARGER2SET 0xe
#define REG_EVENTSBCHARGER2CLR 0xf
#define REG_INTENEVENTSBCHARGER2SET 0x10
#define REG_INTENEVENTSBCHARGER2CLR 0x11
#define REG_EVENTSSHPHLDSET 0x12
#define REG_EVENTSSHPHLDCLR 0x13
#define REG_INTENEVENTSSHPHLDSET 0x14
#define REG_INTENEVENTSSHPHLDCLR 0x15
#define REG_EVENTSVBUSIN0SET 0x16
#define REG_EVENTSVBUSIN0CLR 0x17
#define REG_INTENEVENTSVBUSIN0SET 0x18
#define REG_INTENEVENTSVBUSIN0CLR 0x19
#define REG_EVENTSVBUSIN1SET 0x1a
#define REG_EVENTSVBUSIN1CLR 0x1b
#define REG_INTENEVENTSVBUSIN1SET 0x1c
#define REG_INTENEVENTSVBUSIN1CLR 0x1d
#define REG_EVENTSGPIOSET 0x22
#define REG_EVENTSGPIOCLR 0x23
#define REG_INTENEVENTSGPIOSET 0x24
#define REG_INTENEVENTSGPIOCLR 0x25

#define REG_BCHARGER_BASEADDR 0x3
#define REG_BCHARGER_TASKRELEASEERR 0x0
#define REG_BCHARGER_TASKCLEARCHGERR 0x1
#define REG_BCHARGER_TASKCLEARSAFETYTIMER 0x2
#define REG_BCHARGER_BCHGENABLESET 0x4
#define REG_BCHARGER_BCHGENABLECLR 0x5
#define REG_BCHARGER_BCHGDISABLESET 0x6
#define REG_BCHARGER_BCHGDISABLECLR 0x7
#define REG_BCHARGER_BCHGISETMSB 0x8
#define REG_BCHARGER_BCHGISETLSB 0x9
#define REG_BCHARGER_BCHGISETDISCHARGEMSB 0xa
#define REG_BCHARGER_BCHGISETDISCHARGELSB 0xb
#define REG_BCHARGER_BCHGVTERM 0xc
#define REG_BCHARGER_BCHGVTERMR 0xd
#define REG_BCHARGER_BCHGVTRICKLESEL 0xe
#define REG_BCHARGER_BCHGITERMSEL 0xf
#define REG_BCHARGER_NTCCOLD 0x10
#define REG_BCHARGER_NTCCOLDLSB 0x11
#define REG_BCHARGER_NTCCOOL 0x12
#define REG_BCHARGER_NTCCOOLLSB 0x13
#define REG_BCHARGER_NTCWARM 0x14
#define REG_BCHARGER_NTCWARMLSB 0x15
#define REG_BCHARGER_NTCHOT 0x16
#define REG_BCHARGER_NTCHOTLSB 0x17
#define REG_BCHARGER_DIETEMPSTOP 0x18
#define REG_BCHARGER_DIETEMPSTOPLSB 0x19
#define REG_BCHARGER_DIETEMPRESUME 0x1a
#define REG_BCHARGER_DIETEMPRESUMELSB 0x1b
#define REG_BCHARGER_BCHGILIMSTATUS 0x2d
#define REG_BCHARGER_NTCSTATUS 0x32
#define REG_BCHARGER_DIETEMPSTATUS 0x33
#define REG_BCHARGER_BCHGCHARGESTATUS 0x34
#define REG_BCHARGER_BCHGERRREASON 0x36
#define REG_BCHARGER_BCHGERRSENSOR 0x37
#define REG_BCHARGER_BCHGCONFIG 0x3c


#define REG_BUCK_BASEADDR 0x4
#define REG_BUCK_BUCK1ENASET 0x0
#define REG_BUCK_BUCK1ENACLR 0x1
#define REG_BUCK_BUCK2ENASET 0x2
#define REG_BUCK_BUCK2ENACLR 0x3
#define REG_BUCK_BUCK1PWMSET 0x4
#define REG_BUCK_BUCK1PWMCLR 0x5
#define REG_BUCK_BUCK2PWMSET 0x6
#define REG_BUCK_BUCK2PWMCLR 0x7
#define REG_BUCK_BUCK1NORMVOUT 0x8
#define REG_BUCK_BUCK1RETVOUT 0x9
#define REG_BUCK_BUCK2NORMVOUT 0xA
#define REG_BUCK_BUCK2RETVOUT 0xB
#define REG_BUCK_BUCKENCTRL 0xC
#define REG_BUCK_BUCKVRETCTRL 0xD
#define REG_BUCK_BUCKPWMCTRL 0xE
#define REG_BUCK_BUCKSWCTRLSEL 0xF
#define REG_BUCK_BUCK1VOUTSTATUS 0x10
#define REG_BUCK_BUCK2VOUTSTATUS 0x11
#define REG_BUCK_BUCKCTRL0 0x15
#define REG_BUCK_BUCKSTATUS 0x34

#define BUCK1_3V0_VAL 20

#define REG_ADC_BASEADDR 0x5
#define REG_TASK_VBATMEASURE 0x0
#define REG_TASK_NTCMEASURE 0x1
#define REG_TASK_TEMPMEASURE 0x2
#define REG_TASK_SYSMEASURE 0x3
#define REG_TASK_BUS7MEASURE 0x7
#define REG_TASK_DELAYEDVBATMEASURE 0x8
#define REG_ADCCONFIG 0x9
#define REG_ADCNTCRSEL 0xA
#define REG_ADCAUTOTIMCONF 0xB
#define REG_TASK_AUTOTIMUPDATE 0xC
#define REG_ADCDELTIMCONF 0xD
#define REG_VBATRESULTMSB 0x11
#define REG_ADCNTCRESULTMSB 0x12
#define REG_ADCTEMPRESULTMSB 0x13
#define REG_ADCVSYSRESULTMSB 0x14
#define REG_ADCGP0RESULTLSBS 0x15
#define REG_ADCVBAT0RESULTMSB 0x16
#define REG_ADCVBAT1RESULTMSB 0x17
#define REG_ADCVBAT2RESULTMSB 0x18
#define REG_ADCVBAT3RESULTMSB 0x19
#define REG_ADCGP1RESULTLSBS 0x1A


#define REG_GPIO_BASEADDR 0x6
#define REG_GPIO_MODE_0 0x0
#define REG_GPIO_MODE_1 0x1
#define REG_GPIO_MODE_2 0x2
#define REG_GPIO_MODE_3 0x3
#define REG_GPIO_MODE_4 0x4
#define REG_GPIO_DRIVE_0 0x5
#define REG_GPIO_DRIVE_1 0x6
#define REG_GPIO_DRIVE_2 0x7
#define REG_GPIO_DRIVE_30 0x8
#define REG_GPIO_DRIVE_4 0x9
#define REG_GPIO_PUEN_0 0xA
#define REG_GPIO_PUEN_1 0xB
#define REG_GPIO_PUEN_2 0xC
#define REG_GPIO_PUEN_3 0xD
#define REG_GPIO_PUEN_4 0xE
#define REG_GPIO_PDEN_0 0xF
#define REG_GPIO_PDEN_1 0x10
#define REG_GPIO_PDEN_2 0x11
#define REG_GPIO_PDEN_3 0x12
#define REG_GPIO_PDEN_4 0x13
#define REG_GPIO_OD_0 0x14
#define REG_GPIO_OD_1 0x15
#define REG_GPIO_OD_2 0x16
#define REG_GPIO_OD_3 0x17
#define REG_GPIO_OD_4 0x18
#define REG_GPIO_BOUNCE_0 0x19
#define REG_GPIO_BOUNCE_1 0x1A
#define REG_GPIO_BOUNCE_2 0x1B
#define REG_GPIO_BOUNCE_3 0x1C
#define REG_GPIO_BOUNCE_4 0x1D
#define REG_GPIO_STATUS 0x1E

#define GPIO_MODE_IRQ 5

#define REG_LDSW_BASEADDR 0x8
#define REG_LDSW_TASKLDSW1SET 0x0
#define REG_LDSW_TASKLDSW1CLR 0x1
#define REG_LDSW_TASKLDSW2SET 0x2
#define REG_LDSW_TASKLDSW2CLR 0x3
#define REG_LDSW_LDSWSTATUS 0x4
#define REG_LDSW_LDSW1GPISEL 0x5
#define REG_LDSW_LDSW2GPISEL 0x6
#define REG_LDSW_LDSWCONFIG 0x7

#define REG_ERRLOG_BASEADDR 0xe
#define REG_TASKCLRERRLOG 0x0
#define REG_SCRATCH0 0x1
#define REG_SCRATCH1 0x2
#define REG_RSTCAUSE 0x3
#define REG_CHARGERERRREASON 0x4
#define REG_CHARGERERRSENSOR 0x5

#define ADC_PARAM_MAX_ENUMERABLE 7

#define REG_TIMER_BASEADDR 0x7
#define REG_TIMER_TIMERSET 0x0
#define REG_TIMER_TIMERCLR 0x1
#define REG_TIMER_TIMERTARGETSTROBE 0x3
#define REG_TIMER_WATCHDOGKICK 0x4
#define REG_TIMER_TIMERCONFIG 0x5
#define REG_TIMER_TIMERSTATUS 0x6
#define REG_TIMER_TIMERHIBYTE 0x8
#define REG_TIMER_TIMERMIDBYTE 0x9
#define REG_TIMER_TIMERLOBYTE 0xa

#define TIMER_MAX_VAL 167777215 /* 2^24 from 3 byte registers for lo/mid/hi*/
#define TIMER_MODE_WAKEUP 4

#define REG_SHIP_BASEADDR 0xb
#define REG_SHIP_TASKENTERHIBERNATE 0x0
#define REG_SHIP_TASKSHPHLDCFGSTROBE 0x1
#define REG_SHIP_TASKENTERSHIPMODE 0x2
#define REG_SHIP_TASKRESETCFG 0x3
#define REG_SHIP_SHPHLDCONFIG 0x4
#define REG_SHIP_SHPHLDSTATUS 0x5
#define REG_SHIP_LPRESETCONFIG 0x6

#define REG_ERRLOG_BASEADDR 0xe
#define REG_ERRLOG_TASKCLEARERRLOG 0x0
#define REG_ERRLOG_SCRATCH0 0x1
#define REG_ERRLOG_SCRATCH1 0x2
#define REG_ERRLOG_RSTCAUSE 0x3
#define REG_ERRLOG_CHARGERERREASON 0x4
#define REG_ERRLOG_CHARGERERSENSOR 0x5

/*******************************************************************************
 * TYPES
 *******************************************************************************/
struct power_supply {
    uint8_t ref_count;
    bool is_on;
};

/*******************************************************************************
 * PRIVATE FUNCTION PROTOTYPES
 *******************************************************************************/
static void fuel_gauge_cb(struct k_work *work);
static void shphld_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins);
static void chg_completed_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins);
static void chg_error_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins);
static void vbus_detected_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins);
static void vbus_removed_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins);
static void initEvents(void);

/*******************************************************************************
 * PRIVATE GLOBAL VARIABLES
 *******************************************************************************/
static volatile bool bPowerManagerReady = false;
static const struct device *pmic = DEVICE_DT_GET(DT_NODELABEL(npm1300_ek_pmic));
static const struct device *charger = DEVICE_DT_GET(DT_NODELABEL(npm1300_ek_charger));

#ifdef CONFIG_NRF_FUEL_GAUGE
static K_WORK_DELAYABLE_DEFINE(fuel_gauge_work, fuel_gauge_cb);
#endif

static bool bFuelGaugeEnabled = false;
static bool bVBusPresent = false;
static uint8_t u8BatteryStateOfCharge = 0u;
static struct power_supply ps_3v0_b = {0, false};
static struct power_supply ps_3v0_c = {0, false};

K_MUTEX_DEFINE(ps_mutex);

static const tAuditLog_ModuleCodes_t ModuleId = MODULE_POWER;

/*******************************************************************************
 * PRIVATE FUNCTIONS
 *******************************************************************************/
/*******************************************************************************
 * @fn          bottle_inserted_debounce_cb
 *
 * @brief       After the alarm has triggered for the bottle inserted timer, this
 *              is called
 *
 * @return      None
 ******************************************************************************/
#ifdef CONFIG_NRF_FUEL_GAUGE
static void fuel_gauge_cb(struct k_work *work)
{
    ARG_UNUSED(work);
    uint32_t u32FuelGaugePeriod = 0;
    uint8_t u8Soc = 0u;
    static bool bFirstRead = true;
    static bool bStartedLowBattery = false;

    int32_t err = SENSOR_SELECT();
    if (err != 0)
    {
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        LOG_ERR("Error selecting PMIC on I2C Bus");
        SENSOR_DESELECT();
        return;
    }
    err = fuel_gauge_update(charger, &u8Soc); //PMIC_I2C_instance
    SENSOR_DESELECT();
    if(err)
    {
        LOG_ERR("Failed to update fuel gauge algorithm");
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
    }
    else
    {
        /* We only want to reset if we go from a good battery state to a bad one. otherwise the application disabled state will handle it */
        if(bFirstRead && (u8Soc < CONFIG_MIN_BATTERY_PERCENT_FOR_OPERATION))
        {
            bStartedLowBattery = true;
        }

        if(!bStartedLowBattery && (u8Soc < CONFIG_MIN_BATTERY_PERCENT_FOR_OPERATION))
        {
            /* Wait for all tasks to finish any work before resetting so a dispense or audit log write isn't interrupted */
#ifndef CONFIG_APP_TEST_SHELL_MODE
            while(!Watchdog_IsAllTaskSleeping()){};
            sys_reboot(SYS_REBOOT_WARM);
#endif
        }
        u8BatteryStateOfCharge = u8Soc;
    }

    bFirstRead = false;

    if(!bFuelGaugeEnabled)
    {
        return;
    }

    if(bVBusPresent)
    {
        u32FuelGaugePeriod = FUEL_GAUGE_PERIOD_VBUS_PRESENT_MS;
    }
    else
    {
        u32FuelGaugePeriod = FUEL_GAUGE_PERIOD_VBUS_NOT_PRESENT_MS;
    }

    err = k_work_reschedule(&fuel_gauge_work, K_MSEC(u32FuelGaugePeriod));
    if(err < 0)
    {
        LOG_ERR("Failed to reschedule work (err=%d)",err);
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
    }
}
#endif /* CONFIG_NRF_FUEL_GAUGE */

static void shphld_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins)
{
	k_event_post(&ApplicationEvents, APPLICATION_EVT_USERBTN_PRESSED);
}

static void chg_completed_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins)
{
	k_event_post(&ApplicationEvents, APPLICATION_EVT_BATTERY_CHARGED);
}

static void chg_error_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins)
{
	k_event_post(&ApplicationEvents, APPLICATION_EVT_BATTERY_CHARGING_ERROR); 
}

static void vbus_detected_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins)
{
    bVBusPresent = true;
#ifdef CONFIG_NRF_FUEL_GAUGE
    int32_t err = k_work_reschedule(&fuel_gauge_work, K_MSEC(FUEL_GAUGE_PERIOD_VBUS_PRESENT_MS));
    if(err < 0)
    {
        LOG_ERR("Failed to reschedule work (err=%d)",err);
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
    }
#endif
	k_event_post(&ApplicationEvents, APPLICATION_EVT_BATTERY_CHARGING);
}

static void vbus_removed_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins)
{
    bVBusPresent = false;
#ifdef CONFIG_NRF_FUEL_GAUGE
    int32_t err = k_work_reschedule(&fuel_gauge_work,K_MSEC(FUEL_GAUGE_PERIOD_VBUS_NOT_PRESENT_MS));
    if(err < 0)
    {
        LOG_ERR("Failed to reschedule work (err=%d)",err);
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
    }
#endif
	k_event_post(&ApplicationEvents, APPLICATION_EVT_BATTERY_NOT_CHARGING);
}

/*******************************************************************************
 * @fn          initEvents 
 *
 * @brief       Set up the Events to feed ISRs into the task
 *
 * @return      None
 ******************************************************************************/
static void initEvents(void)
{
	if (!device_is_ready(pmic)) {
        tAuditLog_SendErr(ModuleId, __LINE__, 0, 0);
		LOG_ERR("Pmic device not ready.\n");
		return;
	}

    static struct gpio_callback shphld_cb;
    static struct gpio_callback chg_completed_cb;
    static struct gpio_callback chg_error_cb;
    static struct gpio_callback vbus_detected_cb;
    static struct gpio_callback vbus_removed_cb;

    gpio_init_callback(&shphld_cb, shphld_callback, BIT(NPM1300_EVENT_SHIPHOLD_PRESS));
    gpio_init_callback(&chg_completed_cb, chg_completed_callback, BIT(NPM1300_EVENT_CHG_COMPLETED));
    gpio_init_callback(&chg_error_cb, chg_error_callback, BIT(NPM1300_EVENT_CHG_ERROR));
    gpio_init_callback(&vbus_detected_cb, vbus_detected_callback, BIT(NPM1300_EVENT_VBUS_DETECTED));
    gpio_init_callback(&vbus_removed_cb, vbus_removed_callback, BIT(NPM1300_EVENT_VBUS_REMOVED));

	int32_t err = mfd_npm1300_add_callback(pmic, &shphld_cb);
    if(err)
    {
        LOG_ERR("Failed to add shphld cb");
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
    }

    err = mfd_npm1300_add_callback(pmic, &chg_completed_cb);
    if(err)
    {
        LOG_ERR("Failed to add chg complete cb");
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
    }

    err = mfd_npm1300_add_callback(pmic, &chg_error_cb);
        if(err)
    {
        LOG_ERR("Failed to add chg error cb");
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
    }

    err = mfd_npm1300_add_callback(pmic, &vbus_detected_cb);
    if(err)
    {
        LOG_ERR("Failed to add vbus detected cb");
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
    }

    err = mfd_npm1300_add_callback(pmic, &vbus_removed_cb);
    if(err)
    {
        LOG_ERR("Failed to add vbus removed cb");
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
    }
}

/*******************************************************************************
 * PUBLIC FUNCTIONS
 *******************************************************************************/

int32_t Power_Init(uint8_t * pu8BatSoc)
{
    uint8_t u8Reg = 0;
    int32_t err =0;

    k_mutex_lock(&power_ready_mutex, K_FOREVER);

    bool b3v0b_enabled_on_startup = false;

    initEvents();

    /* Get the battery voltage first, so we can disable the system if the voltage
    is too low. */
    #ifdef CONFIG_NRF_FUEL_GAUGE
    if (!device_is_ready(charger)) {
        tAuditLog_SendErr(ModuleId, __LINE__, 0, 0);
        LOG_ERR("Charger device not ready.\n");
        return -EBUSY;
	}
  
    err = fuel_gauge_init(charger);
	if (err) {
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
		LOG_ERR("Could not initialise fuel gauge.\n");
		return err;
	}

    /* Start monitoring battery state-of-charge */
    bFuelGaugeEnabled = true;
    fuel_gauge_cb(NULL);

    if(pu8BatSoc != NULL)
    {
        *pu8BatSoc = u8BatteryStateOfCharge;

        /* if we're below the threshold then go into the disabled state*/
        if(*pu8BatSoc < CONFIG_MIN_BATTERY_PERCENT_FOR_OPERATION)
        {
            return 0;
        }
    }
#endif

    err = Power_SupplyGetStatus(POWER_SUPPLY_3V0_B);

    if(err < 0)
    {
        LOG_ERR("Failed to get power supply status");
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
    }
    else
    {
        b3v0b_enabled_on_startup = (bool)err;
    }

    /* Disable reset on long hold (>10s) of shphld btn */
    err = SENSOR_SELECT();
    if (err != 0)
    {
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        LOG_ERR("Error selecting PMIC on I2C Bus");
        SENSOR_DESELECT();
        return err;
    }
    err = mfd_npm1300_reg_write(pmic, REG_SHIP_BASEADDR, REG_SHIP_LPRESETCONFIG, 1); //PMIC_I2C_instance
    SENSOR_DESELECT();
    if(err)
    {
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        LOG_ERR("Failed to disabled the long hold reset");
        return err;
    }

    /* Enable sw control of buck 1 voltage */
    err = SENSOR_SELECT();
    if (err != 0)
    {
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        LOG_ERR("Error selecting PMIC on I2C Bus");
        SENSOR_DESELECT();
        return err;
    }
    err = mfd_npm1300_reg_write(pmic, REG_BUCK_BASEADDR, REG_BUCK_BUCKSWCTRLSEL, 1u); //PMIC_I2C_instance
    SENSOR_DESELECT();
    if(err)
    {
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        LOG_ERR("Failed to enable vbat interrupt");
        return err;
    }

    /* Set output buck 1 output voltage to 3v0*/
    err = SENSOR_SELECT();
    if (err != 0)
    {
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        LOG_ERR("Error selecting PMIC on I2C Bus");
        SENSOR_DESELECT();
        return err;
    }
    err = mfd_npm1300_reg_write(pmic, REG_BUCK_BASEADDR, REG_BUCK_BUCK1NORMVOUT, BUCK1_3V0_VAL); //PMIC_I2C_instance
    SENSOR_DESELECT();
    if(err)
    {
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        LOG_ERR("Failed to enable vbat interrupt");
        return err;
    }

    /* Enable the output cap dishcharge on Buck 1 turn off*/
    err = SENSOR_SELECT();
    if (err != 0)
    {
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        LOG_ERR("Error selecting PMIC on I2C Bus");
        SENSOR_DESELECT();
        return err;
    }
    err = mfd_npm1300_reg_write(pmic, REG_BUCK_BASEADDR, REG_BUCK_BUCKCTRL0, 0b100); //PMIC_I2C_instance
    SENSOR_DESELECT();
    if(err)
    {
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        LOG_ERR("Failed to enable vbat interrupt");
        return err;
    }

    /* Zephyr cannot do a deferred initialisation of a device.
    the flash chip is powered by 3V0_B so init will fail unless we
    enable the buck then perform a system reset so the kernel can init
    the qspi once. 3v0_b can then be disabled as usual. */
    if(!b3v0b_enabled_on_startup)
    {
        LOG_INF("Enabling 3V0_B to allow QSPI init");
        Power_SupplyEnable(POWER_SUPPLY_3V0_B);
        k_sleep(K_MSEC(100));
        sys_reboot(SYS_REBOOT_WARM);
    }

    err = Power_SupplyDisable(POWER_SUPPLY_3V0_B);
    if(err)
    {
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        LOG_ERR("Failed to disable buck 1");
        return err;
    }

    /* Enable the output cap dishcharge on LS1 turn off*/
    err = SENSOR_SELECT();
    if (err != 0)
    {
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        LOG_ERR("Error selecting PMIC on I2C Bus");
        SENSOR_DESELECT();
        return err;
    }
    err = mfd_npm1300_reg_write(pmic, REG_LDSW_BASEADDR, REG_LDSW_LDSWCONFIG, 0b01000000); //PMIC_I2C_instance
    SENSOR_DESELECT();
    if(err)
    {
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        LOG_ERR("Failed to enable vbat interrupt");
        return err;
    }

    err = SENSOR_SELECT();
    if (err != 0)
    {
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        LOG_ERR("Error selecting PMIC on I2C Bus");
        SENSOR_DESELECT();
        return err;
    }
    err = mfd_npm1300_reg_read(pmic, 0x02, 0x07, &u8Reg); //PMIC_I2C_instance
    SENSOR_DESELECT();
    if(err)
    {
        tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        LOG_ERR("Failed to read VBUS status from NPM1300 err=%d",err);
        return err;
    }
    else
    {
        bVBusPresent = u8Reg & 1u;
    }

    if(bVBusPresent)
    {
        vbus_detected_callback(NULL,NULL,0); 
    }

    bPowerManagerReady = true;

    Power_NotifySysOkay();

    return err;
}

void Power_NotifySysOkay(void)
{
    /* Wake up all waiting threads */
    k_condvar_broadcast(&power_ready_condvar); 
    k_mutex_unlock(&power_ready_mutex); 
}

void Power_AwaitReady(void)
{
    k_mutex_lock(&power_ready_mutex, K_FOREVER);

    while (!bPowerManagerReady)
    {
        /* Wait for init to complete */
        k_condvar_wait(&power_ready_condvar, &power_ready_mutex, K_FOREVER);
    }

    k_mutex_unlock(&power_ready_mutex);
}

int32_t Power_SupplyEnable(Power_Supply_t powerSupply)
{
    int32_t err = 0;
    switch(powerSupply)
    {
        case POWER_SUPPLY_3V0_B:
            k_mutex_lock(&ps_mutex, K_FOREVER);
            if(ps_3v0_b.ref_count == 0)
            {
                err = SENSOR_SELECT();
                if (err != 0)
                {
                    tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
                    LOG_ERR("Error selecting PMIC on I2C Bus");
                    SENSOR_DESELECT();
                    return err;
                }
                err = mfd_npm1300_reg_write(pmic, REG_BUCK_BASEADDR, REG_BUCK_BUCK1ENASET, 1); //PMIC_I2C_instance
                SENSOR_DESELECT();
                if(err)
                {
                    tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
                    LOG_ERR("Failed to enable Power Supply B");
                }
                k_sleep(K_MSEC(10)); /* Start up time for peripherals */
                ps_3v0_b.is_on = true;
            }
            ps_3v0_b.ref_count++;
            k_mutex_unlock(&ps_mutex);
        break;
        case POWER_SUPPLY_3V0_C:
            k_mutex_lock(&ps_mutex, K_FOREVER);
            if(ps_3v0_c.ref_count == 0)
            {
                err = SENSOR_SELECT();
                if (err != 0)
                {
                    tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
                    LOG_ERR("Error selecting PMIC on I2C Bus");
                    SENSOR_DESELECT();
                    return err;
                }
                err = mfd_npm1300_reg_write(pmic, REG_LDSW_BASEADDR, REG_LDSW_TASKLDSW1SET, 1); //PMIC_I2C_instance
                SENSOR_DESELECT();
                if(err)
                {
                    tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
                    LOG_ERR("Failed to enable Power Supply C");
                }
                k_sleep(K_MSEC(10)); /* Start up time for peripherals */
                ps_3v0_c.is_on = true;
            }
            ps_3v0_c.ref_count++;
            k_mutex_unlock(&ps_mutex);
        break;
        default:
            err = -EINVAL;
            LOG_ERR("Invalid power supply selected");
            tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        break;
    }
    return err;
}

int32_t Power_SupplyDisable(Power_Supply_t powerSupply)
{
    int32_t err = 0;
    switch(powerSupply)
    {
        case POWER_SUPPLY_3V0_B:
            k_mutex_lock(&ps_mutex, K_FOREVER);
            ps_3v0_b.ref_count = (ps_3v0_b.ref_count > 0) ? (ps_3v0_b.ref_count - 1) : 0;
            if(ps_3v0_b.ref_count == 0)
            {
                err = SENSOR_SELECT();
                if (err != 0)
                {
                    tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
                    LOG_ERR("Error selecting PMIC on I2C Bus");
                    SENSOR_DESELECT();
                    return err;
                }
                err = mfd_npm1300_reg_write(pmic, REG_BUCK_BASEADDR, REG_BUCK_BUCK1ENACLR, 1); //PMIC_I2C_instance
                SENSOR_DESELECT();
                if(err)
                {
                    tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
                    LOG_ERR("Failed to disable power supply B");
                }
                ps_3v0_b.is_on = false;
            }
            k_mutex_unlock(&ps_mutex);
        break;
        case POWER_SUPPLY_3V0_C:
            k_mutex_lock(&ps_mutex, K_FOREVER);
            ps_3v0_c.ref_count = (ps_3v0_c.ref_count > 0) ? (ps_3v0_c.ref_count - 1) : 0;
            if(ps_3v0_c.ref_count == 0)
            {
                err = SENSOR_SELECT();
                if (err != 0)
                {
                    tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
                    LOG_ERR("Error selecting PMIC on I2C Bus");
                    SENSOR_DESELECT();
                    return err;
                }
                err = mfd_npm1300_reg_write(pmic, REG_LDSW_BASEADDR, REG_LDSW_TASKLDSW1CLR, 1); //PMIC_I2C_instance
                SENSOR_DESELECT();
                if(err)
                {
                    tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
                    LOG_ERR("Failed to disable power supply C");
                }
                ps_3v0_c.is_on = false;
            }
            k_mutex_unlock(&ps_mutex);
        break;
        default:
            err = -EINVAL;
            LOG_ERR("Invalid power supply selected");
            tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
        break;
    }
    return err;
}

int32_t Power_SupplyGetStatus(Power_Supply_t powerSupply)
{
    uint8_t u8result = 0;
    int32_t err = 0;

    switch(powerSupply)
    {
        case POWER_SUPPLY_3V0_B:
            err = SENSOR_SELECT();
            if (err != 0)
            {
                tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
                LOG_ERR("Error selecting PMIC on I2C Bus");
                SENSOR_DESELECT();
                return err;
            }
            err = mfd_npm1300_reg_read(pmic, REG_BUCK_BASEADDR, REG_BUCK_BUCKSTATUS, &u8result); //PMIC_I2C_instance
            SENSOR_DESELECT();
            if(err)
            {
                tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
                LOG_ERR("Failed to read 3V0_B status from NPM1300 err=%d",err);
            }
            else
            {
                return u8result & 0b100;
            }
        break;
        case POWER_SUPPLY_3V0_C:
            err = SENSOR_SELECT();
            if (err != 0)
            {
                tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
                LOG_ERR("Error selecting PMIC on I2C Bus");
                SENSOR_DESELECT();
                return err;
            }
            err = mfd_npm1300_reg_read(pmic, REG_LDSW_BASEADDR, REG_LDSW_LDSWSTATUS, &u8result); //PMIC_I2C_instance
            SENSOR_DESELECT();
            if(err)
            {
                tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
                LOG_ERR("Failed to read 3V0_C status from NPM1300 err=%d",err);
            }
            else
            {
                return u8result & 0b10000;
            }
        break;
        default:
            err = -EINVAL;
            tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
            LOG_ERR("Invalid power supply selected");
            return err;
        break;
    }

    return err;
}

uint8_t Power_GetBatterySoc(void)
{
    return u8BatteryStateOfCharge;
}

/*
 * Copyright (c) 2023 Nordic Semiconductor ASA
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */
#ifdef CONFIG_NRF_FUEL_GAUGE
#include <stdlib.h>

#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/device.h>
#include <zephyr/drivers/sensor.h>
#include <zephyr/drivers/sensor/npm1300_charger.h>

#include "nrf_fuel_gauge.h"
#include "tAuditLog.h"

/* nPM1300 CHARGER.BCHGCHARGESTATUS.CONSTANTCURRENT register bitmask */
#define NPM1300_CHG_STATUS_CC_MASK BIT_MASK(3)

static float max_charge_current;
static float term_charge_current;
static int64_t ref_time;

LOG_MODULE_REGISTER(nept_fuel_gauge);
static const tAuditLog_ModuleCodes_t ModuleId = MODULE_FUEL_GAUGE;


static const struct battery_model battery_model = {
#include "battery_model/EEMBLP902030_25C_4C_45C.inc"
};

static int read_sensors(const struct device *charger, float *voltage, float *current, float *temp, int32_t *chg_status)
{
	struct sensor_value value;
	int32_t err;

	err = sensor_sample_fetch(charger);
	 if (err < 0) {
		LOG_ERR("Failed to fetch sensor sample");
		tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
		return err;
	}

	err = sensor_channel_get(charger, SENSOR_CHAN_GAUGE_VOLTAGE, &value);
	if(err)
	{
		LOG_ERR("Failed to fetch voltage channel");
		tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
		return err;
	}
	*voltage = (float)value.val1 + ((float)value.val2 / 1000000);

	err = sensor_channel_get(charger, SENSOR_CHAN_GAUGE_TEMP, &value);
	if(err)
	{
		LOG_ERR("Failed to fetch temp channel");
		tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
		return err;
	}
	*temp = (float)value.val1 + ((float)value.val2 / 1000000);

	err = sensor_channel_get(charger, SENSOR_CHAN_GAUGE_AVG_CURRENT, &value);
	if(err)
	{
		LOG_ERR("Failed to fetch avg. current channel");
		tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
		return err;
	}
	*current = (float)value.val1 + ((float)value.val2 / 1000000);

	err = sensor_channel_get(charger, SENSOR_CHAN_NPM1300_CHARGER_STATUS, &value);
	if(err)
	{
		LOG_ERR("Failed to fetch charge status");
		tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
		return err;
	}
	*chg_status = value.val1;

	return 0;
}

int fuel_gauge_init(const struct device *charger)
{
	struct sensor_value value;
	struct nrf_fuel_gauge_init_parameters parameters = { .model = &battery_model };
	int32_t err;
	int32_t chg_status;

	err = read_sensors(charger, &parameters.v0, &parameters.i0, &parameters.t0, &chg_status);
	if (err) {
		LOG_ERR("Failed to fetch sensor data");
		tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
		return err;
	}

	/* Store charge nominal and termination current, needed for ttf calculation */
	err = sensor_channel_get(charger, SENSOR_CHAN_GAUGE_DESIRED_CHARGING_CURRENT, &value);
	if(err)
	{
		LOG_ERR("Failed to fetch desired charging current");
		tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
		return err;
	}
	max_charge_current = (float)value.val1 + ((float)value.val2 / 1000000);
	term_charge_current = max_charge_current / 10.f;

	err = nrf_fuel_gauge_init(&parameters, NULL);
	if(err)
	{
		LOG_ERR("Failed to init fuel gauge algorithm");
		tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
		return err;
	}

	ref_time = k_uptime_get();

	return 0;
}

int fuel_gauge_update(const struct device *charger, uint8_t *pu8Soc)
{
	float voltage;
	float current;
	float temp;
	float soc;
	float tte;
	float ttf;
	float delta;
	int32_t chg_status;
	bool cc_charging;
	int32_t err;

	err = read_sensors(charger, &voltage, &current, &temp, &chg_status);
	if (err < 0) {
		LOG_ERR("Failed to fetch sensor data");
		tAuditLog_SendErr(ModuleId, __LINE__, err, 0);
		return err;
	}

	cc_charging = (chg_status & NPM1300_CHG_STATUS_CC_MASK) != 0;

	delta = (float) k_uptime_delta(&ref_time) / 1000.f;

	soc = nrf_fuel_gauge_process(voltage, current, temp, delta, NULL);
	tte = nrf_fuel_gauge_tte_get();
	ttf = nrf_fuel_gauge_ttf_get(cc_charging, -term_charge_current);

	LOG_INF("V: %.3f, I: %.3f, T: %.2f, ", voltage, current, temp);
	LOG_INF("SoC: %.2f, TTE: %.0f, TTF: %.0f", soc, tte, ttf);

	*pu8Soc = (uint8_t)soc;

	return 0;
}

#endif /* CONFIG_NRF_FUEL_GAUGE */

Parents
  • Are you using a NTC on the battery? 

    Can you get the output values from the Fuel gauge library. This will be helpful in debugging. It should contain battery voltage, current, temperature and SOC value.

    You can also use this function https://docs.nordicsemi.com/bundle/nrfxlib-apis-latest/page/structnrf_fuel_gauge_state_info.html#details

    The capacitor on VBAT is mandatory so you need to add this. 

    Also since you areusing the events from the NPM1300 to control the LED status, you could also Read BCHGCHARGESTATUS register COMPLETED bit to determine the charging completed status: https://docs.nordicsemi.com/bundle/ps_npm1300/page/chapters/charger.html#ariaid-title46

  • [00:00:00.109,55[00:00:53.391,693] <inf> nept_tApplication: Battery Charging
    [00:00:53.466,369] <inf> nept_tApplication: Application State: Sleep
    [00:00:58.397,094] <inf> nept_fuel_gauge: V: 4.091, I: 0.002, T: 15.74, 
    [00:00:58.397,125] <inf> nept_fuel_gauge: SoC: 92.90, TTE: nan, TTF: nan
    [00:01:03.402,770] <inf> nept_fuel_gauge: V: 4.218, I: -0.306, T: 15.74, 
    [00:01:03.402,801] <inf> nept_fuel_gauge: SoC: 92.90, TTE: nan, TTF: nan
    [00:01:08.408,416] <inf> nept_fuel_gauge: V: 4.218, I: -0.279, T: 15.84, 
    [00:01:08.408,477] <inf> nept_fuel_gauge: SoC: 92.99, TTE: nan, TTF: nan
    [00:01:13.414,093] <inf> nept_fuel_gauge: V: 4.218, I: -0.271, T: 15.84, 
    [00:01:13.414,123] <inf> nept_fuel_gauge: SoC: 93.08, TTE: nan, TTF: nan
    [00:01:18.419,738] <inf> nept_fuel_gauge: V: 4.218, I: -0.251, T: 15.84, 
    [00:01:18.419,769] <inf> nept_fuel_gauge: SoC: 93.16, TTE: nan, TTF: nan
    [00:01:23.425,384] <inf> nept_fuel_gauge: V: 4.218, I: -0.242, T: 15.94, 
    [00:01:23.425,415] <inf> nept_fuel_gauge: SoC: 93.24, TTE: nan, TTF: nan
    [00:01:28.431,030] <inf> nept_fuel_gauge: V: 4.218, I: -0.232, T: 15.94, 
    [00:01:28.431,060] <inf> nept_fuel_gauge: SoC: 93.31, TTE: nan, TTF: nan
    [00:01:33.436,645] <inf> nept_fuel_gauge: V: 4.218, I: -0.229, T: 15.94, 
    [00:01:33.436,706] <inf> nept_fuel_gauge: SoC: 93.38, TTE: nan, TTF: nan
    [00:01:38.442,321] <inf> nept_fuel_gauge: V: 4.218, I: -0.217, T: 16.04, 
    [00:01:38.442,352] <inf> nept_fuel_gauge: SoC: 93.45, TTE: nan, TTF: nan
    [00:01:43.447,998] <inf> nept_fuel_gauge: V: 4.218, I: -0.217, T: 16.04, 
    [00:01:43.448,028] <inf> nept_fuel_gauge: SoC: 93.52, TTE: nan, TTF: nan
    [00:01:48.453,674] <inf> nept_fuel_gauge: V: 4.213, I: -0.215, T: 16.04, 
    [00:01:48.453,704] <inf> nept_fuel_gauge: SoC: 93.58, TTE: nan, TTF: nan
    [00:01:53.459,320] <inf> nept_fuel_gauge: V: 4.218, I: -0.202, T: 16.14, 
    [00:01:53.459,350] <inf> nept_fuel_gauge: SoC: 93.65, TTE: nan, TTF: nan
    [00:01:58.464,996] <inf> nept_fuel_gauge: V: 4.218, I: -0.203, T: 16.14, 
    [00:01:58.465,026] <inf> nept_fuel_gauge: SoC: 93.71, TTE: nan, TTF: nan
    [00:02:03.470,672] <inf> nept_fuel_gauge: V: 4.218, I: -0.199, T: 16.14, 
    [00:02:03.470,703] <inf> nept_fuel_gauge: SoC: 93.77, TTE: nan, TTF: nan
    [00:02:08.476,318] <inf> nept_fuel_gauge: V: 4.218, I: -0.197, T: 16.14, 
    [00:02:08.476,348] <inf> nept_fuel_gauge: SoC: 93.83, TTE: nan, TTF: nan
    [00:02:13.481,933] <inf> nept_fuel_gauge: V: 4.218, I: -0.194, T: 16.24, 
    [00:02:13.481,994] <inf> nept_fuel_gauge: SoC: 93.89, TTE: nan, TTF: nan
    [00:02:18.487,579] <inf> nept_fuel_gauge: V: 4.218, I: -0.190, T: 16.24, 
    [00:02:18.487,640] <inf> nept_fuel_gauge: SoC: 93.95, TTE: nan, TTF: nan
    [00:02:23.493,225] <inf> nept_fuel_gauge: V: 4.218, I: -0.184, T: 16.24, 
    [00:02:23.493,286] <inf> nept_fuel_gauge: SoC: 94.00, TTE: nan, TTF: nan
    [00:02:28.498,870] <inf> nept_fuel_gauge: V: 4.218, I: -0.182, T: 16.24, 
    [00:02:28.498,931] <inf> nept_fuel_gauge: SoC: 94.06, TTE: nan, TTF: nan
    [00:02:33.504,516] <inf> nept_fuel_gauge: V: 4.218, I: -0.181, T: 16.24, 
    [00:02:33.504,547] <inf> nept_fuel_gauge: SoC: 94.11, TTE: nan, TTF: nan
    [00:02:38.510,162] <inf> nept_fuel_gauge: V: 4.218, I: -0.175, T: 16.24, 
    [00:02:38.510,223] <inf> nept_fuel_gauge: SoC: 94.17, TTE: nan, TTF: nan
    [00:02:43.515,808] <inf> nept_fuel_gauge: V: 4.218, I: -0.170, T: 16.24, 
    [00:02:43.515,869] <inf> nept_fuel_gauge: SoC: 94.22, TTE: nan, TTF: nan
    [00:02:48.521,453] <inf> nept_fuel_gauge: V: 4.218, I: -0.171, T: 16.24, 
    [00:02:48.521,514] <inf> nept_fuel_gauge: SoC: 94.27, TTE: nan, TTF: nan
    [00:02:53.527,099] <inf> nept_fuel_gauge: V: 4.218, I: -0.170, T: 16.24, 
    [00:02:53.527,160] <inf> nept_fuel_gauge: SoC: 94.32, TTE: nan, TTF: nan
    [00:02:58.532,745] <inf> nept_fuel_gauge: V: 4.218, I: -0.169, T: 16.24, 
    [00:02:58.532,806] <inf> nept_fuel_gauge: SoC: 94.38, TTE: nan, TTF: nan
    [00:03:03.538,482] <inf> nept_fuel_gauge: V: 4.218, I: -0.164, T: 16.34, 
    [00:03:03.538,513] <inf> nept_fuel_gauge: SoC: 94.43, TTE: nan, TTF: 558
    [00:03:08.544,219] <inf> nept_fuel_gauge: V: 4.218, I: -0.166, T: 16.34, 
    [00:03:08.544,250] <inf> nept_fuel_gauge: SoC: 94.48, TTE: nan, TTF: 558
    [00:03:13.549,957] <inf> nept_fuel_gauge: V: 4.218, I: -0.162, T: 16.34, 
    [00:03:13.549,987] <inf> nept_fuel_gauge: SoC: 94.53, TTE: nan, TTF: 555
    [00:03:18.555,664] <inf> nept_fuel_gauge: V: 4.218, I: -0.160, T: 16.34, 
    [00:03:18.555,694] <inf> nept_fuel_gauge: SoC: 94.57, TTE: nan, TTF: 554
    [00:03:23.561,401] <inf> nept_fuel_gauge: V: 4.218, I: -0.154, T: 16.34, 
    [00:03:23.561,431] <inf> nept_fuel_gauge: SoC: 94.62, TTE: nan, TTF: 550
    [00:03:28.567,138] <inf> nept_fuel_gauge: V: 4.218, I: -0.153, T: 16.34, 
    [00:03:28.567,169] <inf> nept_fuel_gauge: SoC: 94.67, TTE: nan, TTF: 549
    [00:03:33.572,875] <inf> nept_fuel_gauge: V: 4.218, I: -0.150, T: 16.34, 
    [00:03:33.572,906] <inf> nept_fuel_gauge: SoC: 94.72, TTE: nan, TTF: 546
    [00:03:38.578,582] <inf> nept_fuel_gauge: V: 4.218, I: -0.150, T: 16.34, 
    [00:03:38.578,613] <inf> nept_fuel_gauge: SoC: 94.76, TTE: nan, TTF: 546
    [00:03:43.584,320] <inf> nept_fuel_gauge: V: 4.218, I: -0.150, T: 16.34, 
    [00:03:43.584,350] <inf> nept_fuel_gauge: SoC: 94.81, TTE: nan, TTF: 545
    [00:03:48.590,057] <inf> nept_fuel_gauge: V: 4.218, I: -0.147, T: 16.44, 
    [00:03:48.590,087] <inf> nept_fuel_gauge: SoC: 94.85, TTE: nan, TTF: 542
    [00:03:53.595,794] <inf> nept_fuel_gauge: V: 4.218, I: -0.147, T: 16.34, 
    [00:03:53.595,825] <inf> nept_fuel_gauge: SoC: 94.90, TTE: nan, TTF: 541
    [00:03:58.601,531] <inf> nept_fuel_gauge: V: 4.218, I: -0.142, T: 16.44, 
    [00:03:58.601,562] <inf> nept_fuel_gauge: SoC: 94.94, TTE: nan, TTF: 537
    [00:04:03.607,269] <inf> nept_fuel_gauge: V: 4.218, I: -0.143, T: 16.44, 
    [00:04:03.607,299] <inf> nept_fuel_gauge: SoC: 94.98, TTE: nan, TTF: 537
    [00:04:08.613,006] <inf> nept_fuel_gauge: V: 4.218, I: -0.138, T: 16.44, 
    [00:04:08.613,037] <inf> nept_fuel_gauge: SoC: 95.03, TTE: nan, TTF: 533
    [00:04:13.618,743] <inf> nept_fuel_gauge: V: 4.218, I: -0.140, T: 16.44, 
    [00:04:13.618,774] <inf> nept_fuel_gauge: SoC: 95.07, TTE: nan, TTF: 533
    [00:04:18.624,481] <inf> nept_fuel_gauge: V: 4.218, I: -0.136, T: 16.44, 
    [00:04:18.624,511] <inf> nept_fuel_gauge: SoC: 95.11, TTE: nan, TTF: 530
    [00:04:23.630,218] <inf> nept_fuel_gauge: V: 4.218, I: -0.132, T: 16.34, 
    [00:04:23.630,249] <inf> nept_fuel_gauge: SoC: 95.15, TTE: nan, TTF: 527
    [00:04:28.635,925] <inf> nept_fuel_gauge: V: 4.218, I: -0.134, T: 16.44, 
    [00:04:28.635,955] <inf> nept_fuel_gauge: SoC: 95.19, TTE: nan, TTF: 527
    [00:04:33.641,662] <inf> nept_fuel_gauge: V: 4.218, I: -0.132, T: 16.44, 
    [00:04:33.641,693] <inf> nept_fuel_gauge: SoC: 95.24, TTE: nan, TTF: 525
    [00:04:38.647,399] <inf> nept_fuel_gauge: V: 4.218, I: -0.132, T: 16.44, 
    [00:04:38.647,430] <inf> nept_fuel_gauge: SoC: 95.28, TTE: nan, TTF: 524
    [00:04:43.653,137] <inf> nept_fuel_gauge: V: 4.218, I: -0.129, T: 16.44, 
    [00:04:43.653,167] <inf> nept_fuel_gauge: SoC: 95.32, TTE: nan, TTF: 521
    [00:04:48.658,874] <inf> nept_fuel_gauge: V: 4.218, I: -0.127, T: 16.44, 
    [00:04:48.658,905] <inf> nept_fuel_gauge: SoC: 95.36, TTE: nan, TTF: 519
    [00:04:53.664,611] <inf> nept_fuel_gauge: V: 4.218, I: -0.126, T: 16.44, 
    [00:04:53.664,642] <inf> nept_fuel_gauge: SoC: 95.39, TTE: nan, TTF: 517
    [00:04:58.670,318] <inf> nept_fuel_gauge: V: 4.218, I: -0.124, T: 16.44, 
    [00:04:58.670,349] <inf> nept_fuel_gauge: SoC: 95.43, TTE: nan, TTF: 514
    [00:05:03.676,055] <inf> nept_fuel_gauge: V: 4.218, I: -0.124, T: 16.44, 
    [00:05:03.676,086] <inf> nept_fuel_gauge: SoC: 95.47, TTE: nan, TTF: 513
    [00:05:08.681,793] <inf> nept_fuel_gauge: V: 4.218, I: -0.123, T: 16.44, 
    [00:05:08.681,823] <inf> nept_fuel_gauge: SoC: 95.51, TTE: nan, TTF: 512
    [00:05:13.687,530] <inf> nept_fuel_gauge: V: 4.218, I: -0.121, T: 16.44, 
    [00:05:13.687,561] <inf> nept_fuel_gauge: SoC: 95.55, TTE: nan, TTF: 509
    [00:05:18.693,237] <inf> nept_fuel_gauge: V: 4.218, I: -0.119, T: 16.44, 
    [00:05:18.693,267] <inf> nept_fuel_gauge: SoC: 95.58, TTE: nan, TTF: 507
    [00:05:23.698,974] <inf> nept_fuel_gauge: V: 4.218, I: -0.117, T: 16.44, 
    [00:05:23.699,005] <inf> nept_fuel_gauge: SoC: 95.62, TTE: nan, TTF: 504
    [00:05:28.704,711] <inf> nept_fuel_gauge: V: 4.218, I: -0.119, T: 16.44, 
    [00:05:28.704,742] <inf> nept_fuel_gauge: SoC: 95.66, TTE: nan, TTF: 504
    [00:05:33.710,449] <inf> nept_fuel_gauge: V: 4.218, I: -0.116, T: 16.44, 
    [00:05:33.710,479] <inf> nept_fuel_gauge: SoC: 95.69, TTE: nan, TTF: 501
    [00:05:38.716,156] <inf> nept_fuel_gauge: V: 4.218, I: -0.114, T: 16.44, 
    [00:05:38.716,186] <inf> nept_fuel_gauge: SoC: 95.73, TTE: nan, TTF: 498
    [00:05:43.721,893] <inf> nept_fuel_gauge: V: 4.218, I: -0.114, T: 16.44, 
    [00:05:43.721,923] <inf> nept_fuel_gauge: SoC: 95.76, TTE: nan, TTF: 497
    [00:05:48.727,630] <inf> nept_fuel_gauge: V: 4.218, I: -0.113, T: 16.44, 
    [00:05:48.727,661] <inf> nept_fuel_gauge: SoC: 95.80, TTE: nan, TTF: 495
    [00:05:53.733,367] <inf> nept_fuel_gauge: V: 4.218, I: -0.111, T: 16.44, 
    [00:05:53.733,398] <inf> nept_fuel_gauge: SoC: 95.83, TTE: nan, TTF: 493
    [00:05:58.739,074] <inf> nept_fuel_gauge: V: 4.218, I: -0.111, T: 16.44, 
    [00:05:58.739,105] <inf> nept_fuel_gauge: SoC: 95.87, TTE: nan, TTF: 491
    [00:06:03.744,812] <inf> nept_fuel_gauge: V: 4.218, I: -0.108, T: 16.44, 
    [00:06:03.744,842] <inf> nept_fuel_gauge: SoC: 95.90, TTE: nan, TTF: 488
    [00:06:08.750,549] <inf> nept_fuel_gauge: V: 4.218, I: -0.107, T: 16.44, 
    [00:06:08.750,579] <inf> nept_fuel_gauge: SoC: 95.94, TTE: nan, TTF: 486
    [00:06:13.756,286] <inf> nept_fuel_gauge: V: 4.218, I: -0.105, T: 16.44, 
    [00:06:13.756,317] <inf> nept_fuel_gauge: SoC: 95.97, TTE: nan, TTF: 483
    [00:06:18.761,993] <inf> nept_fuel_gauge: V: 4.218, I: -0.102, T: 16.44, 
    [00:06:18.762,023] <inf> nept_fuel_gauge: SoC: 96.00, TTE: nan, TTF: 480
    [00:06:23.767,730] <inf> nept_fuel_gauge: V: 4.218, I: -0.105, T: 16.54, 
    [00:06:23.767,761] <inf> nept_fuel_gauge: SoC: 96.03, TTE: nan, TTF: 481
    [00:06:28.773,437] <inf> nept_fuel_gauge: V: 4.218, I: -0.104, T: 16.44, 
    [00:06:28.773,468] <inf> nept_fuel_gauge: SoC: 96.07, TTE: nan, TTF: 479
    [00:06:33.779,174] <inf> nept_fuel_gauge: V: 4.218, I: -0.102, T: 16.54, 
    [00:06:33.779,205] <inf> nept_fuel_gauge: SoC: 96.10, TTE: nan, TTF: 476
    [00:06:38.784,912] <inf> nept_fuel_gauge: V: 4.218, I: -0.101, T: 16.54, 
    [00:06:38.784,942] <inf> nept_fuel_gauge: SoC: 96.13, TTE: nan, TTF: 474
    [00:06:43.790,649] <inf> nept_fuel_gauge: V: 4.218, I: -0.100, T: 16.54, 
    [00:06:43.790,679] <inf> nept_fuel_gauge: SoC: 96.16, TTE: nan, TTF: 472
    [00:06:48.796,325] <inf> nept_fuel_gauge: V: 4.218, I: -0.096, T: 16.54, 
    [00:06:48.796,386] <inf> nept_fuel_gauge: SoC: 96.19, TTE: nan, TTF: 468
    [00:06:53.802,062] <inf> nept_fuel_gauge: V: 4.218, I: -0.093, T: 16.54, 
    [00:06:53.802,093] <inf> nept_fuel_gauge: SoC: 96.22, TTE: nan, TTF: 464
    [00:06:58.807,800] <inf> nept_fuel_gauge: V: 4.218, I: -0.097, T: 16.44, 
    [00:06:58.807,830] <inf> nept_fuel_gauge: SoC: 96.25, TTE: nan, TTF: 466
    [00:07:03.813,537] <inf> nept_fuel_gauge: V: 4.218, I: -0.093, T: 16.54, 
    [00:07:03.813,568] <inf> nept_fuel_gauge: SoC: 96.28, TTE: nan, TTF: 462
    [00:07:08.819,274] <inf> nept_fuel_gauge: V: 4.218, I: -0.091, T: 16.54, 
    [00:07:08.819,305] <inf> nept_fuel_gauge: SoC: 96.31, TTE: nan, TTF: 459
    [00:07:13.825,012] <inf> nept_fuel_gauge: V: 4.218, I: -0.093, T: 16.54, 
    [00:07:13.825,042] <inf> nept_fuel_gauge: SoC: 96.34, TTE: nan, TTF: 460
    [00:07:18.830,749] <inf> nept_fuel_gauge: V: 4.218, I: -0.091, T: 16.54, 
    [00:07:18.830,780] <inf> nept_fuel_gauge: SoC: 96.37, TTE: nan, TTF: 457
    [00:07:23.836,486] <inf> nept_fuel_gauge: V: 4.218, I: -0.089, T: 16.54, 
    [00:07:23.836,517] <inf> nept_fuel_gauge: SoC: 96.40, TTE: nan, TTF: 454
    [00:07:28.842,224] <inf> nept_fuel_gauge: V: 4.218, I: -0.090, T: 16.54, 
    [00:07:28.842,254] <inf> nept_fuel_gauge: SoC: 96.43, TTE: nan, TTF: 453
    [00:07:33.847,961] <inf> nept_fuel_gauge: V: 4.218, I: -0.088, T: 16.44, 
    [00:07:33.847,991] <inf> nept_fuel_gauge: SoC: 96.46, TTE: nan, TTF: 450
    [00:07:38.853,698] <inf> nept_fuel_gauge: V: 4.218, I: -0.089, T: 16.54, 
    [00:07:38.853,729] <inf> nept_fuel_gauge: SoC: 96.49, TTE: nan, TTF: 450
    [00:07:43.859,436] <inf> nept_fuel_gauge: V: 4.218, I: -0.085, T: 16.54, 
    [00:07:43.859,466] <inf> nept_fuel_gauge: SoC: 96.51, TTE: nan, TTF: 445
    [00:07:48.865,173] <inf> nept_fuel_gauge: V: 4.218, I: -0.085, T: 16.44, 
    [00:07:48.865,203] <inf> nept_fuel_gauge: SoC: 96.54, TTE: nan, TTF: 444
    [00:07:53.870,880] <inf> nept_fuel_gauge: V: 4.218, I: -0.086, T: 16.54, 
    [00:07:53.870,910] <inf> nept_fuel_gauge: SoC: 96.57, TTE: nan, TTF: 444
    [00:07:58.876,556] <inf> nept_fuel_gauge: V: 4.218, I: -0.086, T: 16.54, 
    [00:07:58.876,617] <inf> nept_fuel_gauge: SoC: 96.59, TTE: nan, TTF: 442
    [00:08:03.882,293] <inf> nept_fuel_gauge: V: 4.218, I: -0.085, T: 16.54, 
    [00:08:03.882,293] <inf> nept_fuel_gauge: SoC: 96.62, TTE: nan, TTF: 440
    [00:08:08.888,000] <inf> nept_fuel_gauge: V: 4.218, I: -0.083, T: 16.54, 
    [00:08:08.888,031] <inf> nept_fuel_gauge: SoC: 96.65, TTE: nan, TTF: 437
    [00:08:13.893,737] <inf> nept_fuel_gauge: V: 4.218, I: -0.082, T: 16.44, 
    [00:08:13.893,768] <inf> nept_fuel_gauge: SoC: 96.68, TTE: nan, TTF: 435
    [00:08:18.899,444] <inf> nept_fuel_gauge: V: 4.218, I: -0.079, T: 16.44, 
    [00:08:18.899,505] <inf> nept_fuel_gauge: SoC: 96.70, TTE: nan, TTF: 431
    [00:08:23.905,181] <inf> nept_fuel_gauge: V: 4.218, I: -0.081, T: 16.54, 
    [00:08:23.905,212] <inf> nept_fuel_gauge: SoC: 96.73, TTE: nan, TTF: 432
    [00:08:28.910,858] <inf> nept_fuel_gauge: V: 4.218, I: -0.080, T: 16.54, 
    [00:08:28.910,888] <inf> nept_fuel_gauge: SoC: 96.75, TTE: nan, TTF: 429
    [00:08:33.916,564] <inf> nept_fuel_gauge: V: 4.218, I: -0.080, T: 16.54, 
    [00:08:33.916,595] <inf> nept_fuel_gauge: SoC: 96.78, TTE: nan, TTF: 428
    [00:08:38.922,271] <inf> nept_fuel_gauge: V: 4.213, I: -0.080, T: 16.54, 
    [00:08:38.922,302] <inf> nept_fuel_gauge: SoC: 96.80, TTE: nan, TTF: 427
    [00:08:43.928,009] <inf> nept_fuel_gauge: V: 4.218, I: -0.076, T: 16.54, 
    [00:08:43.928,039] <inf> nept_fuel_gauge: SoC: 96.83, TTE: nan, TTF: 422
    [00:08:48.933,746] <inf> nept_fuel_gauge: V: 4.218, I: -0.077, T: 16.44, 
    [00:08:48.933,776] <inf> nept_fuel_gauge: SoC: 96.85, TTE: nan, TTF: 421
    [00:08:53.939,453] <inf> nept_fuel_gauge: V: 4.213, I: -0.079, T: 16.54, 
    [00:08:53.939,514] <inf> nept_fuel_gauge: SoC: 96.88, TTE: nan, TTF: 422
    [00:08:58.945,190] <inf> nept_fuel_gauge: V: 4.218, I: -0.076, T: 16.44, 
    [00:08:58.945,220] <inf> nept_fuel_gauge: SoC: 96.90, TTE: nan, TTF: 418
    [00:09:03.950,927] <inf> nept_fuel_gauge: V: 4.218, I: -0.076, T: 16.44, 
    [00:09:03.950,958] <inf> nept_fuel_gauge: SoC: 96.93, TTE: nan, TTF: 416
    [00:09:08.956,665] <inf> nept_fuel_gauge: V: 4.218, I: -0.072, T: 16.54, 
    [00:09:08.956,695] <inf> nept_fuel_gauge: SoC: 96.95, TTE: nan, TTF: 411
    [00:09:13.962,371] <inf> nept_fuel_gauge: V: 4.218, I: -0.074, T: 16.44, 
    [00:09:13.962,402] <inf> nept_fuel_gauge: SoC: 96.98, TTE: nan, TTF: 412
    [00:09:18.968,109] <inf> nept_fuel_gauge: V: 4.218, I: -0.070, T: 16.44, 
    [00:09:18.968,139] <inf> nept_fuel_gauge: SoC: 97.00, TTE: nan, TTF: 406
    [00:09:23.973,846] <inf> nept_fuel_gauge: V: 4.218, I: -0.070, T: 16.44, 
    [00:09:23.973,876] <inf> nept_fuel_gauge: SoC: 97.02, TTE: nan, TTF: 405
    [00:09:28.979,583] <inf> nept_fuel_gauge: V: 4.218, I: -0.069, T: 16.44, 
    [00:09:28.979,614] <inf> nept_fuel_gauge: SoC: 97.05, TTE: nan, TTF: 403
    [00:09:33.985,321] <inf> nept_fuel_gauge: V: 4.218, I: -0.070, T: 16.44, 
    [00:09:33.985,351] <inf> nept_fuel_gauge: SoC: 97.07, TTE: nan, TTF: 403
    [00:09:38.991,058] <inf> nept_fuel_gauge: V: 4.218, I: -0.071, T: 16.44, 
    [00:09:38.991,088] <inf> nept_fuel_gauge: SoC: 97.09, TTE: nan, TTF: 402
    [00:09:43.996,765] <inf> nept_fuel_gauge: V: 4.218, I: -0.068, T: 16.44, 
    [00:09:43.996,795] <inf> nept_fuel_gauge: SoC: 97.12, TTE: nan, TTF: 398
    [00:09:49.002,471] <inf> nept_fuel_gauge: V: 4.218, I: -0.064, T: 16.44, 
    [00:09:49.002,502] <inf> nept_fuel_gauge: SoC: 97.14, TTE: nan, TTF: 392
    [00:09:54.008,178] <inf> nept_fuel_gauge: V: 4.218, I: -0.068, T: 16.44, 
    [00:09:54.008,209] <inf> nept_fuel_gauge: SoC: 97.16, TTE: nan, TTF: 395
    [00:09:59.013,916] <inf> nept_fuel_gauge: V: 4.218, I: -0.067, T: 16.44, 
    [00:09:59.013,946] <inf> nept_fuel_gauge: SoC: 97.18, TTE: nan, TTF: 393
    [00:10:04.019,653] <inf> nept_fuel_gauge: V: 4.218, I: -0.065, T: 16.44, 
    [00:10:04.019,683] <inf> nept_fuel_gauge: SoC: 97.20, TTE: nan, TTF: 389
    [00:10:09.025,360] <inf> nept_fuel_gauge: V: 4.218, I: -0.060, T: 16.44, 
    [00:10:09.025,390] <inf> nept_fuel_gauge: SoC: 97.22, TTE: nan, TTF: 382
    [00:10:14.031,097] <inf> nept_fuel_gauge: V: 4.218, I: -0.063, T: 16.44, 
    [00:10:14.031,127] <inf> nept_fuel_gauge: SoC: 97.24, TTE: nan, TTF: 385
    [00:10:19.036,834] <inf> nept_fuel_gauge: V: 4.218, I: -0.062, T: 16.44, 
    [00:10:19.036,865] <inf> nept_fuel_gauge: SoC: 97.27, TTE: nan, TTF: 383
    [00:10:24.042,572] <inf> nept_fuel_gauge: V: 4.218, I: -0.064, T: 16.44, 
    [00:10:24.042,602] <inf> nept_fuel_gauge: SoC: 97.29, TTE: nan, TTF: 384
    [00:10:29.048,309] <inf> nept_fuel_gauge: V: 4.223, I: -0.062, T: 16.44, 
    [00:10:29.048,339] <inf> nept_fuel_gauge: SoC: 97.31, TTE: nan, TTF: 380
    [00:10:34.054,016] <inf> nept_fuel_gauge: V: 4.218, I: -0.062, T: 16.44, 
    [00:10:34.054,046] <inf> nept_fuel_gauge: SoC: 97.33, TTE: nan, TTF: 379
    [00:10:39.059,722] <inf> nept_fuel_gauge: V: 4.218, I: -0.060, T: 16.44, 
    [00:10:39.059,753] <inf> nept_fuel_gauge: SoC: 97.35, TTE: nan, TTF: 375
    [00:10:44.065,429] <inf> nept_fuel_gauge: V: 4.218, I: -0.060, T: 16.34, 
    [00:10:44.065,460] <inf> nept_fuel_gauge: SoC: 97.37, TTE: nan, TTF: 374
    [00:10:49.071,136] <inf> nept_fuel_gauge: V: 4.218, I: -0.059, T: 16.44, 
    [00:10:49.071,166] <inf> nept_fuel_gauge: SoC: 97.39, TTE: nan, TTF: 371
    [00:10:54.076,843] <inf> nept_fuel_gauge: V: 4.218, I: -0.057, T: 16.34, 
    [00:10:54.076,873] <inf> nept_fuel_gauge: SoC: 97.41, TTE: nan, TTF: 368
    [00:10:59.082,550] <inf> nept_fuel_gauge: V: 4.223, I: -0.056, T: 16.44, 
    [00:10:59.082,580] <inf> nept_fuel_gauge: SoC: 97.42, TTE: nan, TTF: 366
    [00:11:04.088,256] <inf> nept_fuel_gauge: V: 4.218, I: -0.058, T: 16.44, 
    [00:11:04.088,317] <inf> nept_fuel_gauge: SoC: 97.44, TTE: nan, TTF: 369
    [00:11:09.093,994] <inf> nept_fuel_gauge: V: 4.218, I: -0.056, T: 16.44, 
    [00:11:09.094,024] <inf> nept_fuel_gauge: SoC: 97.45, TTE: nan, TTF: 366
    [00:11:09.098,205] <inf> nept_tApplication: Battery Charged
    [00:11:09.098,205] <inf> nept_tApplication: Application State: Sleep

    Here's the log for charging from 93% up to 100(ish)%

    It gets up to 97.45% then stops charging. I guess it's hitting the current threshold in constant voltage mode and switching off charging, but why is it only at ~98% and not 100%?

    The LED status error was something on my end, it looks like the charge complete event from the NPM1300 does actually trigger, so don't worry about that bit.

    I am using the battery NTC, but temps look ok from what i've seen.

    Could you explain the purpose of the cap on VBat, is this likely to lead to unstable battery readings if not present?

    Regards
    Robert

  • Can you re-initialize the fuel gauge after charging is completed? You can use the charge complete event from the NPM1300 to trigger the fuel gauge re-initialization. (nrf_fuel_gauge_init)

    In future NCS update we are trying to address this fuel gauge re-initialization from the library itself after charging completed event.

    The VBAT cap is there it helps to avoid transients for ex. when taking fuel gauge battery measurements.

Reply
  • Can you re-initialize the fuel gauge after charging is completed? You can use the charge complete event from the NPM1300 to trigger the fuel gauge re-initialization. (nrf_fuel_gauge_init)

    In future NCS update we are trying to address this fuel gauge re-initialization from the library itself after charging completed event.

    The VBAT cap is there it helps to avoid transients for ex. when taking fuel gauge battery measurements.

Children
Related