This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

DFU reset for part 2 / 2

Hello,

I have a bootloader with a low power wait for power button on startup.

When I do a BLE DFU update of bootloader + SD + appli, the Nordic smartphone application cut update in two parts and it looks like it have to reboot at the middle.

I need to avoid my low power wait if it's a DFU update that continues. How can i know that a DFU update is in progress to skip this part ?

Thank you.

  • It's the nature of Softdevice update that the application to be erase to have enough swap page. And also when you update the bootloader a reset is needed for the MBR to replace the old bootloader with the new one. After the reset, the new bootloader will expect the new application image to be updated.

    What exactly you do in your "low power wait" ? Where do you implement the wait ? The DFU update progress is stored in bootloader setting. However, I don't think application update (phase 2)is considered as update in progress but it's a normal new application update (like the first application you update when the chip is blank).

  • Hello, Thank you for your help. Low power wait is just my device wait for user press power on button in a sleep mode. The problem is the button is not pressed by user during the update and i have to skip that if an update is in progress. But how to know ?

  • Could you tell which SDK you're using ? If you are using latest SDK v14.2 (should be similar also on SDK v13 and v14.x). As you can find in nrf_dfu_find_cache() if single bank update is used (in most case as the softdevice + bootloader usually requires single bank udpate, not all the time, depends on the size of flash), bank 0 (where the original application is) will be invalidated.
    In addition, if you update new softdevice

    What you can do in your wait is to read bootloader setting and check if s_dfu_settings.bank_0.bank_code == NRF_DFU_BANK_INVALID_APP . Then you can enter bootloader mode without waiting for the button press.

    The only place that this solution may not work is when you update same major Softdevice, and it's using dual bank update. Then the application in bank 0 is not needed to be invalidated then checking the bootloader setting wouldn't help. But you can always using a flag in retention register GPREGRET to tell on the next reset, that the bootloader should enter bootloader mode, instead of waiting at the low power wait.

  • Hello, I use SDK 14.2 on a nRF52840. Your NRF_DFU_BANK_INVALID_APP proposal looks perfect, i will try asap. Thank you.

Related