System Calls

dfu()

System.dfu, dfu

// PROTOTYPES
void dfu(SystemResetFlags flags = SystemResetFlags());
void dfu(bool persist);

The device will enter DFU-mode to allow new user firmware to be refreshed. DFU mode is cancelled by

  • flashing firmware to the device using dfu-util, specifying the :leave option, or
  • a system reset

Since 2.0.0:

  • SystemResetFlags can be specified in Device OS 2.0.0 and later. There is currently two applicable flags:

    • RESET_NO_WAIT reset immediately and do not attempt to notify the cloud that a reset is about to occur.
    • RESET_PERSIST_DFU re-enter DFU mode even after reset until firmware is flashed.

In Device OS 2.0.0 and later, a call to System.dfu() defaults to notifying the cloud of a pending reset and waiting for an acknowledgement. To prevent this, use the RESET_NO_WAIT flag.


System.dfu(true);   // persistent DFU mode - will enter DFU after a reset until firmware is flashed.

To make DFU mode permanent - so that it continues to enter DFU mode even after a reset until new firmware is flashed, pass true for the persist flag.