FOTA with OTBR and UDP

Hi all,

I'm trying to set up MCUMGR on 54L15, such that it can receive images from my border router when they're in the same Thread network. 

I read that we can upload images from our raspi given the IP address and port to send to.I think I've generated the signed dfu zips successfully, and I have set up the mcumgr command on the pi. Shown here:

>> `mcumgr --conntype udp --connstring [fdb4:4ee4:da2a:6d93:0:ff:fe00:6c00]:1337 image upload dfu/ot-light-base.signed.bin`

However, the upload progress never makes it past 0%. I'm thinking maybe I'm missing configurations in my project? I added more configurations (starting at line 56 in the code block below) related to MCUMGR transport with UDP, but when I run the program now, it halts whenever the Thread instance attaches to a network, and it shows an error related to SMP UDP?

CONFIG_APP_LIGHTS=y
# Network shell comment out to remove CLI functionality 
CONFIG_SHELL=y
CONFIG_OPENTHREAD_SHELL=y
CONFIG_SHELL_ARGC_MAX=26
CONFIG_SHELL_CMD_BUFF_SIZE=416

# Enable OpenThread features set
CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER=y

CONFIG_NET_L2_OPENTHREAD=y
CONFIG_NETWORKING=y

#THREAD CONFIGS
CONFIG_OPENTHREAD=y
CONFIG_OPENTHREAD_SRP_CLIENT=y
CONFIG_OPENTHREAD_FTD=y
CONFIG_OPENTHREAD_JOINER=y
CONFIG_OPENTHREAD_COMMISSIONER=y

CONFIG_SERIAL=n

#RTT CONFIG (Comment out if uart is on)
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_SHELL_BACKEND_RTT=y
CONFIG_UART_CONSOLE=n
CONFIG_SHELL_BACKEND_SERIAL=n

#UART CONFIGS FOR RECEIVING COMMANDS (Comment out if rtt is on)
# CONFIG_LOG=y
# CONFIG_SERIAL=y
# CONFIG_UART_CONSOLE=y
# CONFIG_SHELL_BACKEND_SERIAL=y
# CONFIG_USE_SEGGER_RTT=n
# CONFIG_RTT_CONSOLE=n
# CONFIG_SHELL_BACKEND_RTT=n

CONFIG_OPENTHREAD_OPERATIONAL_DATASET_AUTO_INIT=n
CONFIG_OPENTHREAD_DEBUG=y
CONFIG_OPENTHREAD_LOG_LEVEL_DEBG=y

# Storage
CONFIG_SETTINGS_ZMS=y
CONFIG_ZMS=y
CONFIG_NVS=n
CONFIG_SPI_NOR=n
CONFIG_PWM=y

CONFIG_MAIN_STACK_SIZE=6144
CONFIG_SHELL_STACK_SIZE=1024

CONFIG_BOOTLOADER_MCUBOOT=y      # Enables image format compatibility

CONFIG_MCUMGR_TRANSPORT_UDP=y
CONFIG_MCUMGR_TRANSPORT_UDP_IPV6=y
CONFIG_NET_BUF=y
CONFIG_ZCBOR=y
CONFIG_CRC=y
CONFIG_MCUMGR=y

CONFIG_NET_SOCKETS=y
CONFIG_STATS=y
CONFIG_IMG_MANAGER=y
CONFIG_MCUMGR_GRP_IMG=y
CONFIG_MCUMGR_GRP_OS=y
CONFIG_MCUMGR_GRP_STAT=y
CONFIG_STREAM_FLASH=y

CONFIG_FLASH=y
CONFIG_FLASH_MAP=y

I'm thinking maybe enabling CONFIG_MCUMGR_SMP_UDP would change the situation here. I've read documentations on CONFIG_MCUMGR_SMP_UDP, but when I attempt to configure it in prj.conf, it is not recognized as a symbol, I failed to find more information as to why it isn't recognized here.

I would appreciate any help going forward. I'm not finding any recent discussions on this method of FOTA; the ones that I can find are all from long ago and many sample programs and pages have deprecated.

Best regards,

Allan

Parents
  • Hello,

    Are you checking the logs from the nRF side? If so, what do they say? Is there any log that confirms the mcumgr command has been received?
    I wanted to know which side is failing, the Pi or the nRF54.

    Kind regards,
    Abhijith

  • Hi,

    Sorry, could you please clarify what you mean by the nRF side? 

    I have always been looking at the debug logs from the RTT. In the example below, I'm sending the image list to port 8341 (instead of the correct MCUMGR_TRANSPORT_UDP_PORT, this is the port where I have a handler that prints the bytes received. I have trouble logging the outputs of another port) :

    I believe the above is an indication of the pi and nRF54L15 are connected, and I'm able to catch the bytes sent to me this way, but just at the wrong port. 

    I have configured CONFIG_MCUMGR_TRANSPORT_UDP_PORT=8905, but when I specify this port while sending the mcumgr command, it also gives NMP timeout and the progress bar is stuck at 0% during the upload. Is there any code that I need to set up manually for this to work out? So far I've only enabled the relevant configurations and haven't written extra code related to FOTA. 

    Best regards,

    Allan

  • Hello,

    Sorry for getting back to you late. It's summer vacation here in Norway, and many are on vacation, which has created some delay in getting back to this.

    Allan-led said:
    , could you please clarify what you mean by the nRF side? 

    Coming back to the issue:

    By nRF side, I mean the logs from the nRF54L15 to see whether it is responding to the mcumgr commands. How do you open the socket? Are you using smp_udp_open()? Can you add a log after calling smp_udp_open()?

    I am not sure if using the Kconfig option MCUMGR_TRANSPORT_UDP_PORT can be used to configure the port number. In this example, it is done at runtime not via Kconfig, and the application has been built with the appropriate UDP transport like CONFIG_MCUMGR_TRANSPORT_UDP_IPV4 or CONFIG_MCUMGR_TRANSPORT_UDP_IPV6.

    Kind Regards,

    Abhijith

Reply
  • Hello,

    Sorry for getting back to you late. It's summer vacation here in Norway, and many are on vacation, which has created some delay in getting back to this.

    Allan-led said:
    , could you please clarify what you mean by the nRF side? 

    Coming back to the issue:

    By nRF side, I mean the logs from the nRF54L15 to see whether it is responding to the mcumgr commands. How do you open the socket? Are you using smp_udp_open()? Can you add a log after calling smp_udp_open()?

    I am not sure if using the Kconfig option MCUMGR_TRANSPORT_UDP_PORT can be used to configure the port number. In this example, it is done at runtime not via Kconfig, and the application has been built with the appropriate UDP transport like CONFIG_MCUMGR_TRANSPORT_UDP_IPV4 or CONFIG_MCUMGR_TRANSPORT_UDP_IPV6.

    Kind Regards,

    Abhijith

Children
  • Hi, 

    Totally understandable, I was also on a break yesterday so I was unable to get back to you. 

    Here is a relevant chunk of code and log from my nRF54l15 development board. I call smp_udp_open from the state changed callback function; when my device attaches to the network as a child, it will call smp_udp_open.

    However, I am unsure of what exactly is producing the error. If the function did not return successfully, then according to my code it should log "Error initializing SMP UDP transport with smp_udp_open()"? However, this log is not present, this may be an indication that smp_udp_open probably returned successfully. We are however, seeing another error that was not manually written by me, I am suspecting that one of the configurations in prj.conf lead to this. The full list of my configurations are attached below for your reference. Thanks!

    #
    # Copyright (c) 2020 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    CONFIG_APP_LIGHTS=y
    # Network shell comment out to remove CLI functionality 
    CONFIG_SHELL=y
    CONFIG_OPENTHREAD_SHELL=y
    CONFIG_SHELL_ARGC_MAX=26
    CONFIG_SHELL_CMD_BUFF_SIZE=416
    
    # Enable OpenThread features set
    CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER=y
    
    CONFIG_NET_L2_OPENTHREAD=y
    CONFIG_NETWORKING=y
    
    #THREAD CONFIGS
    CONFIG_OPENTHREAD=y
    CONFIG_OPENTHREAD_SRP_CLIENT=y
    CONFIG_OPENTHREAD_FTD=y
    CONFIG_OPENTHREAD_JOINER=y
    CONFIG_OPENTHREAD_COMMISSIONER=y
    
    CONFIG_SERIAL=n
    
    #RTT CONFIG (Comment out if uart is on)
    CONFIG_LOG=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    CONFIG_SHELL_BACKEND_RTT=y
    CONFIG_UART_CONSOLE=n
    CONFIG_SHELL_BACKEND_SERIAL=n
    
    #UART CONFIGS FOR RECEIVING COMMANDS (Comment out if rtt is on)
    # CONFIG_LOG=y
    # CONFIG_SERIAL=y
    # CONFIG_UART_CONSOLE=y
    # CONFIG_SHELL_BACKEND_SERIAL=y
    # CONFIG_USE_SEGGER_RTT=n
    # CONFIG_RTT_CONSOLE=n
    # CONFIG_SHELL_BACKEND_RTT=n
    
    CONFIG_OPENTHREAD_OPERATIONAL_DATASET_AUTO_INIT=n
    CONFIG_OPENTHREAD_DEBUG=y
    CONFIG_OPENTHREAD_LOG_LEVEL_DEBG=y
    
    # Storage
    CONFIG_SETTINGS_ZMS=y
    CONFIG_ZMS=y
    CONFIG_NVS=n
    CONFIG_SPI_NOR=n
    CONFIG_PWM=y
    
    CONFIG_MAIN_STACK_SIZE=6144
    CONFIG_SHELL_STACK_SIZE=2048
    CONFIG_MCUMGR_TRANSPORT_UDP_STACK_SIZE=2048
    
    CONFIG_BOOTLOADER_MCUBOOT=y      # Enables image format compatibility
    
    CONFIG_MCUMGR_TRANSPORT_UDP=y
    CONFIG_MCUMGR_TRANSPORT_UDP_IPV6=y
    CONFIG_MCUMGR_TRANSPORT_UDP_PORT=8905
    
    CONFIG_NET_BUF=y
    CONFIG_ZCBOR=y
    CONFIG_CRC=y
    CONFIG_MCUMGR=y
    
    CONFIG_NET_SOCKETS=y
    CONFIG_STATS=y
    CONFIG_IMG_MANAGER=y
    CONFIG_MCUMGR_GRP_IMG=y
    CONFIG_MCUMGR_GRP_OS=y
    CONFIG_MCUMGR_GRP_STAT=y
    CONFIG_STREAM_FLASH=y
    
    CONFIG_MCUMGR_MGMT_NOTIFICATION_HOOKS=y
    CONFIG_MCUMGR_GRP_IMG_STATUS_HOOKS=y
    CONFIG_MCUMGR_GRP_IMG_IMAGE_SLOT_STATE_HOOK=y
    CONFIG_MCUMGR_GRP_IMG_IMAGE_SLOT_STATE_STATES=20
    CONFIG_THREAD_MONITOR=y
    CONFIG_MCUMGR_GRP_OS_TASKSTAT=y
    CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=2475
    CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS=y
    CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=4608
    
    CONFIG_FLASH=y
    CONFIG_FLASH_MAP=y
    
    
    

    Best regards,

    Allan

  • Hi,

    Just another update, I tried sending more packets over to my device. All of them have timed out. But I also verified that connection to the device should okay, as shown below:

    _@raspi5-2:~ $ mcumgr --conntype udp --connstring [fdb4:4ee4:da2a:6d93:0:ff:fe00:3000]
    :1337 echo hello
    Error: NMP timeout
    _@raspi5-2:~ $ mcumgr --conntype udp --connstring [fdb4:4ee4:da2a:6d93:0:ff:fe00:3000]:1337 image list
    Error: NMP timeout
    _@raspi5-2:~ $ nc -6 -u -v fdb4:4ee4:da2a:6d93:0:ff:fe00:3000 1337
    Connection to fdb4:4ee4:da2a:6d93:0:ff:fe00:3000 1337 port [udp/*] succeeded!

    The dump here also suggests that the packets were indeed delivered, but there has been no response:

    I read in another thread that we might need to enable certain configurations to ensure the handlers are enabled, such that my device will respond. I believe I have all the necessary configurations, here is my prj.conf file again, for reference:

    #
    # Copyright (c) 2020 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    # Network shell comment out to remove CLI functionality 
    CONFIG_SHELL=y
    CONFIG_OPENTHREAD_SHELL=y
    CONFIG_SHELL_ARGC_MAX=26
    CONFIG_SHELL_CMD_BUFF_SIZE=416
    
    # Enable OpenThread features set
    CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER=y
    
    CONFIG_NET_L2_OPENTHREAD=y
    CONFIG_NETWORKING=y
    
    #THREAD CONFIGS
    CONFIG_OPENTHREAD=y
    CONFIG_OPENTHREAD_SRP_CLIENT=y
    CONFIG_OPENTHREAD_FTD=y
    CONFIG_OPENTHREAD_JOINER=y
    CONFIG_OPENTHREAD_COMMISSIONER=y
    
    CONFIG_SERIAL=n
    
    #RTT CONFIG (Comment out if uart is on)
    CONFIG_LOG=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    CONFIG_SHELL_BACKEND_RTT=y
    CONFIG_UART_CONSOLE=n
    CONFIG_SHELL_BACKEND_SERIAL=n
    
    #UART CONFIGS FOR RECEIVING COMMANDS (Comment out if rtt is on)
    # CONFIG_LOG=y
    # CONFIG_SERIAL=y
    # CONFIG_UART_CONSOLE=y
    # CONFIG_SHELL_BACKEND_SERIAL=y
    # CONFIG_USE_SEGGER_RTT=n
    # CONFIG_RTT_CONSOLE=n
    # CONFIG_SHELL_BACKEND_RTT=n
    
    CONFIG_OPENTHREAD_OPERATIONAL_DATASET_AUTO_INIT=n
    CONFIG_OPENTHREAD_DEBUG=y
    CONFIG_OPENTHREAD_LOG_LEVEL_DEBG=y
    
    # Storage
    CONFIG_SETTINGS_ZMS=y
    CONFIG_ZMS=y
    CONFIG_NVS=n
    CONFIG_SPI_NOR=n
    CONFIG_PWM=y
    
    CONFIG_MAIN_STACK_SIZE=6144
    CONFIG_SHELL_STACK_SIZE=2048
    CONFIG_MCUMGR_TRANSPORT_UDP_STACK_SIZE=2048
    
    CONFIG_BOOTLOADER_MCUBOOT=y      # Enables image format compatibility
    
    CONFIG_MCUMGR_TRANSPORT_UDP=y
    CONFIG_MCUMGR_TRANSPORT_UDP_IPV6=y
    CONFIG_NET_UDP=y
    CONFIG_NET_IPV6=y
    CONFIG_NET_SOCKETS_SOCKOPT_TLS=y
    CONFIG_MCUMGR_TRANSPORT_UDP_PORT=1337
    
    CONFIG_NET_BUF=y
    CONFIG_ZCBOR=y
    CONFIG_CRC=y
    CONFIG_MCUMGR=y
    
    CONFIG_NET_SOCKETS=y
    CONFIG_STATS=y
    CONFIG_IMG_MANAGER=y
    CONFIG_MCUMGR_SMP_COMMAND_STATUS_HOOKS=y
    CONFIG_MCUMGR_GRP_IMG=y
    CONFIG_MCUMGR_GRP_OS=y
    CONFIG_MCUMGR_GRP_STAT=y
    CONFIG_STREAM_FLASH=y
    CONFIG_MCUBOOT_IMG_MANAGER=y
    
    CONFIG_MCUMGR_MGMT_NOTIFICATION_HOOKS=y
    CONFIG_MCUMGR_GRP_IMG_STATUS_HOOKS=y
    CONFIG_MCUMGR_GRP_IMG_IMAGE_SLOT_STATE_HOOK=y
    CONFIG_MCUMGR_GRP_IMG_IMAGE_SLOT_STATE_STATES=20
    CONFIG_MCUMGR_LOG_LEVEL_DBG=y
    
    CONFIG_THREAD_MONITOR=y
    CONFIG_MCUMGR_GRP_OS_TASKSTAT=y
    CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=1024
    CONFIG_NET_BUF_DATA_SIZE=128
    CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS=y
    CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=4608
    
    CONFIG_FLASH=y
    CONFIG_FLASH_MAP=y
    
    
    
    

    Best regards,

    Allan 

Related