This example implements the serial interface for the Bluetooth mesh stack. It can be used unaltered as connectivity firmware for Bluetooth mesh devices. You can also modify the example to provide additional functionality.
Table of contents
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.
This example demonstrates how to offload certain Bluetooth-mesh-related tasks to the external host using a serial interface, which improves the performance of the Bluetooth 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.
You need one of the compatible development kits for this example. See Compatibility for more information.
You can find the source code of the serial example in the following folder: <InstallFolder>/examples/serial
To test the serial example: