Cellular: SMP Server
This sample is a reference implementation to use MCUboot recovery mode or serial SMP server mode for external image update.
Requirements
The sample supports the following development kits:
Hardware platforms |
PCA |
Board name |
|
|---|---|---|---|
PCA10090 |
|
Overview
The sample supports the mcuboot shell commands for checking image information and a new activated image will be confirmed automatically.
Connecting nRF9160 SiP to nRF52840 SoC
On the nRF9160 DK, you can configure the hardware interface between the nRF9160 SiP and nRF52840 SoC to use serial connection. In this sample, the nRF9160 SiP uses UART2 and nRF52840 SoC uses UART1. The reset line is needed for activating MCUboot recovery mode.
/*
| nRF9160 | | nRF52840 |
| UART 2 | | UART1 |
| RTS P0.17 | -- nRF interface line 0 -- | P0.17 CTS |
| P0.18 | -- nRF interface line 1 -- | P0.20 |
| P0.19 | -- nRF interface line 2 -- | P0.15 |
| RX P0.21 | -- nRF interface line 3 -- | P0.22 TX |
| CTS P0.22 | -- nRF interface line 4 -- | P1.04 RTS |
| TX P0.23 | -- nRF interface line 5 -- | P1.02 RX |
| COEX0 | -- nRF interface line 6 -- | P1.13 |
| COEX1 | -- nRF interface line 7 -- | P1.11 |
| COEX2 | -- nRF interface line 8 -- | P1.15 |
| P0.24 | -- nRF interface line 9 -- | P0.18 (nRESET) | (in v0.14.0 or later)
*/
SMP and MCUmgr protocols are used to communicate over UART.
Configuration
See Configuring and building for information about how to permanently or temporarily change the configuration.
Configuration files
The sample supports UART1 connection for the nRF9160 DK with or without MCUboot recovery mode. The nRF52840 SoC needs to enable UART1 on the devicetree using the following configuration files and recovery mode overlay files:
overlay-serial.conf- Defines the MCUmgr server configuration with SMP serial transport for UART1. This requires an additional devicetree overlay filenrf9160dk_nrf52840_mcumgr_srv.overlay.nrf9160dk_nrf52840_recovery.overlay- Devicetree overlay file that enables resetting of the MCUboot recovery mode.
MCUboot configuration
The MCUboot configuration is enabled automatically at build.
Building
This sample can be found under samples/cellular/smp_svr/ in the nRF Connect SDK folder structure.
For more security, it is recommended to use the */ns variant of the board target (see the Requirements section above.)
When built for this variant, the sample is configured to compile and run as a non-secure application using security by separation.
Therefore, it automatically includes Trusted Firmware-M that prepares the required peripherals and secure services to be available for the application.
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
Before building the sample, make sure the PROG/DEBUG switch is set to nRF52.
MCUboot recovery mode
west build --pristine -b nrf9160dk/nrf52840 -- -DEXTRA_DTC_OVERLAY_FILE="nrf9160dk_nrf52840_recovery.overlay"
MCUmgr server image management
west build --pristine -b nrf9160dk/nrf52840 -- -DEXTRA_CONF_FILE="overlay-serial.conf" -DEXTRA_DTC_OVERLAY_FILE="nrf9160dk_nrf52840_mcumgr_srv.overlay"
Testing
After programming the sample to your development kit, complete the following steps to test it:
Connect the kit to the computer using a USB cable. The kit is assigned a serial port. Serial ports are referred to as COM ports on Windows, /dev/ttyACM devices on Linux, and /dev/tty devices on macOS. To list Nordic Semiconductor devices connected to your computer together with their serial ports, open a terminal and run the
nrfutil device listcommand. Alternatively, check your operating system’s device manager or its equivalent.Connect to the kit with a terminal emulator (for example, the Serial Terminal app). See Testing and optimization for the required settings and steps.
Observe that the sample starts.
Open a terminal connection for the nRF52840 SoC (VCOM1), in Linux
/dev/ttyACM1, and call themcubootcommand on the shell. You can see the following output on the terminal:uart:~$ mcuboot swap type: none confirmed: 1 primary area (2): version: 1.0.0+0 image size: 70136 magic: unset swap type: none copy done: unset image ok: unset failed to read secondary area (5) header: -5 uart:~$
Dependencies
The sample uses the following secure firmware component: