Performing a BLE OAD

This section will detail the steps required to perform an OAD over BLE using BTool. It assumes that the OAD Target and Distributor have been setup according to Setting up the BLE OAD Environment.

Modifying the Image Version

Modifying the image version is a quick and easy way to verify that the OAD has completed. Some sample apps will display their image version in the terminal window.

  1. Navigate to the oad_image_header*.c file in the SDK.

  2. Modify the SOFTWARE_VER field to increase the version number

  3. Rebuild the application project, and generate a new binary *_oad.bin.

    • The oad_image_tool automatically runs as a post-build step
    • The binary from the tool will be placed in the build folder alongside the default .out file.

OAD using BTool

  1. Run BTool using the Run_BTool.bat script, this will intiialze BTool to use the proper BLE-Stack version.

  2. Connect to the target device using its BLE address

    • See steps in OAD Target Setup for steps to get target address
    • Screen shot below shows how to connect to a specific BLE address in BTool
    ../_images/btool_connect.png
  3. Wait for the application’s connection parameter update (if enabled)

BTool will send a connection parameter update at the beginning of an OAD to attempt a faster download. The embedded application will also attempt a parameter update. It is recommended to wait until the application’s connection parameter update has taken place before starting an OAD. If you are experiencing a slow OAD, this may be the cause. The parameter update is complete once the following message is shown in the BTool log:

--------------------------------------------------------------------
[7] : <Rx> - 04:16:04.518
-Type           : 0x04 (Event)
-EventCode      : 0x00FF (HCI_LE_ExtEvent)
-Data Length    : 0x0B (11) bytes(s)
 Event          : 0x0607 (1543) (GAP_LinkParamUpdate)
 Status         : 0x00 (0) (SUCCESS)
 ConnHandle     : 0x0000 (0)
 ConnInterval   : 0x0024 (36)
 ConnLatency    : 0x0000 (0)
 ConnTimeout    : 0x00C8 (200)
Dump(Rx):
0000:04 FF 0B 07 06 00 00 00 24 00 00 00 C8 00       ........$.....
--------------------------------------------------------------------
  1. Once connected, switch to the OAD tab and load an oad image into BTool

    • If using on-chip OAD, be sure to un-check the box “OAD to external flash”
    • The OAD process has begin once the image identify is accepted.
    • While intermittent blocks are being sent BTool will display: Write Block Number = x of y
    • The OAD process will continue until BTool displays OAD Download Successful.
    • The “secure” checkbox is read-only and indicates whether the currently loaded OAD image has security enabled in its header.
    • For secure OAD configurations, BTool uses the default public/private key pair. To change the security keys used by the embedded device, see Generating new security keys (Embedded). To change the security keys used by BTool please see the next section of this chapter.
    • After an OAD has completed, you may need to manually hit the reset button on the CC2640R2 LaunchPad in order to trigger a full reset and jump to BIM. This step is only required after first programming the device. This will disconnect the debugger and terminate the debugging section.
    • After some delay (copying in the BIM), the new image should boot up and will be active.
    ../_images/btool_oad.png

Note

The OAD Image Tool will run as a post build step to build an OAD enabled image. The output of the tool is a bin file with _oad.bin appended to the name of the input hex file. This is the file to pass into BTool.

Generating new security keys (BTool)

BTool will use the default keypair for secure OAD, this is useful for rapid evaluation and demo of the secure OAD feature. However, before production of a final OAD image, the security keys installed on the device must be changed. Installing new keys on the embedded device is described in Generating new security keys (Embedded). After installing new keys on the device, you must point BTool to the new keys used by the embedded device.

BTool uses the security keys to sign the OAD Start/Reset command and the image identify command.

To install new keys in BTool, perform the following steps:

  1. Generate and install new keys for the embedded device. Generating new security keys (Embedded).
  2. Copy the public.pem and private.pem files generated by the previous step into the same folder as btool.exe (tools/blestack/btool by default).
  3. Close BTool and re-open it again, observe that the red warning box at the bottom of the Over The Air Download tab is now gone.