Setting up the BLE OAD Environment

This section will cover the steps required to setup a BLE OAD environment.

The BLE OAD topology is described below. Refer to Figure 177. for a review of the devices involved in an OAD.

  • OAD Distributor: BTool connected to Host Test on CC13x2 or CC26x2 LaunchPad.
  • OAD Target: BLE sample application (simple_peripheral, project_zero) with OAD functionality enabled.

Note

TI provides mobile applications that support OAD, these are outside of the scope of the OAD guide. Refer to the Quick Start Guide for more information. Project zero does not support secure OAD at this time

Prerequisites

This section requires the following hardware and software components

OAD Settings in SysConfig

There are a few OAD related defines that can be set in SysConfig. To view them, open the project .syscfg file and navigate to RF STACKS -> BLE -> Advanced Settings -> OAD Only Defines as shown in the screen shot below. The related defines are set in ti_ble_app_config.opt. Keep the default settings for the procedure in this guide.

OAD Define Function
LED_DEBUG Blink LEDs for different states in App, BIM and Persistent App (on-chip only).
OAD_DEBUG Enable/Disable debugging feature for external flash via UART for off-chip OAD applications (refer to oad_efl_dbg.h for details).
FEATURE_OAD Required for OAD functionality.
OAD_BLE_SECURITY Not to be confused with secure/non-secure OAD (refer to OAD Security). If defined in the user / persistent (for onchip OAD) application project, The OAD distributor will be forced to be paired with the OAD target in order for the OAD to happen.
../_images/oad_settings_in_syscfg.png

OAD Target Setup

In order to perform a BLE OAD, an OAD capable image must be loaded onto the OAD target device. This section will cover the steps required to load the CC13x2 or CC26x2 LaunchPad with an OAD enabled BLE image.

Note

Per default, BLE5-Stack projects use the Secure OAD feature. For steps on how to disable this feature (and perform a non-secure/unsecure OAD) please see Disable Secure OAD.

  1. Navigate to the simple_peripheral_oad_offchip or simple_peripheral_oad_onchip folder inside the BLE5-Stack.

  2. Import the projects into the workspace of your selected IDE.

    • See the Quick Start Guide for instructions on how to work with your selected IDE.
  3. Navigate to bim_offchip or bim_onchip folder (respective to your chosen project) inside the nortos folder.

  4. Import the project into the workspace.

  5. Select the proper build configuration based on debug needs (make sure to use the same as for BIM).

    • Debug
    • Release
  6. (on-chip OAD only) Build and flash the persistent app project

    Note

    The build steps must be done in order, or errors will occur

    The default address mode for the simple_peripheral_oad_onchip example is set to Resolvable Private Address with Public Identity Address (ADDRMODE_RP_WITH_PUBLIC_ID). In the next section Performing a BLE OAD, the OAD distributor (Btool + HostTest) will reset the OAD target (simple_peripheral_oad_onchip) by writing a command to the OAD Reset Service (OAD Reset Service (0xFFD0)) to make the OAD target reboot into the OAD persistent App which will handle the OAD transfer. The persistent app use public address mode (ADDRMODE_PUBLIC). In this case BTool will automatically try to re-connect to the previous random address which does not exist anymore. To make te OAD procedure easier with BTool you can change the default address mode for simple_peripheral_oad_onchip to public mode. Open simple_peripheral_oad_onchip.syscfg (double-click on file in CCS), navigate in the GUI to RF STACKS -> BLE -> General Configuration, change the default address mode to Public Address and rebuild the project. The default address mode is set in the SysConfig generated file ti_ble_config.h.

    ../_images/sbp_address_mode_in_syscfg.png
  7. Build and flash the app project

    • Uniflash must be used to flash the _oad.bin image that is produced by the oad_image_tool or the device will not boot after a reset.
    • The _oad.bin file contains CRC and (if applicable) security information about the image. This is used by the BIM on boot to determine which image to run. If the image is flashed directly from the IDE, the device will not boot after subsequent resets as either CRC or security information is missing
    • See Loading a Production Image for more information.
  8. Build and flash the BIM project

    • The BIM debug configuration does not do CRC checks on the image, making it possible to flash an image straight from the IDE.
    • If your device does not boot, it is likely that the incorrect version of BIM was flashed, see Loading a Production Image for more info.
  9. Verify the device has booted up and is advertising

    • Verification: Open a terminal window with 115200 8N1 to the XDS110 Class Application/User UART port corresponding to your CC13x2 or CC26x2 LaunchPad.
    • The console should display the text below, use it to get the BLE address. The Resolvable Private Address (RPA) is what is broadcasted over the air in the advertisement packets.
    ../_images/sbp_oad_boot_screen.png
  10. Plug/unplug the device to prevent Halt In Boot (HIB)

    • If the device does not advertise after reset, ensure the _oad.bin file was loaded.

Disable Secure OAD

Most steps for performing non-secure/unsecure OAD are the same as for Secure OAD. However there are some configuration changes to be made.

  1. After importing the projects, select the proper build configuration for the BIM project. Choose Debug_unsecure or Release_unsecure in order to not use Secure OAD.

  2. Make sure the corresponding build configuration (Debug/Release) is used for the app project (and persistent app project if applicable). E.g., if the BIM is set to use Debug_unsecure, make sure the ble5_project_zero_cc26x2r1lp_app also uses the FlashROM_Debug build configuration.

  3. Disable the SECURITY preprocessor define. This define is found in the Options/Properties Predefined Symbols list, or in the .opt file in the TOOLS/defines folder. Disabling this define impacts the following files:

    • ble_release.cfg/ble_debug.cfg
    • oad_image_header.h
    • oad_image_header_app.c
    • bim_main.c
  4. Disable the SECURITY linker define. Disabling this define impacts the linker command file (.cmd or .icf).

OAD Distributor Setup

As per the Introduction section, the OAD Distributor is the device responsible for fragmenting an OAD enabled image in to chunks of OAD blocks and sending each block over the to the OAD Target device as they are requested.

In the case of BLE, the OAD Distributor is a combination of BTool running on the PC connected to host_test running on a CC13x2 or CC26x2 LaunchPad. host_test is a BLE enabled network processor application. BTool is a PC tool that is capable of interfacing to host_test and performing various BLE functions in addition to OAD. For more information, refer to the host_test README file or the BTool User’s Guide.

Flashing the host_test Image

See below for the steps to setup the host_test image on a CC13x2 or CC26x2 LaunchPad.

  1. Navigate to hexfiles folder within the BLE5-Stack.
  2. Select the host_test_*.hex file.
  3. Flash the above hexfile using UNIFLASH. See image below
../_images/host_test_uniflash.png

Connecting BTool to host_test

BTool and host_test communicate via USB through the XDS110 UART back channel. See below for a diagram

../_images/ditaa-a59affabe57be29f72a0c4b1672569165bb04124.png
  1. Find the port used by the UART backchannel of the CC13x2 or CC26x2 LaunchPad running host_test. This is the one with the name XDS110 Class Application/User UART

  2. Open BTool (see the BTool executable in the tools folder of the BLE5-Stack)

  3. Use the following serial port settings, hit OK

    • Port: <PORT_FROM_ABOVE_STEP>
    • Other settings: 115200 8N1
  4. This should open and initialize the host_test device.

  5. Pressing the scan button should populate a list of devices in the log

    • A screen shot of a properly initialized BTool session is shown below
    ../_images/btool_init_success.png

Note

You might have to reset the HostTest application by pressing the RESET button on your Launchpad (button by the micro-USB connector) before you open the COM port in BTool.