nRF5 SDK for Mesh v4.1.0
Serial example
This example is not supported by the nRF52810 SoC.

This example implements the serial interface for the mesh stack. It can be used unaltered as connectivity firmware for mesh devices. You can also modify the example to provide additional functionality.

Table of contents

Serial interface initialization

The example shows how to initialize and use the serial interface. To initialize the serial interface, only two API calls are required:

The nrf_mesh_serial_init() API initializes the serial bearer interface, and the nrf_mesh_serial_enable() API sends the SERIAL_OPCODE_EVT_DEVICE_STARTED event over the serial interface to notify the external host that the device is ready to accept serial commands.

Offloading feature

This example demonstrates how to offload certain mesh-related tasks to the external host using a serial interface, which improves the performance of the mesh stack. The ECDH operations used in the provisioning process are a suitable candidate for such offloading.

The ECDH offloading allows the device to take advantage of the more powerful processor of the host to perform ECDH operations during provisioning.

The offloading is enabled by calling mesh_opt_prov_ecdh_offloading_set with enabled=true.

When this offloading is enabled, the serial interface sends the SERIAL_OPCODE_EVT_PROV_ECDH_REQUEST event to the host processor with the public and private keys. The host processor then performs the ECDH shared secret calculation and sends the calculated value back using the SERIAL_OPCODE_CMD_PROV_ECDH_SECRET serial command.


Setup

You can find the source code of the serial example in the following folder: <InstallFolder>/examples/serial


Testing the example

To test the serial example:

  1. Build the example by following the instructions in Building the mesh stack.
  2. Program the board by following the instructions in Running examples.
  3. When the the serial example is running, start testing it using the Interactive PyACI. Refer to the Interactive PyACI documentation for details.

Documentation feedback | Developer Zone | Subscribe | Updated