Bluetooth: Host for nRF RPC Bluetooth Low Energy

The nRF RPC Host sample demonstrates the Bluetooth® Low Energy (LE) stack with the Remote procedure call library (nRF RPC) library that exposes the stack’s interface to another device or CPU using Remote Procedure Calls (RPC). On an nRF53 Series device, this sample is supposed to run on the network core and it provides the Bluetooth LE functionality for the application core.

Requirements

The sample supports the following development kit:

Hardware platforms

PCA

Board name

Board target

nRF5340 DK

PCA10095

nrf5340dk

nrf5340dk/nrf5340/cpunet

Overview

Note

Currently, only a subset of Zephyr’s Bluetooth APIs is available over Bluetooth nRF RPC. For more details about the limitations, see the API documentation of the Bluetooth nRF RPC library.

The host (network core) is running the full Bluetooth LE stack. It receives serialized function calls that it decodes and executes, then sends response data to the client (application core).

When the sample starts, it displays the welcome prompt “Starting nRF RPC bluetooth host”.

Building and running

You must program this sample to the nRF5340 network core.

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

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.

Debug build

To build the sample with a debugging configuration, use the -DEXTRA_CONF_FILE=overlay-debugging.conf' flag in your build.

See Providing CMake options for instructions on how to add this option to your build. For example, when building on the command line, enter the following command:

west build samples/bluetooth/rpc_host -- -DEXTRA_CONF_FILE=overlay-debugging.conf

Example build

The recommended way of building this sample is to use Sysbuild, building the sample with the same Bluetooth configuration as the application core sample.

To enable the firmware, use the sysbuild configuration SB_CONFIG_NETCORE_RPC_HOST. You also need to use the nordic-bt-rpc snippet, see snippets/nordic-bt-rpc/README.rst.

See Configuring and building for information about how to configure a sample.

  1. Start the toolchain environment in a terminal window.

  2. Build the sample with the same Bluetooth configuration as the application core sample. For more details, see: Bluetooth Low Energy Remote Procedure Call.

  3. Build the Bluetooth: Peripheral UART on the application core.

  4. In the Peripheral UART sample directory, run the following command:

    west build -b nrf5340dk/nrf5340/cpuapp -S nordic-bt-rpc -- -DSB_CONFIG_NETCORE_RPC_HOST=y
    

You can take it as an example on how to create configuration for your own application.

Testing

After programming the example build to your development kit, complete the following steps to test it:

  1. Connect the dual core development kit to the computer using a USB cable. The development 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, nRF Connect Serial Terminal). See Testing and optimization for the required settings and steps.

  3. Reset the development kit.

  4. Observe that the terminal connected to the network core displays “Starting nRF RPC Bluetooth host”.

  5. On the terminal connected to the application core, you can observe your Bluetooth application is running.

Dependencies

This sample uses the following nRF Connect SDK library:

It uses the following sdk-nrfxlib library: