NHS31xx SW API
batimp: Battery impedance check module

Detailed Description

The Battery impedance check module provides a single API call to check the battery impedance by checking the voltage drop under different loads.

Operating principle
This module gradually activates extra current consumption in the NHS chip and observes if and when the VBAT voltage drops below 1.8V using the BOD HW block (see pmu_brown_out_detector_par).
The amount of extra current needed for VBAT to drop to 1.8V is inversely proportional to the battery impedance.

The extra current consumption is generated by sequentially activating the current dac of 1 or more of the PIO3, PIO7, PIO10 and PIO11 pins - the 4 high-source pads which have analog high current drive capabilities. See the iocon_currentdrive_anchor IOCON documentation.

Restrictions
  • The pins where the current drive mode will be enabled must be unconnected or pulled low at the time of the battery impedance check, so that no external current is drawn. Only the quiescent current is used to put more load on the battery
  • It is impossible for the chip to provide an estimate of the battery impedance, or the remaining battery capacity. Instead, it can check whether the current impedance causes a voltage drop to below the BOD detection point, given different loads. It is then up to the higher layers to interpret this and correlate it with information received from your battery supplier.
Diversity
This module supports diversity settings. It is expected that each application that uses this module includes it and configures the diversity settings of the module according to its specific needs. Check Diversity Settings for all diversity parameters.
Example
In its most effective form, all pins are free to be used by this module, and the battery impedance check can try out all possible combinations. A complete check will take a little over 35 milliseconds.
// Placed in app_sel.h
#define BATIMP_WAIT_TIME 1
#define BATIMP_USE_PIO3 1
#define BATIMP_USE_PIO7 1
#define BATIMP_USE_PIO10 1
#define BATIMP_USE_PIO11 1
// Placed in main.c
if (BatImp_Check() < 0) {
// Battery can still handle a load of more than 3.3 mA
}

Modules

 Diversity Settings
 

Functions

int BatImp_Check (void)
 

Function Documentation

◆ BatImp_Check()

int BatImp_Check ( void  )

Successively applies different settings to the analog current drive mode of the enabled high-source pads. Each iteration increases the load on the battery. When a BOD is detected, the operation stops. The returnvalue then reflects the load which triggered the BOD. During the check the VBAT voltage comparator is disabled to prevent battery disconnection. The original setting is restored at function exit.

Warning
This call is run synchronously, and will take a long time to complete. The exact amount depend on the number of pins assigned to this module, the battery impedance and maxCurrent value given, and the BOD detection time as set by BATIMP_WAIT_TIME.
See also
BATIMP_WAIT_TIME
Returns
  • If a negative number is returned, BOD was never triggered, indicating a low battery impedance.
  • Else, BOD was triggered. The value indicates the extra current that was drawn when BOD was triggered.
Warning
This check has a (small) negative impact on the battery. And, this check potentially can cause a reset.