Firmware Update for nRF5340 (Zephyr, Dual Core) via Bluetooth DFU

Hello everyone

I need help. I have a custom board that uses the nRF5340 microcontroller. I am using the Zephyr OS and nRF Connect SDK Toolchain v2.9.0. How do I update my microcontroller's firmware over Bluetooth (preferably for both cores)? Do I need to use MCUBoot? How do I configure it?

My firmware is configured for an nRF5340 microcontroller with a dual-core architecture:

  • Application Core: Executes the main application firmware.
  • Network Core: Exclusively manages the Bluetooth stack via HCI IPC (Host Controller Interface over Inter-Processor Communication)

I tried to follow a tutorial that suggested to insert the lines "CONFIG_BOOTLOADER_MCUBOOT=y" and "CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y" in the prj.conf file but it doesn't work. When connecting to my device with the nrf Connect App I don't see the DFU button on the top right.

The fact that I am using the internal oscillator, could that be a problem? Indeed, to make the Bluetooth stack work, I had to modify the v2.9.0/zephyr/samples/bluetooth/hci_ipc/prj.conf file and add the following lines:

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

as well as having to add the lines to my project's prj.conf file.

This is the contents of my prj.conf file:

CONFIG_CPP=y
CONFIG_STD_CPP11=y
CONFIG_CPP_EXCEPTIONS=y

CONFIG_SOC_ENABLE_LFXO=n
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

# Stack Bluetooth
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="AH03"
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_DEVICE_NAME_MAX=65
CONFIG_BT_DIS_PNP=n

CONFIG_BT_SMP=y
CONFIG_BT_SIGNING=y
CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
CONFIG_BT_SETTINGS=y
CONFIG_BT_PRIVACY=n

CONFIG_BT_ATT_PREPARE_COUNT=5

CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251

CONFIG_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y

# Inter-Processor Communication (IPC)
CONFIG_IPC_SERVICE=y
CONFIG_IPC_SERVICE_BACKEND_RPMSG=y
CONFIG_MBOX=y
CONFIG_MBOX_NRFX_IPC=y

# Debugging & Logging (RTT - Real-Time Terminal)
CONFIG_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_LOG=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_PRINTK=n
CONFIG_LOG_BUFFER_SIZE=4096
CONFIG_LOG_MODE_IMMEDIATE=y

CONFIG_GPIO=y
CONFIG_PWM=y
CONFIG_I2C=y
CONFIG_ADC=y

CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_MAIN_STACK_SIZE=4096

CONFIG_BT_HCI_ACL_FLOW_CONTROL=y

CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y

Below is the structure of my project:

Can anyone help me?

thanks

UPDATE: I tried following this tutorial: https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-9-bootloaders-and-dfu-fota/topic/exercise-5-fota-over-bluetooth-low-energy/

I added the line SB_CONFIG_BOOTLOADER_MCUBOOT=y to my sysbuild.conf file:

my sysbuild.conf file:

SB_CONFIG_NETCORE_APP_UPDATE=y
SB_CONFIG_NETCORE_HCI_IPC=y

SB_CONFIG_BOOTLOADER_MCUBOOT=y

I removed the line CONFIG_BOOTLOADER_MCUBOOT=y from my prj.conf file and kept the line CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y. The project compiles without errors, but the firmware no longer works. If I start debugging, the code "gets lost" somewhere, and I don't understand why.

JLinkGDBServerCLexe: SEGGER J-Link GDB Server V8.12b Command Line Version
JLinkGDBServerCLexe: 
JLinkGDBServerCLexe: JLinkARM.dll V8.12b (DLL compiled Jan 15 2025 13:47:14)
JLinkGDBServerCLexe: 
JLinkGDBServerCLexe: -----GDB Server start settings-----
JLinkGDBServerCLexe: GDBInit file:                  none
JLinkGDBServerCLexe: GDB Server Listening port:     49377
JLinkGDBServerCLexe: SWO raw output listening port: 2332
JLinkGDBServerCLexe: Terminal I/O port:             2333
JLinkGDBServerCLexe: Accept remote connection:      yes
JLinkGDBServerCLexe: Generate logfile:              off
JLinkGDBServerCLexe: Verify download:               off
JLinkGDBServerCLexe: Init regs on start:            off
JLinkGDBServerCLexe: Silent mode:                   on
JLinkGDBServerCLexe: Single run mode:               on
JLinkGDBServerCLexe: Target connection timeout:     0 ms
JLinkGDBServerCLexe: ------J-Link related settings------
JLinkGDBServerCLexe: J-Link Host interface:         USB
JLinkGDBServerCLexe: J-Link script:                 none
JLinkGDBServerCLexe: J-Link settings file:          none
JLinkGDBServerCLexe: ------Target related settings------
JLinkGDBServerCLexe: Target device:                 nrf5340_xxaa_app
JLinkGDBServerCLexe: Target device parameters:      none
JLinkGDBServerCLexe: Target interface:              SWD
JLinkGDBServerCLexe: Target interface speed:        4000kHz
JLinkGDBServerCLexe: Target endian:                 little
JLinkGDBServerCLexe: 
=thread-group-added,id="i1"
=cmd-param-changed,param="pagination",value="off"
0x00006c0c in ?? ()


[New Thread 1576352692]

Related