VPR offloading

The VPR offloading sample demonstrates how to use the VPR core (PPR or FLPR) to offload the application core.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Board target

nRF54LV10 DK

PCA10188

nrf54lv10dk

nrf54lv10dk/nrf54lv10a/cpuapp

nRF54LM20 DK

PCA10184

nrf54lm20dk

nrf54lm20dk/nrf54lm20a/cpuapp

nRF54L15 DK

PCA10156

nrf54l15dk

nrf54l15dk/nrf54l15/cpuapp

nRF54H20 DK

PCA10175

nrf54h20dk

nrf54h20dk/nrf54h20/cpuapp

Overview

You can use VPR cores to offload background tasks from the application core. This reduces both the CPU load on the main core and the overall power consumption. VPR cores execute code from RAM, which means non-volatile memory (NVM) does not need to be woken up. On the nRF54H20 SoC, PPR runs in the low-power domain clocked at 16 MHz, so the power savings can be significant compared to the application core running at 320 MHz. However, the VPR code space is limited, so it requires a lightweight offloading framework.

The sample demonstrates a lightweight framework for offloading tasks to the VPR core. To keep the memory footprint small, the VPR core runs with a reduced configuration. For example, the CONFIG_MULTITHREADING Kconfig option is disabled (see Operation without Threads for details about the limitations). With this setup, the VPR code easily fits into 32 kB of RAM, including shared RAM for IPC communication

Depending on the configuration, modules can be executed on the application core or the VPR core. If the VPR core is the executor, the application core communicates with it through the IPC service. The sample periodically reports the CPU load of the application core.

Offloaded modules

The sample implements two modules that can be offloaded:

  • LED control - Blinks the LED using a specific pattern.

  • Temperature monitor - Periodically reads the temperature from a sensor and reports when it exceeds the defined range. It also periodically reports the average temperature. The module can use the LPS22HH sensor. If the sensor is not detected, SPI transfers are still performed but with random values. The module uses the NRFX_SPIM driver in blocking mode since the transfers are very short.

Example performance results

The following table shows the results of offloading in a scenario where both modules run for 2.5 seconds followed by a 0.5-second sleep. The temperature monitor performs an SPI transfer every 1 millisecond. The LED control module is blinking the LED0 using various patterns. Results include CPU load on the application core and average current.

Target

No offloading

Offloading

nRF54H20

3.2 %, 126 µA

0.1 %, 71 µA

nRF54L15

3.0 %, 146 µA

0.1 %, 125 µA

nRF54LM20A

3.3 %, 217 µA

0.0 %, 217 µA

nRF54LV10A

3.3 %, 228 µA

0.0 %, 194 µA

User interface

LED0:

It is controlled by the LED control module on VPR core and it blinks in various patterns (short, long, medium blink). Pattern is changed after each 0.5-second sleep.

Configuration

See Configuring and building for information about how to permanently or temporarily change the configuration.

Sample can be configured with or without offloading.

The sample supports the following configurations defined in the sample.yaml file:

Configuration

Description

sample.vpr_offloading.local

Runs all modules on the application core without offloading.

sample.vpr_offloading.flpr

Offloads modules to the FLPR core.

sample.vpr_offloading.ppr

Offloads modules to the PPR core.

Building and running

This sample can be found under samples/peripheral/vpr_offloading 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, test it by performing the following steps:

  1. Connect to the kit with a terminal emulator (for example, the Serial Terminal app). See Testing and optimization for the required settings and steps.

  2. Reset the kit.

  3. Observe the console output of the application core which reports average temperature and CPU load.

  4. Observe LED0 blinking in various patterns.

Dependencies

The sample uses the following Zephyr subsystems: