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.

Parents
  • Before resting to the bootloader mode, you should prepare the reset. Calling directly the NVIC_SystemReset(); method is not a good option IMO:

    void reset_prepare(void) {
      uint32_t err_code;
    
      // Change a LED state
    
      // Disconnect from BLE peer if connected
      // If not connect, stop advertising if enabled
    
      err_code = ble_conn_params_stop();
      APP_ERROR_CHECK(err_code);
    }
    
    // Disable the SoftDevice and restart properly in bootloader mode
    void bootloader_start() {
      // A "simple" reset is not enough, the SD and IRQs must be disabled first
      ble_dfu_evt_t evt;
      memset(&evt, 0, sizeof(evt));
      evt.ble_dfu_evt_type = BLE_DFU_START;
      dfu_app_on_dfu_evt(&m_dfus, &evt);
    }
    

    In my case, I generate a ble_dfu_evt_t event to restart properly in bootloader mode. I also use the reset_prepare function to close a BLE connection or stop advertising before entering in bootloader mode.

  • Both approaches are possible. Depending on the BLE connection parameters, the timeout can be several seconds. I always prefer to correctly close a BLE connection.

Reply Children
No Data
Related