feat(openthread/ota): support esp32h2 for ota examples over thread

This commit is contained in:
Tan Yan Quan
2025-12-08 19:25:29 +08:00
parent eb64ef291a
commit a38a8a06e2
12 changed files with 79 additions and 23 deletions
+40
View File
@@ -150,6 +150,46 @@ The ``native_ota_example`` contains code to demonstrate how to check the version
In ``native_ota_example``, ``$PROJECT_PATH/version.txt`` is used to define the app version. Change the version in the file to compile the new firmware.
## OTA over Thread
These examples also support OTA (Over-the-Air) updates over a Thread network and supports binding to a Thread interface on targets with native IEEE 802.15.4 support, such as the ESP32-H2.
### Thread Connectivity Prerequisites
To enable OTA over Thread, you need a Thread End Device (which is the "ESP-Dev-Board", for example, ESP32-H2) and a [Thread Border Router](https://github.com/espressif/esp-thread-br). IPv6 connectivity must be established between the Thread End Device, the Thread Border Router, and the HTTP server. You can follow the guide in [Bi-directional IPv6 Connectivity](https://docs.espressif.com/projects/esp-thread-br/en/latest/codelab/connectivity.html) for setup instructions.
Once IPv6 connectivity is established, the HTTP server will receive a valid IPv6 address starting with the On-link Prefix assigned by the Thread Border Router. This address will be used by the Thread End Device to retrieve the OTA binary.
### HTTP(S) Server Requirements
When running the HTTP(S) server, ensure that it supports IPv6. This can be achieved using a OpenSSL based server as detailed above:
```
openssl s_server -WWW -key ca_key.pem -cert ca_cert.pem -port 8070
```
* **Note:** Use the IPv6 address from the Bi-directional IPv6 Connectivity guide to generate the certificate (CN prompt).
* **Note:** The example script for the Python based server does not support IPv6 by default.
An alternative means of debugging with IPv6 support is to use Python's built-in HTTP server with the `--bind ::` option:
```
python -m http.server 8070 --bind ::
```
OTA over Thread only supports IPv6 addresses. If the HTTP(S) server can only be accessed via an IPv4 address, the End Device will need to synthesize an IPv6 address using the [NAT64](https://docs.espressif.com/projects/esp-thread-br/en/latest/codelab/nat64.html) feature.
### Thread Configuration Options (End Device)
- `idf.py menuconfig → Component config → OpenThread → OpenThread` = `y` *(enabled by default for ESP32-H2)*
- `idf.py menuconfig → Component config → OpenThread → Thread Core Features → Thread Operational Dataset` — must match the Border Router configuration
- `idf.py menuconfig → Component config → Example Configuration → firmware upgrade URL endpoint` = `"https://[fda3:e29:9416:af10:db46:b477:354e:416e]:8070/blink.bin"`
*(Refer to [Thread Connectivity Prerequisites](#thread-connectivity-prerequisites) for details on obtaining this IPv6 address, which belongs to the HTTP(S) server host PC and is accessible by the end device.)*
> **Note:**
> Thread network throughput is typically lower than Wi-Fi or Ethernet. It is recommended to start with a small OTA binary such as `blink.bin` from `examples/get-started/blink` to validate connectivity.
## Troubleshooting
* Check that your PC can ping the "ESP-Dev-Board" using its IP, and that the IP, AP and other configuration settings are correctly configured in menuconfig