# Generic Broadcast protocol
Conventions Used in This Document The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 (opens new window).
# Overview
The Generic Broadcast Protocol is used for one-to-many communication. It is stateless and carries only a small type header.
List of protocols:
ID | Protocol |
---|---|
0 | Reserved |
1 | Firmware Update protocol |
2-13 | Reserved |
14 | User defined protocol |
15 | Reserved |
# Firmware Update protocol (ID 1)
The Broadcast message consists of a Firmware Update Header (FUHdr) containing the message type and the message of that type.
FUHdr 1 byte | Message 0-60 bytes |
---|
Firmware Update header (FUHdr):
RFU [7:4] | Message Type (MT) [3:0] |
---|
Message Type (MT):
MT | Description |
---|---|
0 | Reserved |
1 | Update Begin message |
2 | Firmware Data message |
3 | Update End message |
4-15 | Reserved |
# Update Begin message
The Firmware update Begin message is broadcast as the first message. This will let the End Devices know what is to follow.
The format is as follows:
Device Type Magic 4 bytes | RFU 1 byte | FW Ver. Major 1 byte | FW Ver. Minor 1 byte | FW Ver. Patch 1 byte | FW Length 4 bytes | FW CRC32 4 bytes | FW Num packets 4 bytes |
---|
The reason for this format is that the first 16 bytes (without the "Num packets" bytes) can be used as Image header in the Bootloader in the End Device.
# Encryption
The Update Begin message SHOULD be encrypted with the Firmware Update encryption key. The MAC header (3 byte), transport layer header (1 byte) and the GPB Firmware update header is not covered by the encryption. The entire Update Begin message is encrypted.
# Firmware data message
This message contains the firmware update data. The data MUST be 8-byte aligned as many MCUs can write internal flash faster with double words instead of a single word. Also, as some transceivers has as little as a 64 byte RX fifo, the maximum encrypted Transport layer message length is 48 bytes (16 byte aligned AES128). Subtracting the 1 byte FUHdr and the 2 byte packet counter yields 45 bytes left for actual data. This leaves 40 bytes for the Firmware update data as data MUST be 8-byte-aligned.
Firmware data message format:
Packet counter 2 bytes | Data 40-104 bytes |
---|
# Encryption
The Firmware update data message SHOULD be encrypted with the Firmware Update encryption key. The MAC header (3 byte), transport layer header (1 byte) and the GPB Firmware update header and also the Packet counter bytes are not covered by the encryption. the Firmware Data is encrypted. The reason that the packet counter is not covered by the Encryption is to optimize the packet for maximum firmware data that is 8-byte aligned, as some microcontrollers has an Flash-fast-write option that takes double-words (8 bytes).
# Update End message
Same format as the "Update Begin message".