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

How to enter DFU Mode

Apart from pressing Button 4 or adding a DFU service to current running application. Is there any way to enter DFU mode from application?

Is it possible with nrfutil to move from application to DFU Mode, Update the image.

  • The short answer is yes. The newer SDKs provide some very nice features for entering the bootloader without a button or even a reset. Which allows sharing of bonding information, or avoiding bonding being an issue for the bootloader. That said, you don't have to use all of that. In our case we didn't need the functionality and in fact it was causing some problems due to the fact that there wasn't a system reset to stop other portions of our system. So, I simplified bootload entry to just setting the GPREGRET register and doing a system reset. It required changes in the bootloader, but you have the source code so you can modify it to your needs.

  • So from nrfutil python script i should set GPREGRET register. i am using example/dfu/bootloader souce code on PCA10001 evaluation kit with s120 softdevice. What are the changes needed.

  • Hi!

    I am using SDK10 nRF51 and dual boot S310 version of the DFU.

    Also i do not intend to share information and I do not have BLE stack set up in my app (using ANT)

    Two steps:

    1. In my app call the following:

      NRF_POWER->GPREGRET = 0xB1; NVIC_SystemReset();

    2. (You can disable the option at all or do something else)

    in /examples/dfu/bootloader/main.c

    I simply disabled the check inside ble_stack_init() by removing the if (init_softdevice). I need to always startup the SD since I do not have it enabled in my app and I am doing complete reset in step 1.

    Also I disabled anything that is connected to GPIO since on my custom board I do not have buttons etc...

    So at the end of the day bootloader(DFU) always starts first, checks the GPREGRET register. If it matches the magic value, voilaa.

  • This is pretty close to what I am doing as well.

  • My post above was discussing changes needed in the device FW. It shouldn't impact the python script I don't think.

Related