Drastic Reduction in Firmware Update Speed with MCUboot in Serial Recovery Mode

I implemented MCUboot in Serial Recovery mode on a custom USB stick to enable firmware updates via MCUmgr. Initially, everything was working correctly, and the image transfer speed was high, with the entire update taking just over a minute. Over time, I made changes to the application firmware, assuming that the Serial Recovery part was complete. However, when retesting the update via MCUmgr, I discovered that the transfer speed had drastically decreased to just a few bytes per second, making the entire update process take over two hours.

The commands I’ve been using with MCUmgr have always been the same:

mcumgr conn add LABEL type="serial" connstring="COMx,baud=1000000,mtu=128"
mcumgr -c LABEL image upload Path\of\file\new_firmware.bin
mcumgr -c LABEL reset

I’ve tried changing the baud rate and MTU in the first command, but it doesn’t seem to make a difference.
Do you have any suggestions about what the issue might be?

  • I don't see any relevant differences between the 2 configurations:

    @@ -18,7 +18,7 @@
     #
     # MCUBoot settings
     #
    -CONFIG_SINGLE_APPLICATION_SLOT=y
    +# CONFIG_SINGLE_APPLICATION_SLOT is not set
     # CONFIG_BOOT_SIGNATURE_TYPE_NONE is not set
     CONFIG_BOOT_SIGNATURE_TYPE_RSA=y
     CONFIG_BOOT_SIGNATURE_TYPE_RSA_LEN=2048
    @@ -29,6 +29,13 @@
     # CONFIG_BOOT_HW_KEY is not set
     CONFIG_BOOT_VALIDATE_SLOT0=y
     CONFIG_BOOT_PREFER_SWAP_MOVE=y
    +# CONFIG_BOOT_SWAP_USING_SCRATCH is not set
    +# CONFIG_BOOT_UPGRADE_ONLY is not set
    +CONFIG_BOOT_SWAP_USING_MOVE=y
    +# CONFIG_BOOT_DIRECT_XIP is not set
    +# CONFIG_BOOT_RAM_LOAD is not set
    +# CONFIG_BOOT_BOOTSTRAP is not set
    +# CONFIG_BOOT_SWAP_SAVE_ENCTLV is not set
     CONFIG_BOOT_ENCRYPTION_SUPPORT=y
     # CONFIG_BOOT_ENCRYPT_IMAGE is not set
     CONFIG_BOOT_MAX_IMG_SECTORS=128
    @@ -54,6 +61,7 @@
     CONFIG_MCUBOOT_SERIAL=y
     CONFIG_BOOT_SERIAL_UART=y
     # CONFIG_BOOT_SERIAL_CDC_ACM is not set
    +# CONFIG_MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD is not set
     CONFIG_BOOT_SERIAL_UNALIGNED_BUFFER_SIZE=64
     CONFIG_BOOT_MAX_LINE_INPUT_LEN=128
     CONFIG_BOOT_LINE_BUFS=8
    @@ -72,6 +80,7 @@
     # end of Entrance methods
     
     CONFIG_BOOT_SERIAL_IMG_GRP_HASH=y
    +# CONFIG_BOOT_SERIAL_IMG_GRP_IMAGE_STATE is not set
     # CONFIG_BOOT_INTR_VEC_RELOC is not set
     CONFIG_UPDATEABLE_IMAGE_NUMBER=1
     CONFIG_BOOT_WATCHDOG_FEED=y
    @@ -2248,7 +2257,7 @@
     CONFIG_LINKER_ORPHAN_SECTION_WARN=y
     # CONFIG_LINKER_ORPHAN_SECTION_ERROR is not set
     CONFIG_HAS_FLASH_LOAD_OFFSET=y
    -CONFIG_FLASH_LOAD_SIZE=0xec000
    +CONFIG_FLASH_LOAD_SIZE=0x67000
     CONFIG_LD_LINKER_SCRIPT_SUPPORTED=y
     CONFIG_LD_LINKER_TEMPLATE=y
     # CONFIG_CMAKE_LINKER_GENERATOR is not set

    You could try enabling the CONFIG_BOOT_UPGRADE_ONLY setting to see if it makes any difference, but I have a feeling that this might not be directly related to the configuration settings. You mentioned earlier that  enabling CONFIG_MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD seemed to fix the issue for a while. Have you made sure to close any serial terminal (in vs code etc) that may be listening on this port?

Related