docs: Zigbee Bridge readme file improvement

This commit is contained in:
WanqQixiang
2023-11-23 14:11:28 +08:00
parent d26a261266
commit 25e271c4f9
5 changed files with 132 additions and 30 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 906 KiB

+45 -28
View File
@@ -2,8 +2,7 @@
This example demonstrates a Matter-Zigbee Bridge that bridges Zigbee devices to Matter fabric.
The Matter Bridge device is composed of two parts: The RCP running on
ESP32-H2 and the bridge app running on ESP32.
The Matter Bridge device is composed of two parts: The RCP running on ESP32-H2 and the bridge app running on ESP32-S3.
See the [docs](https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html) for more information about building and flashing the firmware.
@@ -11,41 +10,64 @@ See the [docs](https://docs.espressif.com/projects/esp-matter/en/latest/esp32/de
### 1.1 Hardware connection
Connect the two SoCs via UART, below is an example setup with ESP32
DevKitC and ESP32-H2 DevKitC:
There are two hardware type options for this example. You can choose one of the two options in menuconfig `ESP Matter Zigbee Bridge Example`->`Zigbee Bridge board type`.
#### 1.1.1 Standalone DevKit boards
Connect the two SoCs via UART, below is an example setup with ESP32-S3 DevKitC and ESP32-H2 DevKitC:
![Zigbee Bridge Hardware Connection](../../docs/_static/zigbee_bridge_hardware_connection.jpg)
| ESP32 Pin | ESP32-H2 Pin |
|-------------|--------------|
| GND | GND |
| GPIO4 | GPIO7 |
| GPIO5 | GPIO8 |
| ESP32-S3 Pin | ESP32-H2 Pin |
|----------------|--------------|
| GND | GND |
| GPIO4 | TX |
| GPIO5 | RX |
#### 1.1.2 Zigbee Gateway DevKit board
![Zigbee Gateway DevKit Board](../../docs/_static/esp-thread-border-router-zigbee-gateway-board.png)
### 1.2 Build and flash the RCP (ESP32-H2)
```
cd ${IDF_PATH}/examples/zigbee/esp_zigbee_rcp/
idf.py --preview set-target esp32h2
idf.py set-target esp32h2
idf.py -p <port> build flash
```
The Matter Bridge will run on the ESP32 and Zigbee network will be
formed.
**Note**: The two SoCs on the Zigbee Gateway DevKit board use USB ports while the standalone DevKit boards use UART ports.
### 1.3 Build and flash the Bridge (ESP32S3)
For Standalone DevKit boards:
```
cd ${ESP_MATTER_PATH}/examples/zigbee_bridge
idf.py set-target esp32s3
idf.py -p <port> build flash
```
For Zigbee Gateway board:
```
cd ${ESP_MATTER_PATH}/examples/zigbee_bridge
idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults.zb_gw_board" set-target esp32s3 build
idf.py -p <port> flash
```
The Matter Zigbee Bridge will run on the ESP32-S3 and Zigbee network will be formed.
## 2. Post Commissioning Setup
### 2.1 Discovering Zigbee Devices
You can read the parts list from the Bridge to get the number of the
bridged devices.
You can read the PartsList from the Bridge to get the number of the bridged devices.
```
descriptor read parts-list 0x7283 0x0
```
If there is no other Zigbee device on the Zigbee Network, you will get
a result with only an aggregator endpoint. Example:
If there is no other Zigbee device on the Zigbee Network, you will get a result with only an aggregator endpoint. Example:
```
Data = [
@@ -53,8 +75,7 @@ Data = [
],
```
Then read the parts list from the Aggregator Endpoint, you will get an
empty result.
Then read the PartsList from the Aggregator Endpoint, you will get an empty result.
```
descriptor read parts-list 0x7283 0x1
@@ -70,21 +91,18 @@ Data = [
Build and run Zigbee Bulb app on another ESP32-H2 board.
```
cd ${IDF_PATH}/examples/zigbee/light_sample/light_bulb
idf.py --preview set-target esp32h2
cd ${IDF_PATH}/examples/zigbee/light_sample/HA_on_off_light
idf.py set-target esp32h2
idf.py -p <port> build flash monitor
```
The Zigbee Bulb will be added to the Zigbee Network and a dynamic
endpoint will be added on the Bridge device. You can read the parts list
on Aggregator Endpoint again to get the dynamic endpoint ID.
The Zigbee Bulb will be added to the Zigbee Network and a dynamic endpoint will be added on the Bridge device. You can read the PartsList on Aggregator Endpoint again to get the dynamic endpoint ID.
```
descriptor read parts-list 0x7283 0x1
```
The data will now contain the information of the connected Zigbee
devices. Example:
The data will now contain the information of the connected Zigbee devices. Example:
```
Data = [
@@ -92,8 +110,7 @@ Data = [
],
```
It means that the Zigbee Bulb is added as Endpoint 1 on the Zigbee
Bridge. You can read the device type list on the dynamic endpoint.
It means that the Zigbee Bulb is added as Endpoint 1 on the Zigbee Bridge. You can read the DeviceTypeList on the dynamic endpoint.
```
descriptor read device-type-list 0x7283 2
@@ -113,7 +130,7 @@ DeviceTypeList: 2 entries
}
```
You can also read the cluster servers list on the dynamic endpoint.
You can also read the cluster ServerList on the dynamic endpoint.
```
descriptor read server-list 0x7283 0x1
@@ -0,0 +1,34 @@
menu "ESP Matter Zigbee Bridge Example"
choice ESP_MATTER_ZIGBEE_BRIDGE_BOARD_TYPE
prompt "Zigbee Bridge board type"
default ESP_MATTER_ZIGBEE_BRIDGE_BOARD_STANDALONE
help
The board running the Zigbee bridge.
config ESP_MATTER_ZIGBEE_BRIDGE_BOARD_STANDALONE
bool "Standalone DevKits"
help
Standalone ESP Wi-Fi DevKits (Such as ESP32/ESP32-S3) manually connected to the Zigbee RCP (Such as ESP32-H2)
config ESP_MATTER_ZIGBEE_BRIDGE_BOARD_DEV_KIT
bool "Zigbee gateway DevKit"
help
Integrated Zigbee gateway DevKit
endchoice
menu "Board Configuration"
config PIN_TO_RCP_TX
int "Pin to RCP TX"
default 17 if ESP_MATTER_ZIGBEE_BRIDGE_BOARD_DEV_KIT
default 4 if ESP_MATTER_ZIGBEE_BRIDGE_BOARD_STANDALONE
config PIN_TO_RCP_RX
int "PIN to RCP RX"
default 18 if ESP_MATTER_ZIGBEE_BRIDGE_BOARD_DEV_KIT
default 5 if ESP_MATTER_ZIGBEE_BRIDGE_BOARD_STANDALONE
endmenu
endmenu
+3 -2
View File
@@ -9,6 +9,7 @@
#pragma once
#include "esp_err.h"
#include "sdkconfig.h"
#include <stdint.h>
/*Zigbee Configuration*/
@@ -43,8 +44,8 @@
.rx_flow_ctrl_thresh = 0, \
.source_clk = UART_SCLK_APB, \
}, \
.rx_pin = 4, \
.tx_pin = 5, \
.rx_pin = CONFIG_PIN_TO_RCP_TX, \
.tx_pin = CONFIG_PIN_TO_RCP_RX, \
}, \
}
@@ -0,0 +1,50 @@
# esptool
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
#enable BT
CONFIG_BT_ENABLED=y
CONFIG_BT_NIMBLE_ENABLED=y
CONFIG_BT_NIMBLE_TASK_STACK_SIZE=5120
#enable lwip ipv6 autoconfig
CONFIG_LWIP_IPV6_AUTOCONFIG=y
# Use a custom partition table
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
# Enable chip shell
CONFIG_ENABLE_CHIP_SHELL=y
#enable lwIP route hooks
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y
# Watchdog
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=n
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=n
# Zboss
CONFIG_ZB_ENABLED=y
CONFIG_ZB_ZCZR=y
CONFIG_ZB_HOST=y
# System event stack size
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072
# Zigbee Gateway DevKit Board
CONFIG_ESP_MATTER_ZIGBEE_BRIDGE_BOARD_DEV_KIT=y
# USB Console
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
# Use compact attribute storage mode
CONFIG_ESP_MATTER_NVS_USE_COMPACT_ATTR_STORAGE=y
# Enable HKDF in mbedtls
CONFIG_MBEDTLS_HKDF_C=y
# Increase LwIP IPv6 address number to 6 (MAX_FABRIC + 1)
# unique local addresses for fabrics(MAX_FABRIC), a link local address(1)
CONFIG_LWIP_IPV6_NUM_ADDRESSES=6