LDSW

The LDSW (Load Switches) sample demonstrates how to control PMIC load switches with the use of npmx drivers.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Build target

nRF5340 DK

PCA10095

nrf5340dk_nrf5340

nrf5340dk_nrf5340_cpuapp

nRF52840 DK

PCA10056

nrf52840dk_nrf52840

nrf52840dk_nrf52840

The sample also requires an nPM1300 EK.

Overview

This sample uses the LDSW driver to control the enable mode for a load switch either through the software or GPIOs.

Wiring

  1. Connect the TWI interface between the chosen DK and the nPM1300 EK as in the following table:

    nPM1300 EK connections.

    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)

  2. Make the following connections on the chosen DK:

    • Set the SW9 nRF power source switch to VDD.

    • Set the SW10 VEXT → nRF switch to ON.

  3. Make the following connections on the nPM1300 EK:

    • On the P18 pin header, connect VOUT2 and VDDIO 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 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 to specify which testcase you want to run:

CONFIG_TESTCASE_SW_ENABLE

This sample configuration enables controlling LDSWs through the software. In an infinite loop, switches are enabled and disabled alternately, with a delay of 5 seconds in between.

CONFIG_TESTCASE_GPIO_ENABLE

This sample configuration enables controlling LDSWs through GPIOs. GPIO1 and GPIO2 are switched to the input mode, and selected GPIO pins (NPMX_LDSW_GPIO_1 and NPMX_LDSW_GPIO2) are configured to control the switches. When you change the input states of the selected GPIOs, you should see voltage changes in both 1 and 2 load switches’ outputs.

Note

Only one Kconfig option may be enabled at a time.

Building and running

This sample can be found under samples/ldsw 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:

  1. 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.

  2. Connect to the kit with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.

  3. Connect a multimeter to LSOUT1 and LSOUT2.

  4. For the CONFIG_TESTCASE_GPIO_ENABLE testcase, do the following:

    1. Connect the GPIO1 EK pin to GND and the GPIO2 EK pin to VDD.

    2. Check if output voltage on the LSOUT1 EK pin is 0.0 V and on the LSOUT2 EK pin is 1.7 V.

    3. Connect the GPIO1 EK pin to VDD and the GPIO2 EK pin to GND.

    4. Check if output voltage on the LSOUT1 EK pin is 3.3 V and on the LSOUT2 EK pin is 0.0 V.

Dependencies

This sample uses drivers from npmx.