nRF51 SDK - S110 SoftDevice
|
Before you create your own DFU bootloader, run and test one of the provided DFU bootloader examples to understand the underlying concepts. Start with the basic example that uses BLE as transport protocol. See Running the serial bootloader example for information about the examples that use serial transport.
The name of the example is dfu_dual_bank_ble_s110_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\dfu\bootloader
LED assignments:
Button assignments:
Complete the following steps to program the DFU bootloader example on your device using Keil:
nrfjprog.exe
is configured as the tool for flash programming in the project options. The default J-Link target driver cannot correctly program the bootloader. The example project is preconfigured to use nrfjprog.exe
, which is installed with the nRF51 MDK and must be in the Windows system path.Complete the following steps to perform a Device Firmware Update:
Image | Description |
---|---|
dfu_test_bootloader_b.zip | Zip file containing a bootloader image and the corresponding init packet |
dfu_test_softdevice_b.zip | Zip file containing a SoftDevice image and the corresponding init packet |
dfu_test_softdevice_w_bootloader_b.zip | Zip file containing a combined bootloader and SoftDevice image and the corresponding init packet |
dfu_test_app_hrm.zip | Zip file containing an application image and the corresponding init packet |
<BaseFolder>\dfu\ble_dfu_send_hex\test_images_update
folder. If you are using Keil packs, the default <BaseFolder>
is C:\Keil\ARM\Pack\NordicSemiconductor\nRF_Examples\<version>
. If you are using the repository distribution variant of the SDK, <BaseFolder>
is <InstallFolder>\examples
.If an application was transferred, the application is started automatically. Observe that the Advertising LED is lit. If a bootloader or SoftDevice was transferred and no application is installed, the system will restart in bootloader mode.
If you used one of the provided example image files, you can verify that the Device Firmware Update completed as expected as follows:
Image | Verification |
---|---|
dfu_test_bootloader_b.zip dfu_test_softdevice_w_bootloader_b.zip | Open the Master Control Panel. The device is now advertising as "DfuTest" instead of "DfuTarg". |
dfu_test_softdevice_b.zip dfu_test_softdevice_w_bootloader_b.zip | Check the data at location 0x00003000 by issuing the following command: nrfjprog –memrd 0x3000 –w 32 –n 16 The data has changed to FFFFFF10 51B1E5DB 00018000 FFFFFFFF . Before the update, the last two bytes were 0064 (for SoftDevice S110 8.0.0; other SoftDevices might have a different value). |
dfu_test_app_hrm.zip | Open the Master Control Panel. The device is now advertising as "Dfu_HRM" instead of "DfuTarg". |
Instead of using Master Control Panel to perform a Device Firmware Update, you can also use an IronPython script. In most cases, using the Master Control Panel is sufficient, but if you need or prefer a command line interface, you can use the IronPython script directly. The script is also used internally when you perform the DFU in Master Control Panel, so the provided functionality is the same.
The script requires IronPython and must be run on a Microsoft Windows operating system. By default, it is located in the C:\Program Files (x86)\Nordic Semiconductor\Master Control Panel\<version>\lib\dfu\
folder.
Before you run the script, determine the device address of the device, which is advertising as "DfuTarg". You can find out the device address in Master Control Panel. However, make sure to close Master Control Panel before you run the script.
The script uses the following syntax:
ipy main.py --file <image_file.zip> --address <target_address>
<image_file.zip>
contains the firmware image and the init packet.<target_address>
is the address of the device that is advertising as "DfuTarg".