Simultaneous updates for both cores of the nRF5340

Lesson 9 – Exercise 5 of the nRF Connect SDK Intermediate course will work for the nRF5340 to update only the application core. However, as we learned from the theory on nRF5340 DFU, we often want to update both cores at the same time. This is known as simultaneous FOTA.

Exercise steps

If you have not already done so, read the theory on nRF5340 DFU before starting. This will explain the concepts behind how this works.

This sub-exercise uses the l9_e5_sol as a base. Next we are adding configuration for external flash. The process of configuring external flash was described in Exercise 3. Because of all the partitions needed, external flash is useful to give us extra space available for the application.

6. Configuring external flash

6.1 Create overlay files that configure external flash for app and MCUBoot to both app.overlay and sysbuild/mcuboot.overlay containing:

/* STEP 6.1  - Add external flash to applciation */
/ {
	chosen {
		nordic,pm-ext-flash = &mx25r64;
	};
};
Devicetree

6.2 Enable QSPI by creating sysbuild/mcuboot.conf which contains:

# STEP 6.2 - MCUboot should use external flash
CONFIG_NORDIC_QSPI_NOR=y
CONFIG_BOOT_MAX_IMG_SECTORS=256
Kconfig

6.3 Configure project to use external flash for DFU by modifying sysbuild.conf

# STEP 6.3 - Configure project to use external flash for DFU
SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
Kconfig

7. Enabling DFU on both cores.

To enable simultaneous DFU, the project needs partitioning and configurations for both the application and the netcore image. In this exercise network core runs ipc_radio.

Recall

As we have learned, Sysbuild can overwrite configurations for other images. Because of this, we only need to configure the Sysbuild to enable simultaneous multi-image FOTA for the nRF5340. This is the power of Sysbuild!

7.1 Observe in Kconfig.sysbuild, ipc_radio is enabled for the network core. These options were described in Lesson 3 of the nRF Connect SDK Fundamentals course.

7.2 Enable the b0n bootloader for the network core in sysbuild.conf:

 # STEP 7.2 - Add b0n image
SB_CONFIG_SECURE_BOOT_NETCORE=y
Kconfig

7.3 As explained earlier, we need some extra partitions for this. Set the following to automatically configure those partitions. In sysbuild.conf:

# STEP 7.3 - Set up multiple partitions
SB_CONFIG_MCUBOOT_UPDATEABLE_IMAGES=2
Kconfig

7.4 Add support to the network core for DFU. This in sysbuild.conf:

# STEP 7.4 - Add support to netcore for DFU
SB_CONFIG_NETCORE_APP_UPDATE=y
Kconfig

7.5 Add support to mcuboot for updating two cores simultaneously

# STEP 7.5 - Add support to mcuboot for updating
# two cores simultaneously
SB_CONFIG_MCUBOOT_NRF53_MULTI_IMAGE_UPDATE=y
Kconfig

7.6 Last but not least, we need to disable rollback (the “test” feature). This is not supported for simultaneous FOTA. In sysbuild.conf:

# STEP 7.6 - Simultaneous FOTA does not support rollback
SB_CONFIG_MCUBOOT_MODE_OVERWRITE_ONLY=y
Kconfig

8. Build and flash the application to the nRF5340 DK.

9. Update both the application core and the network core image on the device.

We now need to change both our application core image and our network core image.

9.1 For the application core, change LED blinking period in main.c file and the version in VERSION file, then build the project again. This is to generate a new file for DFU, with something different which we can observe.

#define RUN_LED_BLINK_INTERVAL  200
C
VERSION_MAJOR = 3
VERSION_MINOR = 0
PATCHLEVEL = 0
VERSION_TWEAK = 0
EXTRAVERSION =
C

9.2 For the network core, enable logging so we can see the change after FOTA.

Add the following to sysbuild/ipc_radio.conf:

# Step 9.2 - Enable logs in netcore so we can verify the update
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_LOG=y
Kconfig

More on this

If you need to modify radio stack more than just enabling console you can find its source under location:

<NCS_PATH>/nrf/application/ipc_radio

9.3 Build the project again (pristine build)

To update both cores, follow the same procedure as it was described in the previous part of the exercise, but with dfu_application.zip instead of zephyr.signed.bin. Make sure to select Confirm only. The reason is that the network core doesn’t support test mode (see step 7.3).

Note

dfu_application.zip is automatically generated when SB_CONFIG_DFU_ZIP_NET and SB_CONFIG_DFU_ZIP_APP symbols are enabled. These symbols are enabled by default for the configuration we have set above, so we did not have to set them explicitly. It is a Nordic-specific file that contains signed .bin files for the project’s DFU. The nRF Device Manager/nRF Connect for Mobile apps or nRF Cloud decompresses the ZIP file.

In this exercise, dfu_applications.zip contains the signed ipc_radio.bin for the network core, l9_e5.signed.bin for the application core, and a manifest file containing some metadata.

Now you can see logs from the network core

The new application version can be checked in the Device Manager app same as we have done before.

Register an account
Already have an account? Log in
(All fields are required unless specified optional)

  • 8 or more characters
  • Upper and lower case letters
  • At least one number or special character

Forgot your password?
Enter the email associated with your account, and we will send you a link to reset your password.