Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions boards/shields/npm1300_ek/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,5 @@ Usage
*****

The shield can be used in any application by setting ``--shield npm1300_ek``
when invoking ``west build``. You can check :zephyr:code-sample:`npm1300_ek` for a
when invoking ``west build``. You can check :zephyr:code-sample:`npm13xx_ek` for a
comprehensive sample.

References
**********

TBC
5 changes: 5 additions & 0 deletions boards/shields/npm1304_ek/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2025 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

config SHIELD_NPM1304_EK
def_bool $(shields_list_contains,npm1304_ek)
30 changes: 30 additions & 0 deletions boards/shields/npm1304_ek/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.. _npm1304_ek:

nPM1304 EK
##########

Overview
********

The nPM1304 EK lets you test different functions and features of the nPM1304
Power Management Integrated Circuit (PMIC).

Requirements
************

The nPM1304 EK board is not a direct fit into an Arduino connector. However,
the Zephyr shield is expected to be connected to the Arduino shield connectors.
That is, you need to connect the I2C lines to the ``arduino_i2c`` bus. This allows to
use the shield with any host board that supports the Arduino connector.

Usage
*****

To use the shield in any application, build it with the following command:

.. zephyr-app-commands::
:board: your_board
:shield: npm1304_ek
:goals: build

For a comprehensive sample, refer to :zephyr:code-sample:`npm13xx_ek`.
86 changes: 86 additions & 0 deletions boards/shields/npm1304_ek/npm1304_ek.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Copyright (C) 2025 Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/

#include <dt-bindings/regulator/npm13xx.h>
#include <zephyr/dt-bindings/input/input-event-codes.h>

&arduino_i2c {
npm1304_ek_pmic: pmic@6b {
compatible = "nordic,npm1304";
reg = <0x6b>;

npm1304_ek_gpio: gpio-controller {
compatible = "nordic,npm1304-gpio";
gpio-controller;
#gpio-cells = <2>;
ngpios = <5>;
};

npm1304_ek_regulators: regulators {
compatible = "nordic,npm1304-regulator";

/* limits are set to min/max allowed values */
npm1304_ek_buck1: BUCK1 {
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <3300000>;
};

npm1304_ek_buck2: BUCK2 {
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <3300000>;
};

npm1304_ek_ldo1: LDO1 {
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <3300000>;
};

npm1304_ek_ldo2: LDO2 {
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <3300000>;
};
};

npm1304_ek_charger: charger {
compatible = "nordic,npm1304-charger";
term-microvolt = <4150000>;
term-warm-microvolt = <4000000>;
current-microamp = <4000>;
vbus-limit-microamp = <500000>;
thermistor-ohms = <10000>;
thermistor-beta = <3380>;
charging-enable;
};

npm1304_ek_buttons: buttons {
compatible = "gpio-keys";

pmic_button0: pmic_button_0 {
gpios = <&npm1304_ek_gpio 0 GPIO_ACTIVE_LOW>;
label = "Pmic button switch 0";
zephyr,code = <INPUT_KEY_0>;
};

pmic_button1: pmic_button_1 {
gpios = <&npm1304_ek_gpio 1 GPIO_ACTIVE_LOW>;
label = "Pmic button switch 1";
zephyr,code = <INPUT_KEY_1>;
};

pmic_button2: pmic_button_2 {
gpios = <&npm1304_ek_gpio 2 GPIO_ACTIVE_LOW>;
label = "Pmic button switch 2";
zephyr,code = <INPUT_KEY_2>;
};
};

npm1304_ek_leds: leds {
compatible = "nordic,npm1304-led";
nordic,led0-mode = "error";
nordic,led1-mode = "charging";
nordic,led2-mode = "host";
};
};
};
11 changes: 11 additions & 0 deletions boards/shields/npm1304_ek/shield.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
shield:
name: npm1304_ek
full_name: nPM1304 EK
vendor: nordic
supported_features:
- mfd
- input
- gpio
- led
- regulator
- sensor
1 change: 1 addition & 0 deletions doc/_scripts/redirects.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
('samples/sensor/max44009/README', 'samples/sensor/light_polling/README'),
('samples/sensor/wsen_hids/README', 'samples/sensor/sensor'),
('samples/sensor/wsen_itds/README', 'samples/sensor/sensor'),
('samples/shields/npm1300_ek/doc/index', 'samples/shields/npm13xx_ek/doc/index'),
('samples/subsys/video/capture/README', 'samples/drivers/video/capture/README'),
('samples/subsys/video/tcpserversink/README', 'samples/drivers/video/tcpserversink/README'),
('samples/subsys/video/video', 'samples/drivers/video/video'),
Expand Down
11 changes: 0 additions & 11 deletions samples/shields/npm1300_ek/CMakeLists.txt

This file was deleted.

71 changes: 0 additions & 71 deletions samples/shields/npm1300_ek/doc/index.rst

This file was deleted.

12 changes: 0 additions & 12 deletions samples/shields/npm1300_ek/sample.yaml

This file was deleted.

17 changes: 17 additions & 0 deletions samples/shields/npm13xx_ek/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

if(SHIELD STREQUAL "npm1300_ek")
set(EXTRA_DTC_OVERLAY_FILE npm1300.overlay)
elseif(SHIELD STREQUAL "npm1304_ek")
set(EXTRA_DTC_OVERLAY_FILE npm1304.overlay)
else()
message(FATAL_ERROR "either npm1300_ek or npm1304_ek must be selected with --shield")
endif()

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})

project(npm13xx_ek)
target_sources(app PRIVATE src/main.c)
10 changes: 10 additions & 0 deletions samples/shields/npm13xx_ek/boards/nrf52dk_nrf52832.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright (C) 2023 Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/

&i2c0_default {
group1 {
bias-pull-up;
};
};
110 changes: 110 additions & 0 deletions samples/shields/npm13xx_ek/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
.. zephyr:code-sample:: npm13xx_ek
:name: nPM13xx EK

Interact with an nPM1300 or nPM1304 PMIC using the shell interface and buttons.

Overview
********

This sample is provided for evaluation of :ref:`npm1300_ek` and :ref:`npm1304_ek`. The sample
demonstrates use of Dynamic Voltage Scaling (DVS) regulator API feature which allows to switch
between chosen voltage levels or regulator modes by toggling configured GPIOs with a single
regulator API call.

It also provides a shell interface to support the features of the nPM1300 and nPM1304 PMICs,
including:

- Regulators (BUCK1/2, LDO1/2)
- GPIO

Requirements
************

The shield needs to be wired to a host board featuring the Arduino I2C connector. PMIC's GPIO3 acts
as an interrupt output, pins GPIO1 and GPIO2 are configured to control regulator modes (controlled
by the MCU software through DVS).

In addition, PMIC's VDDIO pin should be connected to an appropriate voltage reference.

E.g. for an nRF52 Series DK the wiring is as follows:

+------------------+-------+-------+-------+-------+-------+-------+-----+
| nPM13xx EK pins | SDA | SCL | GPIO1 | GPIO2 | GPIO3 | VDDIO | GND |
+------------------+-------+-------+-------+-------+-------+-------+-----+
| nRF52 DK pins | P0.26 | P0.27 | P0.17 | P0.18 | P0.22 | VDD | GND |
+------------------+-------+-------+-------+-------+-------+-------+-----+

Building and Running
********************

The sample is designed so that it can run on any platform (references to host GPIOs connected to
the nPM13xx EK need to be updated in the ``npm13xx.overlay`` files to reflect chosen HW).

For example, when building for the nRF52 DK and the nPM1300 EK, the following command can be used:

.. zephyr-app-commands::
:zephyr-app: samples/shields/npm13xx_ek
:board: nrf52dk/nrf52832
:shield: npm1300_ek
:goals: build
:compact:

Testing
*******

After flashing the sample FW, you need to connect to the shell interface, where in case of
successful initialization you will see the nPM13xx PMIC status messages containing charger status
and battery voltage, current and temperature. Pressing and releasing the SHPHLD button on the EK
will generate interrupts and these events will also be printed in the shell.

Pressing a dedicated button on the host DK (Button 1 on an nRF52 Series DK) will cycle DVS states.

+-------------------------------------+----------------+---------------+---------------+
| **DVS state** (GPIO1 | GPIO2 level) | **BUCK2 mode** | **LDO1 mode** | **LDO2 mode** |
+-------------------------------------+----------------+---------------+---------------+
| **0** (HIGH | HIGH) | OFF | OFF | OFF |
+-------------------------------------+----------------+---------------+---------------+
| **1** (LOW | HIGH) | ON retention | OFF | OFF |
+-------------------------------------+----------------+---------------+---------------+
| **2** (HIGH | LOW) | OFF | ON | ON |
+-------------------------------------+----------------+---------------+---------------+
| **3** (LOW | LOW) | ON PWM | ON | ON |
+-------------------------------------+----------------+---------------+---------------+

.. note::
On an nRF52 Series DK, DVS pins are also used for the onboard LED1 and LED2, so you can observe
the DVS state pins visually: an LED lights up when the respective pin is LOW

Regulators
**********

The ``regulator`` shell interface provides several subcommand to test
the regulators embedded in the PMIC. Below you can find some command examples.

.. code-block:: console

# list all the supported voltages by BUCK1
uart:~$ regulator vlist BUCK1
1.000 V
1.100 V
...

.. code-block:: console

# enable BUCK2
uart:~$ regulator enable BUCK2
# disable BUCK2
uart:~$ regulator disable BUCK2

.. code-block:: console

# set BUCK2 voltage to exactly 2V
uart:~$ regulator vset BUCK2 2V
# obtain the actual BUCK1 configured voltage
uart:~$ regulator vget BUCK1
1.800 V
# set BUCK1 voltage to a value between 2.35V and 2.45V
uart:~$ regulator set BUCK1 2.35V 2.45V
# obtain the actual BUCK1 configured voltage
uart:~$ regulator get BUCK1
2.400 V
Loading
Loading