-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
5,407 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.vscode | ||
|
||
/build/ | ||
/sdkconfig | ||
/sdkconfig.old |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# | ||
# Copyright (c) 2021 Project CHIP Authors | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# The following lines of boilerplate have to be in your project's | ||
# CMakeLists in this exact order for cmake to work correctly | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
set(PROJECT_VER "v1.0") | ||
set(PROJECT_VER_NUMBER 1) | ||
|
||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
include(${CMAKE_CURRENT_LIST_DIR}/../../common/cmake/idf_flashing.cmake) | ||
|
||
set(EXTRA_COMPONENT_DIRS | ||
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/config/esp32/components" | ||
) | ||
|
||
project(chip-thread-br-app) | ||
|
||
# C++17 is required for RPC build. | ||
idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) | ||
idf_build_set_property(C_COMPILE_OPTIONS "-Os" APPEND) | ||
# For the C3, project_include.cmake sets -Wno-format, but does not clear various | ||
# flags that depend on -Wformat | ||
idf_build_set_property(COMPILE_OPTIONS "-Wno-format-nonliteral;-Wno-format-security" APPEND) | ||
|
||
# We don't need Thread Network Commissioning Driver | ||
idf_build_set_property(COMPILE_OPTIONS "-D_NO_GENERIC_THREAD_NETWORK_COMMISSIONING_DRIVER_" APPEND) | ||
|
||
# -Wmaybe-uninitialized has too many false positives, including on std::optional | ||
# and chip::Optional. Make it nonfatal. | ||
# | ||
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635 | ||
idf_build_set_property(COMPILE_OPTIONS "-Wno-error=maybe-uninitialized" APPEND) | ||
|
||
flashing_script() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Matter ESP32 Thread Border Router Example | ||
|
||
A prototype application that demonstrates OpenThread Border Router on ESP32-S3 + | ||
ESP32-H2 Thread Border Router DevKit Board. | ||
|
||
Please | ||
[setup ESP-IDF and CHIP Environment](../../../docs/guides/esp32/setup_idf_chip.md) | ||
and refer | ||
[building and commissioning](../../../docs/guides/esp32/build_app_and_commission.md) | ||
guides to get started. | ||
|
||
--- | ||
|
||
- [OpenThread Border Router Board](#openthread-border-router-board) | ||
- [OpenThread RCP](#openthread-rcp) | ||
- [OpenThread CLI](#openthread-cli) | ||
- [Setup Thread Network](#setup-thread-network) | ||
- [Commissioning Thread End Devices](#commissioning-thread-end-devices) | ||
|
||
--- | ||
|
||
### OpenThread Border Router Board | ||
|
||
The ESP Thread border router board provides an integrated module of an ESP32-S3 | ||
and an ESP32-H2. | ||
|
||
![Border Router Board](image/esp-thread-border-router-board.png) | ||
|
||
### OpenThread RCP | ||
|
||
We need to build an OpenThread RCP(Radio Co-Processor) firmware for ESP32-H2 of | ||
the Border Router Board before building this Thread Border example. | ||
|
||
``` | ||
cd $IDF_PATH/examples/openthread/ot_rcp | ||
idf.py set-target esp32h2 | ||
idf.py build | ||
``` | ||
|
||
Then we need to connect the USB2 port(ESP32-S3) of the Border Router Board to | ||
your host machine. Build and flash this example. | ||
|
||
``` | ||
cd ${CHIP_ROOT}/examples/thread-br-app/esp32 | ||
idf.py set-target esp32s3 | ||
idf.py build | ||
idf.py -p {port} erase-flash flash monitor | ||
``` | ||
|
||
This example will detect the RCP firmware built in ESP-IDF path and flash it to | ||
the spiffs partition. When starting this example, the ESP32-S3 will compare the | ||
versions of both the RCP firmware in the spiffs partition and the firmware on | ||
ESP32-H2. if the spiffs RCP firmware is newer than the firmware on ESP32-H2, the | ||
Thread BR will flash the RCP firmware to ESP32-H2 automatically. | ||
|
||
### OpenThread CLI | ||
|
||
After you build this example and flash it to the ESP32-S3 of Border Router | ||
Board, you can access a standard OpenThread CLI via the device console with a | ||
`matter otcli` prefix. | ||
|
||
For instance, you can get the state: | ||
|
||
``` | ||
> matter otcli state | ||
Detached | ||
Done | ||
``` | ||
|
||
### Setup Thread Network | ||
|
||
You can send SetActiveDatasetRequest command to the Thread BR after | ||
commissioning it as a Matter-Over-Wi-Fi device to setup the Thread network or | ||
join an existing Thread network. | ||
|
||
``` | ||
./chip-tool pairing ble-wifi 1 <ssid> <password> 20202021 3840 | ||
./chip-tool generalcommissioning arm-fail-safe 180 1 1 0 | ||
./chip-tool threadborderroutermanagement set-active-dataset-request hex:<dataset-tlvs> 1 1 1 | ||
./chip-tool generalcommissioning commissioning-complete 1 0 | ||
``` | ||
|
||
The Thread BR with enable the Thread network interface and start Thread network | ||
after it receives SetActiveDatasetRequest command. And after the Thread BR sets | ||
up or join a Thread network, it will send the success response. | ||
|
||
### Commissioning Thread End Devices | ||
|
||
After setting up the Thread network, you can commission a Thread End-device to | ||
the Thread network. | ||
|
||
``` | ||
./chip-tool pairing ble-wifi 2 hex:<dataset_tlvs> <pincode> <discriminator> | ||
``` |
Oops, something went wrong.