MPSL timeslot

This sample demonstrates how to use Multiprotocol Service Layer and basic MPSL Timeslot functionality.

Overview

The sample opens a timeslot session and starts requesting timeslots when a key is pressed in the terminal.

  • If ‘a’ is pressed, the callback for the first timeslot requests a new timeslot.

  • If ‘b’ is pressed, the callback for the first timeslot ends the timeslot.

The first timeslot is always of type ‘earliest’. Any following timeslots are of type ‘normal’. In each timeslot callback, the signal type of the callback is posted to a message queue. A separate thread reads the message queue and prints the timeslot signal type. The timeslot session is closed when any key is pressed in the terminal.

Requirements

The sample supports any one of the following development kits:

Hardware platforms

PCA

Board name

Build target

nRF5340 DK

PCA10095

nrf5340dk_nrf5340

nrf5340dk_nrf5340_cpunet

nRF52840 DK

PCA10056

nrf52840dk_nrf52840

nrf52840dk_nrf52840

nRF52 DK

PCA10040

nrf52dk_nrf52832

nrf52dk_nrf52832

Note

For nRF5340 DK, this sample is only supported on the network core (nrf5340dk_nrf5340_cpunet), and the nRF5340: Empty firmware for application core sample must be programmed to the application core.

Building and Running

This sample can be found under samples/mpsl/timeslot in the nRF Connect SDK folder structure.

See Building and programming a sample application for information about how to build and program the application.

Testing

After programming the sample to your board, test it by performing the following steps:

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

  2. Follow the instructions in the terminal to open a session and start requesting timeslots. The terminal then prints the signal type for each timeslot callback:

    • If you press ‘a’, the timeslot callback requests a new timeslot. Observe that Timeslot start is printed until the session is closed.

    • If you press ‘b’, the timeslot callback ends the timeslot. Observe that only one Timeslot start is printed, followed by a Session idle.

  3. Press any key to close the session. Observe that Session closed is printed.

Dependencies

This sample uses the following sdk-nrfxlib libraries:

In addition, it uses the following Zephyr libraries:

  • include/console.h

  • Kernel Services:

    • include/kernel.h

    • include/irq.h

  • include/sys/printk.h

  • include/zephyr/types.h