3.2 Secure Firmware Upgrade Protocol
The Secure Firmware Upgrade application uses a predefined communication protocol to exchange data between the client and the host.
The UART-based Secure Firmware Upgrade protocol comprises a Guard, Data Size, Command, and Data bytes, as shown in the following figure.
- Guard
- The Guard is a constant value 0x5048434D.
- This value provides protection against spurious commands.
- Bootloader firmware always checks for the Guard value at the start of packet reception and proceeds further accordingly.
- Data Size
- This field indicates the number of data bytes to be received.
- This value varies for different commands.
- Command
- Indicates the command to be processed. Each command is of 1 byte width.
- Below are the supported commands:
- Unlock (0xA0)
- Firmware Data (0xA1)
- Verify (0xA2)
- Reset (0xA3)
- Flash Status (0xA4)
- Device Configuration Command (0xA5)
- Data
- Contains the actual data to be processed based on the command.
- Length of the data to be received is indicated by a data size field.
- Bootloader receives the data in the size of words (4 bytes).
- All data words must be sent in a little-endian (LSB first) format.
Response Codes
After sending a command, the bootloader will respond with a single-character or double-character code. Subsequent commands can only be sent after receiving the response code for the previous command or after a 100 ms timeout with no response.
The valid response codes are as follows:
- OK (0x50)
- Error (0x51)
- Invalid (0x52)
- Signature OK (0x53)
- Signature Failed (0x54)
- Flash Write OK (0x55)
- Flash Write Failed (0x56)