CHARGER and Events
The CHARGER and Events sample demonstrates how to control a PMIC charger and receive events using npmx drivers.
Requirements
The sample supports the following development kits:
Hardware platforms |
PCA |
Board name |
Build target |
---|---|---|---|
PCA10095 |
|
||
PCA10056 |
|
The sample also requires an nPM1300 EK.
Overview
This sample uses CHARGER and Events drivers to do the following:
Set the charger’s basic configuration.
Register the events from the device.
Wiring
Connect the TWI interface between the chosen DK and the nPM1300 EK as in the following table:
nPM1300 EK pins
nRF5340 DK pins
nRF52840 DK pins
GPIO0
P1.10
P1.10
SDA
P1.02
P0.26
SCL
P1.03
P0.27
VOUT2 & GND
External supply (P21)
External supply (P21)
Make the following connections on the DK:
Set the SW9 nRF power source switch to VDD.
Set the SW10 VEXT → nRF switch to ON.
Make the following connections on the nPM1300 EK:
On the P18 pin header, connect VOUT2 and VDDIO pins with a jumper.
On the P2 pin header, connect VBAT and VBATIN pins with a jumper.
On the P17 pin header, connect all LEDs with jumpers.
On the P13 pin header, connect VSET1 and GND pins with a jumper.
On the P14 pin header, connect VSET2 and RSET2 pins with a jumper.
Connect a suitable battery to the J2 connector.
Connect a USB power supply to the J3 connector.
Configuration
See Application Configuration for information about how to permanently or temporarily change the configuration.
Configuration options
Check and configure the following sample-specific Kconfig options:
- CONFIG_CHARGING_CURRENT
This option changes the battery charging current.
- CONFIG_TERMINATION_VOLTAGE
This option changes the battery termination voltage.
- CONFIG_BATTERY_VOLTAGE_THRESHOLD_1
This option changes the first battery threshold voltage to be detected.
- CONFIG_BATTERY_VOLTAGE_THRESHOLD_2
This option changes the second battery threshold voltage to be detected.
Building and running
This sample can be found under samples/charger_and_events
in the npmx-zephyr repository folder structure.
To build the sample with zephyr, follow the steps listed on the Building an Application page in Zephyr documentation.
Testing
After programming the sample to your development kit, complete the following steps to test it:
Connect the kit to the computer using a USB cable. The kit is assigned a COM port (Windows) or ttyACM device (Linux), which is visible in the Device Manager.
Connect to the kit with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.
Connect and disconnect the battery and the USB-C cable to see various event messages. Battery charging status will also be printed.
Dependencies
This sample uses drivers from npmx.