• 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
    
    • 1
    • 2
    • 3

    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/
    
    • 1
    • 2
    • 3
    • 4
    • 5

    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
    
    • 1
    • 2
    • 3

    Build and flash the border router (ESP32)

    cd esp-idf/examples/openthread/ot_br
    idf.py set-target esp32
    idf.py menuconfig
    
    • 1
    • 2
    • 3

    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
    
    • 1

    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
    >
    
    • 1
    • 2
    • 3
    • 4
    • 5

    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
    
    • 1
    • 2
    • 3

    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
    
    • 1
    • 2

    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
    
    • 1
    • 2

    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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    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
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
  • 相关阅读:
    开发框架DevExpress XAF - Entity Framework Core 8支持.NET 8性能基准
    网络原理---拿捏TCP机制原理
    申请发明专利的流程及时间
    地级市空气污染、空气质量、PM2.5日度数据
    失物招领|基于Web的校园失物招领系统的设计与实现
    DVWA文件上传漏洞低级_中级_高级
    2.10 XGBoost模型数学层面的理解(上篇)
    深入理解 Srping IOC
    专利过期如何处理?这几个补救方案要知晓!
    20220726NOI模拟赛--考后总结
  • 原文地址:https://blog.csdn.net/Marchtwentytwo/article/details/126254696