The example code provided at the end of this article shows how to use the BLED112 dongle as OTA client to update Bluetooth applications running on BGMxxx (or EFR32BG).
NOTE: when testing OTA updates, make sure you first test with a target device that can be easily accessed with J-Link debugger in case something unexpected happens.
This example application is only for experimental use. It has not been extensively tested and it is not intended for production use.
OTA updates are explained in detail in the following application note:
AN1045: Bluetooth® Over-the-Air Device Firmware Update
The target device must be based on BGMxxx module or EFR32BG SoC. This application is NOT suitable to update any BLExxx devices.
Target device must be running application built with SDK 2.0.0 or later and the application must have OTA enabled as specified in AN1045. Recommended minimum SDK version: 2.0.3 or 2.1.1.
BLED112 dongle is needed. The Bluetooth Smart SDK for BLE product family is not necessary.
The example code provided here is basically the "OTA host example" from the Bluetooth Smart SDK that has been ported to BLED112 dongle. This host example is explained in more detail in AN1045.
The attached zip includes a makefile for building the project. This has been tested on Windows using Cygwin but it should work on other platforms as well.
Before running the example, you need to have the EBL file(s) that are suitable for updating your target device.
If you run the example without any parameters it shows the possible usage options as follows:
--- Usage: ---- ./OTA list => check COM port number of BLED112 ./OTA <COMx> scan => scan for BLE devices (stops automatically after 5 seconds) ./OTA <COMx> <address> <EBL file> => run OTA update
By running the program with option list you can easily check what is the COM port number associated with your BLED112 dongle.
The second option allows you to scan for BLE devices. This is convenient if you don't already know the Bluetooth address of the target device. You can also use it to make sure that the target device is advertising. When lauched with the scan option the program listens for advertisements and then automatically stops after 5 seconds has passed.
Finally, to run the OTA update you need to pass three parameters:
- COM port number
- Bluetooth address of the target device
- name of the EBL file
The attached file named example_run.txt shows example usage of the program (copied from Cygwin console).