Difference between BLE DFU and UART DFU

Hi I am testing DFU using NRF52840 DK board.
I am using nrf connect sdk v2.2.0
I am developing code with zephyr rtos using vscode
Firmware is updated using the SMP protocol using the MCUMGR library.

BLE dfu was performed using nrf connect app, and uart dfu was performed using Auterm.exe.

When the firmware update is completed, BLE dfu reboots itself and, upon bootloading, copies the standby firmware image with the new firmware to the active firmware image and saves it.
When I tested it, I confirmed that when I update the firmware using ble dfu, it automatically changes to the new firmware code, and even if I turn the board off and on, it works with the new firmware.

The uart dfu does not change to the new firmware after the firmware update is completed.
If I forcibly turn off and turn on the DK board, it is changed to the new firmware.
But the bigger problem here is that if you turn the dk board off and on again, it returns to the previous firmware.

I am testing using the peripheral_hr example
Below is the code I used

I added it to main(void)
    
os_mgmt_register_group();

    img_mgmt_register_group();
    stat_mgmt_register_group();
    err = smp_bt_register();
    if (err) {
    printk("SMP BT register failed (err: %d)", err);
    }
I added it to prj.conf
# Enable mcumgr.
CONFIG_MCUMGR=y

# Some command handlers require a large stack.
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Ensure an MCUboot-compatible binary is generated.
CONFIG_BOOTLOADER_MCUBOOT=y

# Enable flash operations.
CONFIG_FLASH=y

# Required by the `taskstat` command.
CONFIG_THREAD_MONITOR=y

# Enable statistics and statistic names.
CONFIG_STATS=y
CONFIG_STATS_NAMES=y

# Enable most core commands.
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
CONFIG_MCUMGR_CMD_STAT_MGMT=y

# Allow for large Bluetooth data packets.
CONFIG_BT_L2CAP_TX_MTU=252
CONFIG_BT_BUF_ACL_RX_SIZE=256

# Enable the Bluetooth (unauthenticated) and shell mcumgr transports.
CONFIG_MCUMGR_SMP_BT=y
CONFIG_MCUMGR_SMP_BT_AUTHEN=n
# CONFIG_MCUMGR_SMP_SHELL=y
CONFIG_MCUMGR_SMP_UART=y

I think what I need to make uart dfu operate like ble dfu is CONFIG_MCUMGR_SMP_UART=y.
Is there any other code or anything else I need?

I would really appreciate it if you could help me.

Related