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.

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

    When you are running an image in "test" mode, you must tag it as "confirmed" to not revert back on the next reset.
    This can be done in multiple ways:
    If the new application supports an SMP Server, you can use said SMP Server to confirm the image, using "mcumgr ... confirm" as you are trying to do.
    Alternatively, you can call boot_write_img_confirmed() from your test-mode application. Remember to only confirm the image from the application after you are sure that the running application works fine.

    lorao said:
    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. 

    To update again, the new image must also support mcumgr commands.
    If you ever update to an image without mcumgr support (an SMP Server), you can no longer update the device.

    The alternative is Serial Recovery, where you can send mcumgr commands to MCUboot, so that you can always update over serial.

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

    NMP timeout means that mcumgr-cli can not get any responses from the nRF chip. Often because the SMP Server is not running on the device, or not connected to the correct uart.

    Regards,
    Sigurd Hellesvik

Reply
  • lorao said:
    1. What should be done in case 1, so that the image files are not reverted after reset.

    When you are running an image in "test" mode, you must tag it as "confirmed" to not revert back on the next reset.
    This can be done in multiple ways:
    If the new application supports an SMP Server, you can use said SMP Server to confirm the image, using "mcumgr ... confirm" as you are trying to do.
    Alternatively, you can call boot_write_img_confirmed() from your test-mode application. Remember to only confirm the image from the application after you are sure that the running application works fine.

    lorao said:
    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. 

    To update again, the new image must also support mcumgr commands.
    If you ever update to an image without mcumgr support (an SMP Server), you can no longer update the device.

    The alternative is Serial Recovery, where you can send mcumgr commands to MCUboot, so that you can always update over serial.

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

    NMP timeout means that mcumgr-cli can not get any responses from the nRF chip. Often because the SMP Server is not running on the device, or not connected to the correct uart.

    Regards,
    Sigurd Hellesvik

Children
Related