MPSL timeslot
This sample demonstrates how to use Multiprotocol Service Layer and basic MPSL Timeslot functionality.
Requirements
The sample supports any one of the following development kits:
Hardware platforms |
PCA |
Board name |
|
|---|---|---|---|
nRF54LV10 DK |
PCA10188 |
|
|
nRF54LS05 DK |
PCA10214 |
nrf54ls05dk |
|
PCA10184 |
|
||
PCA10156 |
|
||
PCA10156 |
|
||
PCA10156 |
|
||
PCA10175 |
|
||
PCA10095 |
|
||
PCA10040 |
|
||
PCA10056 |
|
Note
For the 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.
For the nRF54H20 DK, this sample is only supported on the radio core (nrf54h20dk/nrf4h20/cpurad).
Overview
The sample opens a timeslot session and starts requesting timeslots when a key is pressed in the terminal.
If
ais pressed, the callback for the first timeslot requests a new timeslot.If
bis 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.
Upon reception of the timeslot start signal, mpsl timer0 is configured to be triggered before the timeslot ends.
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.
Note
For the nRF52 and nRF53 Series mpsl_timer0 is the timer0 instance.
For the nRF54L Series mpsl_timer0 is the timer10 instance.
For the nRF54H Series mpsl_timer0 is the timer020 instance.
Note
For the nRF54H20, if you want to use MPSL_TIMESLOT_HFCLK_CFG_NO_GUARANTEE then you must request the HFXO earlier using the mpsl_clock_hfclk_request() function.
Building and running
This sample can be found under samples/mpsl/timeslot 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:
Connect to the kit with a terminal emulator (for example, the Serial Terminal app). See Testing and optimization for the required settings and steps.
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 thatTimeslot startandTimer0 signalare printed until the session is closed.If you press
b, the timeslot callback ends the timeslot. Observe thatTimeslot startandTimer0 signalare printed, followed bySession idle.
Dependencies
This sample uses the following sdk-nrfxlib libraries:
In addition, it uses the following Zephyr libraries:
include/console.h-
include/kernel.hinclude/irq.h
include/sys/printk.hinclude/zephyr/types.h