Module Gateway H2 supports running the ESP Thread Border Router SDK alongside ESP32 series Wi‑Fi SoCs. This SDK is built based on ESP‑IDF and OpenThread, running the Thread network on the H2 while the H2 communicates with the main processor via a serial interface.
v5.3.1
for compiling this example.git clone --recursive https://github.com/espressif/esp-idf.git
cd esp-idf
git checkout v5.3.1 # recommend
./install.sh
. ./export.sh
2.Hardware Products Used:
3.The subsequent tutorial uses idf.py commands which depend on ESP‑IDF. Before running the commands, execute . ./export.sh
in ESP‑IDF to activate the related environment variables. For detailed instructions, please refer to the
ESP-IDF - Getting Started with ESP32S3 Tutorial
.
esp32h2
.cd $IDF_PATH/examples/openthread/ot_rcp
idf.py set-target esp32h2
idf.py menuconfig
2.Use idf.py menuconfig
to enter the configuration menu. In menuconfig, configure:Component config
-> OpenThread RCP Example
- Enable OPENTHREAD_NCP_VENDOR_HOOK
3.After finishing the configuration, execute the following command to build the RCP firmware.
idf.py build
git clone https://github.com/Ocean-lhy/esp-thread-br.git
# For CoreS3
git checkout demo_for_core_s3_test
cd examples/thread_border_router_credential_sharing
idf.py set-target esp32s3
# For Core2 v1.0 and v1.1 (the power management chips are AXP192 and AXP2101 respectively; configuration in menuconfig is required)
git checkout demo_for_core_2_test
cd examples/thread_border_router_credential_sharing
idf.py set-target esp32
# For Core
git checkout demo_for_core_test
cd examples/thread_border_router_credential_sharing
idf.py set-target esp32
idf.py menuconfig
to enter the configuration menu. In menuconfig, configure the Wi‑Fi settings:Component config
-> Example Connection Configuration
idf.py menuconfig
idf.py build
idf.py erase_flash
idf.py flash
1.After flashing, restart the device. The device will enter the RCP update state. Once the RCP update is successful, the device will restart and connect to both Wi‑Fi and the Thread network. Upon completion of device initialization, the following information will be displayed:
generate epskc
buttonfactoryreset
buttonBorder router web server
URL2.Click the generate epskc
button. The device will generate an epskc and display it on the screen, which can be used for quick network commissioning.
3.Within your LAN, use a browser to access the Border router web server URL to view Thread network information.
4.If you wish to modify the connected Wi‑Fi network, you can use the serial command interface. Enter the command wifi -s SSID -p PASSWORD
and then restart the device.
Use Module Gateway H2 (ESP32-H2) or NanoC6 (ESP32-C6), refer to the example program to flash the OpenThread SimpleCLI routine, connect to the Thread network, and view the Thread network information.
Enter networkkey
, panid
, and channel
in the background of the Thread Boarder Router to obtain the network key, panid, and channel of the Thread network.
Enter the configuration commands in the SimpleCLI routine and start the Thread network.
networkkey <networkkey>
panid <panid>
channel <channel>
ifconfig up
thread start
state
in the SimpleCLI serial port interaction to view the state of the Thread network. If it is connected to the network as a child/router, the Thread network connection is successful. If it forms a network as a leader, there may be an error in the configuration.parent
in the SimpleCL serial port interaction to view the parent node of the Thread network; enter extaddr
to view the extended address of this node.extaddr
in the serial port interaction of the Thread Boarder Router to view the extended address of this node, which should be the same as the parent extaddr
in the SimpleCLI routine.neighbor table
in the serial port interaction of the Thread Boarder Router to view the neighbor nodes of the Thread network, which should include the node of the SimpleCLI routine.