IPC service

The IPC service sample demonstrates the functionality of the IPC service.

Overview

The sample application tests throughput of the IPC service with available backends. Currently, the sample supports the following backends:

Each core periodically prints out data throughput in bytes per second.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Board target

nRF54H20 DK

PCA10175

nrf54h20dk

nrf54h20dk/nrf54h20/cpuapp

nRF5340 DK

PCA10095

nrf5340dk

nrf5340dk/nrf5340/cpuapp

Configuration

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

Both application and network core send data to each other in the time interval specified by the CONFIG_APP_IPC_SERVICE_SEND_INTERVAL option. You can change the value and observe how the throughput on each core changes.

Note

Increasing the time interval to send data on one core, decreases the reading speed on the other core.

Configuration options

Check and configure the following Kconfig options:

CONFIG_APP_IPC_SERVICE_SEND_INTERVAL - Time interval to send data through the IPC service

The sample configuration defines the time interval to send data packages through IPC service in µs. Since the kernel timeout has a 1 ms resolution, this value is rounded off. If the value is lesser than 1000 µs, use k_busy_wait() instead of k_msleep() function.

Building and running

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

To build the sample, follow the instructions in Configuring and 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.

nRF5340 DK

You can build the sample using either the RPMsg or ICMSG backend. For the default RPMsg backend, use the following command:

west build -p -b nrf5340dk/nrf5340/cpuapp

For the ICMSG backend, use the following command:

west build -p -b nrf5340dk/nrf5340/cpuapp -T sample.ipc.ipc_service.nrf5340dk_icmsg_default .

A set of overlays is available for the sample to verify the throughput when only one core is sending the data. Use these overlays when building the IPC sample to test the following scenarios:

  • Either the network or application core is sending data through the IPC service using RPMsg:

    west build -p -b nrf5340dk/nrf5340/cpuapp -T sample.ipc.ipc_service.nrf5340dk_rpmsg_cpuapp_sending .
    west build -p -b nrf5340dk/nrf5340/cpuapp -T sample.ipc.ipc_service.nrf5340dk_rpmsg_cpunet_sending .
    
  • Either the network or application core is sending data through the IPC service using the ICMsg backend backend:

    west build -p -b nrf5340dk/nrf5340/cpuapp -T sample.ipc.ipc_service.nrf5340dk_icmsg_cpuapp_sending .
    west build -p -b nrf5340dk/nrf5340/cpuapp -T sample.ipc.ipc_service.nrf5340dk_icmsg_cpunet_sending .
    

nRF54H20 DK

To build the sample to test IPC between the application and radio domains using the default ICMsg with dynamically allocated buffers backend backend, use the following command:

west build -p -b nrf54h20dk/nrf54h20/cpuapp

To build the sample to test IPC between the application and PPR core using the ICMsg backend backend, use the following command:

west build -p -b nrf54h20dk/nrf54h20/cpuapp -T sample.ipc.ipc_service.nrf54h20dk_cpuapp_cpuppr_icmsg .

Note

Programming the nRF54H20 SoC can sometimes fail due to conflicts in the resource configuration. This can happen if, for example, an application programmed to the nRF54H20 SoC configured the UICRs for one or more cores in a way that is incompatible with the configuration required by the application you are trying to program on the SoC.

To fix this error and erase the UICR for the application core, run the following command:

nrfutil device recover --core Application

If your sample also uses the radio core, you must also erase the UICRs for the radio core. To erase the UICR for the radio core, run the following command:

nrfutil device recover --core Network

For more information on the command, run:

nrfutil device recover --help

You can then run west flash to program your application.

Testing

In the default configuration, both application and network cores periodically print out the receiving speed of data that was sent by the other core.

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, nRF Connect Serial Terminal). See Testing and optimization for the required settings and steps.

  2. Reset the kit.

  3. Observe the console output for both cores:

  • For the application core, the output is similar to the following one:

    *** Booting Zephyr OS build v3.0.99-ncs1  ***
    IPC-service nrf5340dk/nrf5340/cpuapp demo started
    Δpkt: 9391 (100 B/pkt) | throughput: 7512800 bit/s
    Δpkt: 9389 (100 B/pkt) | throughput: 7511200 bit/s
    Δpkt: 9388 (100 B/pkt) | throughput: 7510400 bit/s
    Δpkt: 9390 (100 B/pkt) | throughput: 7512000 bit/s
    Δpkt: 9396 (100 B/pkt) | throughput: 7516800 bit/s
    
  • For the network core, the output is similar to the following one:

    *** Booting Zephyr OS build v3.0.99-ncs1  ***
    IPC-service nrf5340dk/nrf5340/cpunet demo started
    Δpkt: 6665 (100 B/pkt) | throughput: 5332000 bit/s
    Δpkt: 6664 (100 B/pkt) | throughput: 5331200 bit/s
    Δpkt: 6658 (100 B/pkt) | throughput: 5326400 bit/s
    Δpkt: 6665 (100 B/pkt) | throughput: 5332000 bit/s
    Δpkt: 6671 (100 B/pkt) | throughput: 5336800 bit/s
    

Dependencies

The sample uses the following Zephyr subsystems:

  • include/ipc/ipc_service.h

  • Logging