DFU over UART

Hi,

I'm using nrf connect SDK 2.3.0  with custom board, Now, I would like to be able to upgrade the firmware of the board in future, The DFU procedure should be performed over UART.

Hardware setup :- UART pins(rx) of a board (with nrf52833 soc) is connected to laptop via UART TTL converter(COM7 port)

I was able locate this document online, make the necessary modifications, and installed the mcumgr module using the go module.

However, commands are not working, if i give this command "mcumgr --conntype serial --connstring "COM7,baud=115200" echo hello"  it's returning with "NMP TIMEOUT"

And this is my prj.confg file

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
# Enable the UART driver
CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_UARTE0=y
CONFIG_SERIAL=y
CONFIG_GPIO=y
CONFIG_I2C=y
CONFIG_I2C_NRFX=y
CONFIG_CBPRINTF_FP_SUPPORT=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_NVS=y
CONFIG_LOG_MODE_IMMEDIATE=n
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Can I suggest that you do Serial recovery from the bootloader instead?
    See Serial Recovery.

    If you want to do it from the apllicaiton, you can have a look at the SMP Server sample or my unofficial MCUBoot SMP simple sample

    Regards,
    Sigurd Hellesvik

  • Hi, 

    I tried the your sample with "Hello world" application, I'm not able add "CONFIG_MCUMGR_TRANSPORT_UART=y and

    CONFIG_MCUMGR_GRP_IMG=y" in prj.config instead I added "CONFIG_MCUMGR_SMP_UART=y" and build it.
    However, the command "mcumgr --conntype serial --connstring "COM7" echo hello"   is not retuning "hello" and not getting timeout as error aswell, it just gives empty line like this
    "PS C:\hello_world> mcumgr --conntype serial --connstring "COM7" echo hello

    PS C:\hello_world> mcumgr --conntype serial --connstring "COM7" echo hello

    PS C:\hello_world>"

    I read somewhere like mcumgr uses uart0 for the image transfer, if that the case also custom board pins are as per the device tree file.
    prj.config file for your ref
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    # nothing here
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_MCUMGR=y
    # CONFIG_MCUMGR_TRANSPORT_UART=y
    # CONFIG_MCUMGR_GRP_IMG=y
    CONFIG_MCUMGR_SMP_UART=y
    # CONFIG_MCUMGR_TRANSPORT_UART dependencies
    CONFIG_BASE64=y
    # CONFIG_MCUMGR_GRP_IMG dependencies
    CONFIG_FLASH=y
    CONFIG_IMG_MANAGER=y
    # CONFIG_IMG_MANAGER dependencies
    CONFIG_STREAM_FLASH=y
    # CONFIG_MCUMGR dependencies
    CONFIG_NET_BUF=y
    CONFIG_ZCBOR=y
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Where might it be going wrong?

  • Theja said:
    I tried the your sample with "Hello world" application, I'm not able add "CONFIG_MCUMGR_TRANSPORT_UART=y and

    Which sample? I sent 3 samples.

    Theja said:
    However, the command "mcumgr --conntype serial --connstring "COM7" echo hello"   is not retuning "hello" and not getting timeout as error aswell, it just gives empty line like this

    Echo is part of the OS Management group, so you must enable  CONFIG_MCUMGR_GRP_OS.

  • Thank you for your support, it's working after adding
    "CONFIG_MCUMGR_CMD_IMG_MGMT=y and CONFIG_MCUMGR_CMD_OS_MGMT=y"

    I also wanted to send a hex file rather than a bin file, but I tried using "zephyr.hex" and it didn't work. Could you please advise me?

  • Theja said:
    I also wanted to send a hex file rather than a bin file, but I tried using "zephyr.hex" and it didn't work. Could you please advise me?

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/services/device_mgmt/mcumgr.html:

    "mcumgr does not understand .hex files, when uploading a new image always use the .bin file."