Comprehensive BLE training

Advanced BLE Projects: OTA, Mesh, Long Range and Custom Protocols

Check out DFU and secure OTA, BLE Mesh, Long Range, Streaming, proprietary protocol over GATT, and multi-connectivity with an architectural look.

Contents
Actual photo of nRF51822 based mKIT board; Old example of BLE hardware, not the nRF52840 or Sniffer introduced in the text.
Actual photo of nRF51822 based mKIT board; Old example of BLE hardware, not the nRF52840 or Sniffer introduced in the text. Photo: Ordercrazy; Wikimedia Commons resource; CC0. The content of the photo has not changed; A Wikimedia preview image is used. This is not a documentary photo of the LCENJ experiment.
Step 18 of 20 ways to master BLE

In advanced project, every feature should be resistant to power outage, link drop, old version, attack and memory shortage. A successful laboratory sample is not yet a releaseable product; Recovery path and visibility is part of the design.

DFU and OTA

Firmware must be signed and its version checked. Data is transferred in chunks, the integrity of each segment is controlled and the image is written to the inactive partition. Bootloader only activates the valid image and has a way back in case of failure. Disconnection at 90% should not render the device unusable.

Mesh and Long Range

BLE Mesh builds a multi-node network on Advertising and Publish/Subscribe model and is not the same as normal GATT connection. LE Coded PHY increases the point-to-point link range under the right conditions. Mesh, relay and long range cost time on air and energy and should be tested with real topology.

Streaming and proprietary protocol

For data stream, define Header including Version, Type, Sequence, Length and Checksum. Specify Flow Control and Queue Size and allow Receiver to stop or reduce rate. Don't just rely on Write Without Response; The controller buffer is not unlimited.

Some Central and Peripheral

Each connection has independent Context, buffer, CCCD and parameters. The radio scheduler should accommodate the events of all the links. As the connection increases, Interval, Throughput and Consumption will change. Find the practical ceiling with actual load, not just the datasheet number.

Dedicated data frame design

Put the first byte of Version, the second byte of Message Type, two bytes of Sequence, two bytes of Length, then Payload and CRC. The receiver first compares the Length with the MTU and buffer, rejects the duplicate sequence, and sends a functional ACK for the important command.

Separate the logical frame, transmission part and original firmware

A logical message may be larger than the capacity of a Write or Notify. In this case, you need to define the message ID, segment position, final length and buffer ceiling. Comparing the total message length to the MTU and discarding all large messages does not replace the fragmentation protocol.

Check the declared length against the design ceiling before allocating memory; Handle duplicate, missing and out-of-order fragment and return final result with message number. A functional ACK simply announces the receipt or execution defined in the contract.

Keyless CRC and Hash alone do not prove firmware authenticity. Secure OTA requires valid signature, version control, rollback setup and key protection policy. Define the cutoff at 10, 50, or 90% as the test plan, not the result of the test not being performed.

Bluetooth Mesh is not "the same as GATT with multiple connections" either. Adapt features such as Relay, Proxy and transport methods to the selected Mesh specification and stack capability.

Question and answer article

Ask your technical question

Questions and answers are published after moderation. Authors can see their own pending drafts.

No confirmed questions have been registered for this article yet.