ESP Matter on ESP32H2

This documentation gives instructions on building and running the Matter light example on ESP32-H2.

Supported ESP-IDF and connectedhomeip versions

  • For Wi-Fi devices (ESP32, ESP32-C3, ESP32-S3), ESP-IDF v4.4.1 release is required.
  • For Thread devices (ESP32-H2), ESP-IDF master branch at commit 047903c should be used.

Hardware Required


  • Ubuntu 20.04 PC, with BLE dongle installed
  • 1x ESP32 DevkitC
  • 2x ESP32-H2 DevKitC
  • Phone (Optional, only required if you want to try the matter phone app)

The Topology:
在这里插入图片描述

Step 1. Getting the Repositories


This only needs to be done once:

$ git clone https://github.com/espressif/esp-matter
$ cd esp-matter/connectedhomeip/connectedhomeip
$ source scripts/bootstrap.sh

Step 2. Configuring the environment


This needs to be done everytime a new terminal is opened:

$ cd /path/to/esp-idf
$ . export.sh
$ cd /path/to/esp-matter/
$ . export.sh
$ cd examples/light/

Step 3. Setup the Thread Border Router (ESP32 + ESP32-H2)


(This step is optional if you have other Thread Border Router solutions)
A Thread border router is required to provide the IP connectivity to the thread end device. A border router
solution shipped in ESP-IDF is composed of two parts: the Radio Co-Processor(RCP) running on ESP32-H2 and
the border router running on ESP32.

Hardware connection:

在这里插入图片描述

ESP32 pinESP32-H2 pin
GNDG
GPIO4TX
GPIO5RX

Build and flash the RCP (ESP32-H2)

cd esp-idf/examples/openthread/ot_rcp
idf.py --preview set-target esp32h2
idf.py -p <port> build flash

Build and flash the border router (ESP32)

cd esp-idf/examples/openthread/ot_br
idf.py set-target esp32
idf.py menuconfig

In the menuconfig, select Example Connection Configuration > connect using WiFi interface . Input thevWiFi SSID and password you’d like to connect to.

idf.py -p <port> flash monitor

The border router will be running on ESP32. It provides an interactive OpenThread shell:

> state
I(23374) OPENTHREAD:[INFO]-CLI-----: execute command: state
leader
Done
>

Step 4. Setup Thread End Device (ESP32-H2)


cd esp-matter/examples/light
idf.py --preview set-target esp32h2
idf.py -p <port> build flash monitor

Now the light app will be running on ESP32-H2.
( Note: If the version of esp32-h2 is displayed wrong when burning (h2 has two versions, date1 and date2). Please go to the menuconfig file to set the chip target to the version used.)

Step 5. Build Matter command line control tool


cd esp-matter/connectedhomeip/connectedhomeip
./scripts/build_python.sh -m platform

Step 6. Pair and control the light end device


Your host machine shall be under the same WiFi as the Thread border router.
First enable ICMPv6 auto configuration on your host machine. Note to replace the interface name wlan0 with the real interface name on your machine.

sudo sysctl -w net/ipv6/conf/wlan0/accept_ra=2
sudo sysctl -w net/ipv6/conf/wlan0/accept_ra_rt_info_max_plen=128

Then on ot_br console, fetch the Thread active dataset to be sent to the device and the networkID to be used for enabling the Thread network :

> dataset active -x
I(111204) OPENTHREAD:[INFO]-CLI-----: execute command: dataset active -x
0e080000000000010000000300000f35060004001fffe00208dead00beef00cafe0708fd44b1f21b8ae77605100
Done
> extpanid
I(111205) OPENTHREAD:[INFO]-CLI-----: execute command: extpanid
dead00beef00cafe
Done

Now run chip-device-ctrl to pair the device:

esp-matter/connectedhomeip/connectedhomeip/out/python_env/bin/chip-device-ctrl
[1631175381.811277][824387:824387] CHIP:IN: local node id is 0x000000000001B669
[1631175381.812494][824387:824387] CHIP:DL: Avahi client registered
[1631175381.812898][824387:824387] CHIP:ZCL: Using ZAP configuration...
[1631175381.812920][824387:824387] CHIP:ZCL: deactivate report event
[1631175381.812926][824387:824387] CHIP:CTL: Getting operational keys
[1631175381.812987][824387:824387] CHIP:CTL: Getting root certificate for the controller fr
[1631175381.813176][824387:824387] CHIP:CTL: Generating operational certificate for the con
[1631175381.813325][824387:824387] CHIP:CTL: Getting intermediate CA certificate from the i
[1631175381.813361][824387:824387] CHIP:CTL: GetIntermediateCACertificate returned 0
[1631175381.813401][824387:824387] CHIP:CTL: Generating credentials
[1631175381.813460][824387:824387] CHIP:CTL: Loaded credentials successfully
[1631175381.815493][824387:824395] CHIP:DL: Platform main loop started.
Chip Device Controller Shell
chip-device-ctrl > connect -ble 3840 20202021 12344321
chip-device-ctrl > zcl NetworkCommissioning AddThreadNetwork 12344321 0 0 operationalDatase
chip-device-ctrl > zcl NetworkCommissioning EnableNetwork 12344321 0 0 networkID=hex:dead00
chip-device-ctrl > close-ble
chip-device-ctrl > resolve 12344321
chip-device-ctrl > zcl OnOff Toggle 12344321 1 0
  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值