nPM2100: One button

The One button sample demonstrates how to support wake-up, shutdown, and user interactions through a single button connected to the nPM2100 PMIC.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Board target

nRF54LS05 DK

PCA10214

nrf54ls05dk

nrf54ls05dk/nrf54ls05b/cpuapp nrf54ls05dk/nrf54ls05a/cpuapp

nRF54L15 DK

PCA10156

nrf54l15dk

nrf54l15dk/nrf54l15/cpuapp

nRF5340 DK

PCA10095

nrf5340dk

nrf5340dk/nrf5340/cpuapp

nRF52840 DK

PCA10056

nrf52840dk

nrf52840dk/nrf52840

The sample also requires an nPM2100 Evaluation Kit (EK) that you need to connect to the development kit as described in Wiring.

Overview

The SHPHLD button of the nPM2100 EK controls the device state. The sample controls an LED and the power mode based on the button press duration.

The GPIO1 pin of the nPM2100 EK is configured as an interrupt output and used to signal button press events to the host.

Wiring

With this configuration, the nPM2100 EK is wired to supply power to the DK. This ensures that the TWI communication is at compatible voltage levels, and represents a realistic use case for the nPM2100 PMIC.

Note

To prevent leakage currents and program the DK, do not remove the USB connection.

Unplug the battery from the nPM2100 EK and set the DK power switch to “OFF” while applying the wiring. If you have issues communicating with the DK or programming it after applying the wiring, try to power cycle the DK and EK.

To connect your DK to the nPM2100 EK, complete the following steps:

  1. Prepare the DK for being powered by the nPM2100 EK:

    • Set switch SW9 (“nRF power source”) to position “VDD”.

    • Set switch SW10 (“VEXT -> VnRF”) to position “ON”.

  2. Connect the TWI interface and power supply between the chosen DK and the nPM2100 EK as described in the following table:

    nPM2100 EK connections.

    nPM2100 EK pins

    nRF52840 DK pins

    nRF5340 DK pins

    nRF54L Series DK pins

    SDA

    P0.26

    P1.02

    P1.11

    SCL

    P0.27

    P1.03

    P1.12

    GPIO1

    P1.12

    P1.12

    P1.08

    VOUT

    P21 External supply +

    P21 External supply +

    P6 VDDM current measure, VDD:nRF pin

    GND

    GND / P21 External supply -

    GND / P21 External supply -

    GND

  3. Make the following connections on the nPM2100 EK:

    • Remove the USB power supply from the J4 connector.

    • On the P6 pin header, connect pins 1 and 2 with a jumper.

    • On the BOOTMON pin header, select OFF with a jumper.

    • On the VSET pin header, select 3.0V with a jumper.

    • On the VBAT SEL switch, select VBAT position.

    • Connect a battery board to the BATTERY INPUT connector.

Note

When using the nRF54L15 DK, the nPM2100 GPIO1 interrupt pin assignment uses the BUTTON 2 pin of the DK.

Building and running

This sample can be found under samples/pmic/native/npm2100_one_button in the nRF Connect SDK folder structure.

To build the sample, follow the instructions in Building an application for your preferred building environment. See also Programming an application for programming steps and Testing and optimization for general information about testing and debugging in the nRF Connect SDK.

Note

When building repository applications in the SDK repositories, building with sysbuild is enabled by default. If you work with out-of-tree freestanding applications, you need to manually pass the --sysbuild parameter to every build command or configure west to always use it.

Testing

After programming the sample to your development kit, complete the following steps to test it:

  1. Connect the kit to the computer using a USB cable. The kit is assigned a serial port. Serial ports are referred to as COM ports on Windows, /dev/ttyACM devices on Linux, and /dev/tty devices on macOS. To list Nordic Semiconductor devices connected to your computer together with their serial ports, open a terminal and run the nrfutil device list command. Alternatively, check your operating system’s device manager or its equivalent.

  2. Connect to the kit with a terminal emulator (for example, the Serial Terminal app). See Testing and optimization for the required settings and steps.

If the initialization was successful, the terminal displays the following message with status information:

PMIC device ok

The following table describes the output and outcome of button presses:

Duration

Log output

Outcome

< 1 sec

Short press

Sample flashes LED at 5 Hz

1 - 5 sec

Medium press

Sample flashes LED at 1 Hz

5 - 10 sec

Ship mode…

nPM2100 enters ship mode (VOUT off)

> 10 sec

None

nPM2100 resets (VOUT briefly off)

Ship mode is the lowest power state of the nPM2100 PMIC. Entering it powers off the host SoC and you will lose connection to the shell interface. To exit the ship mode, press the SHPHLD button at least for one second.

A long press reset performs a full power cycle of the nPM2100 PMIC and resets all settings to powerup defaults. This will also power cycle the host SoC.

Dependencies

The sample uses the following Zephyr libraries: