Not able to update firmware over UART using MCUboot: flag shows pending

I tried to update firmware over UART (using MCUboot).

The flag shows test pending, and was able to test the application and provide expected output.

But was not able to "confirm image", it shows Error:NMP timeout, when the confirm image command is executed.

Thanks in advance

Parents
  • Hi,

    Did you ever restart your application during the DFU procedure?

    Do you use Serial Recovery or an SMP Server in the application? (See my unofficial tutorial on MCUboot to learn the difference)

    Regards,
    Sigurd Hellesvik

  • Hi  
    Yes I'm using a example  samples/subsys/mgmt/mcumgr/smp_svr  from NCS v2.2

    I executed commands as shown below:

    Case:1 (I did reset)

    mcumgr <connection string> image test <hash of slot-1 image>
    sudo mcumgr <connection string> reset
    After the test, it reverts back.

    Case:2
    And by using the command : 
    sudo mcumgr <connection string> image confirm , it works without reverting the images.

    So,

    1. What should be done in case 1, so that the image files are not reverted after reset.

    2. In case 2, how can I update with a new image again (for the 2nd time), because I assume the images are swapped in this case after 1st update and it no longer receives  mcumgr command. 

    It shows  Error:NMP timeout, when trying to execute mcumgr command.

  • This works fine on my end.

    Turns out that CONFIG_MCUBOOT_INDICATION_LED only works for Button mode, and is not supported for Wait mode.

    If you want to enable this for Wait mode, you can apply these changes  temporarily to MCUboot:

    diff --git a/boot/zephyr/main.c b/boot/zephyr/main.c
    index 2c5f9afd..3081f845 100644
    --- a/boot/zephyr/main.c
    +++ b/boot/zephyr/main.c
    @@ -620,9 +620,14 @@ void main(void)
          * some time, so it's better to reuse thistime to already receive the
          * initial mcumgr command(s) into our buffers
          */
    +
    +#ifdef CONFIG_MCUBOOT_INDICATION_LED
    +        gpio_pin_set_dt(&led0, 1);
    +#endif
         rc = boot_console_init();
         int timeout_in_ms = CONFIG_BOOT_SERIAL_WAIT_FOR_DFU_TIMEOUT;
         uint32_t start = k_uptime_get_32();
    +
     #endif
     
         FIH_CALL(boot_go, fih_rc, &rsp);
    @@ -646,6 +651,10 @@ void main(void)
             timeout_in_ms = 1;
         }
         boot_serial_check_start(&boot_funcs,timeout_in_ms);
    +
    +#ifdef CONFIG_MCUBOOT_INDICATION_LED
    +        gpio_pin_set_dt(&led0, 0);
    +#endif
     #endif
     
         if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
    

    Are you able to see that sys_reboot(SYS_REBOOT_COLD) works with these changes?

  •   Now the bootloader lit's up the LED for 5 sec and waits for mcumgr command and if there are no commands send in 5 sec then LED turn off (works as expected)

    But after updating the application firmware, and resetting the device, then later the LED turns ON back after 5 secs and never runs the application.

    And it works fine if the below configs are not included:

    # Enable wait for DFU functionality
    CONFIG_BOOT_SERIAL_WAIT_FOR_DFU=y
    CONFIG_BOOT_SERIAL_WAIT_FOR_DFU_TIMEOUT=10000

     

  • lorao said:
    CONFIG_BOOT_SERIAL_WAIT_FOR_DFU=y
    CONFIG_BOOT_SERIAL_WAIT_FOR_DFU_TIMEOUT=10000

    I tried this briefly, and I can update the application multiple times.

    Can you upload a zip of the sample you use so I can use that to reproduce?

  •   Please find the attachment below:
    Issue: I can update the image file but the application does not run after update And also it stays in the bootloader mode.
    Thank you

  • Your sample works for me. See the recording:

Reply
  • Your sample works for me. See the recording:

Children
Related