nRF51 SDK - S110 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Example application

To show how to add BLE DFU Service support to an application, the SDK contains a version of the Heart Rate Application that includes DFU support. This example illustrates how a standard application can be extended so that you can easily update the device firmware at any time, just by connecting to the application.

The name of the example is ble_app_hrs_s110_with_dfu_pca10028. If you are not using the Keil Pack Installer, you can find the source code and project file of the example in the following folder: <InstallFolder>\examples\ble_peripheral\ble_app_hrs

When testing the example, you can choose to use bonding to share encryption keys between the application and the bootloader. If you use bonding, the link between the DFU target and the DFU controller will be re-established with encryption when the device restarts in bootloader mode. See Sharing bonding information for more information.

Testing the example with bonding

Test the Heart Rate Application with BLE DFU Service support using bonding with the Master Control Panel by performing the following steps:

  1. Program the DFU bootloader.
  2. Compile the application and perform a Device Firmware Update to program it. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
  3. Connect to the device from Master Control Panel, then bond to it.
  4. Perform service discovery. The device is advertising as "Nordic_HRM". Observe that the BSP_INDICATE_CONNECTED state is indicated.
  5. Write the value "0200" to the Service Changed characteristic to enable the Service Changed indication when the GATT Server Attribute Table changes.
  6. Write the value "0100" to the CCCD for the DFU Control Point characteristic or click Enable services to enable DFU notifications.
  7. Write the command to start a DFU procedure to the DFU Control Point:
    • "01-01" if you want to update the SoftDevice
    • "01-02" if you want to update the bootloader
    • "01-03" if you want to update the SoftDevice and bootloader
    • "01-04" if you want to update the application
  8. Observe that the connection to the device is lost. The message "SERVER: Received Link Loss" is displayed in the log window.
  9. The device is now performing directed advertising to the bonded peer. When the connection is established, a Service Changed indication is received and displayed in the Master Control Panel.
  10. Perform a Device Firmware Update. You do not need to connect to the device again, because you are already connected.

Testing the example without bonding

Test the Heart Rate Application with BLE DFU Service support not using bonding with the Master Control Panel by performing the following steps:

  1. Program the DFU bootloader.
  2. Compile the application and perform a Device Firmware Update to program it. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
  3. Connect to the device from Master Control Panel.
  4. Perform service discovery. The device is advertising as "Nordic_HRM". Observe that the BSP_INDICATE_CONNECTED state is indicated.
  5. Write the value "0100" to the CCCD for the DFU Control Point characteristic or click Enable services to enable DFU notifications.
  6. Write the command to start a DFU procedure to the DFU Control Point:
    • "01-01" if you want to update the SoftDevice
    • "01-02" if you want to update the bootloader
    • "01-03" if you want to update the SoftDevice and bootloader
    • "01-04" if you want to update the application
  7. Observe that the connection to the device is lost. The message "SERVER: Received Link Loss" is displayed in the log window.
  8. Click "Back" in the Master Control Panel to see an overview of the discovered devices.
  9. Clear the discovered devices and click "Start discovery".
  10. Verify that the device is now advertising as "DfuTarg".
  11. Perform a Device Firmware Update.