nRF51 SDK - S130 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
DFU state machine

The firmware update process has been modelled as an event-driven state machine, with each event signifying a specific DFU procedure. The events and procedures are agnostic of the transport protocol that is in use. Therefore, it is possible to perform a firmware update using any transport protocol. The DFU controller can trigger the events by sending a corresponding message on the DFU transport.

The following figure illustrates the transitions in the state machine:

DFU_state_machine.svg
State machine transitions in the DFU process

The entry point of the state machine is the bootloader starting up and entering DFU mode. During initialization, the selected transport layer is initialized. When an update process has been initiated, the DFU prepares the non-volatile memory region for the new application.

The following messages initiate transitions:

Message type Description
dfu_init Initialize the Device Firmware Update module.
dfu_image_size_set Set the DFU image size.
dfu_init_pkt_handle Customer-specific data (optional).
dfu_data_pkt_handle A portion of the new application.
dfu_image_validate Trigger validation of the new application.
dfu_image_activate Activate the transferred image after validation has successfully completed.
dfu_sys_reset Reset the device. A reset can occur at any time, for example if a bootloader time-out occurs or when triggered by an external message.