How can I go to DFU mode with code?

I flash the Spark Core a lot. I do work locally and would love to attach one extra button which triggers the DFU mode. So, can DFU mode be initiated from code?

1 Like

actually iā€™d like to know this, pressing/holding button combinations seems very 1982

make program-dfu should really put the core into dfu mode first

1 Like

The DFU code is handled in the bootloader. Perhaps @zachary could comment?

ACTUALLY - check this out:

1 Like

Take a look at this :smile:

1 Like

:+1: to the tips & tricks link Kenneth provided.

When the :spark: Core boots up, the first thing that runs is the bootloader. Based on the state of the button and a handful of system flags, it decides what to do next. To get it to jump into DFU mode, the FLASH_OTA_Update_SysFlag has to have a value that gets to the last else statement here, and zero is a good value to choose:

1 Like