esp ble ota
is a firmware upgrade component for data sending and receiving based on customized BLE Services. The firmware to be upgraded will be subcontracted by the client and transmitted sequentially. After receiving data from the client, packet sequence and CRC check will be checked and ACK will be returned.
You can create a project from this example by the following command:
idf.py create-project-from-example "espressif/ble_ota^0.1.8:ble_ota"
Note: For the examples downloaded by using this command, you need to comment out the override_path line in the main/idf_component.yml.
Deleted subscribe command support, no longer needed for protocomm.
Added finish command support to indicated end of OTA.
ble ota demo
is based on the ble ota component
, it receives firmware via BLE and writes it to flash, sector by sector, until the upgrade is complete.
The component contains two services:
DIS Service
: Displays software and hardware version information
OTA Service
: It is used for OTA upgrade and contains 4 characteristics, as shown in the following table:
Characteristics | UUID | Prop | description |
---|---|---|---|
RECV_FW_CHAR | 0x8020 | Write, notify | Firmware received, send ACK |
PROGRESS_BAR_CHAR | 0x8021 | Read, notify | Read the progress bar and report the progress bar |
COMMAND_CHAR | 0x8022 | Write, notify | Send the command and ACK |
CUSTOMER_CHAR | 0x8023 | Write, notify | User-defined data to send and receive |
unit | Command_ID | PayLoad | CRC16 |
---|---|---|---|
Byte | Byte: 0 ~ 1 | Byte: 2 ~ 17 | Byte: 18 ~ 19 |
Command_ID:
The format of the firmware package sent by the client is as follows:
unit | Sector_Index | Packet_Seq | PayLoad |
---|---|---|---|
Byte | Byte: 0 ~ 1 | Byte: 2 | Byte: 3 ~ (MTU_size - 4) |
The format of the reply packet is as follows:
unit | Sector_Index | ACK_Status | CRC6 |
---|---|---|---|
Byte | Byte: 0 ~ 1 | Byte: 2 ~ 3 | Byte: 18 ~ 19 |
ACK_Status:
`idf.py menuconfig'
- Component config → Bluetooth → Bluetooth → Host → NimBLE - BLE only
Note: For maximum throughput, set maximum MTU using
- Component config → Bluetooth → NimBLE Options → Preferred MTU size in octets as 517
`idf.py menuconfig`
- Example Configuration → Type of OTA → Use protocomm layer for security
- Component config → OTA Manager → Type of OTA → Enable protocomm level security
`idf.py menuconfig`
- If using ESP32S3 set Component config → Bluetooth → Bluetooth → NimBLE Options → NimBLE Host task stack size as 8192
- Example Configuration → Type of OTA → Use Pre-Encrypted OTA
- Component config → OTA Manager → Type of OTA → Enable pre encrypted OTA
Copy to Clipboard
idf.py add-dependency "espressif/ble_ota^0.1.8"
To create a project from this example, run:
Copy to Clipboard
idf.py create-project-from-example "espressif/ble_ota^0.1.8:ble_ota"
Copy to Clipboard
Copy to Clipboard