Timer

The Timer sample demonstrates how to control the PMIC TIMER peripheral 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 Timer driver to configure and run a timer. The TIMER peripheral is configured to generate an interrupt after ~400 ms. If the interrupt from the PMIC does not occur within 500 ms, an error message is printed to the console.

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.

Building and running

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

Dependencies

This sample uses drivers from npmx.