pdf-icon

产品上手指引

Zigbee

Thread

Module Gateway H2

IoT 工具

IoT 云端服务

Ethernet 摄像头

拨码开关

Module LoRa868 v1.2

Module LoRa868/433 v1.1

软件工具

ESP Zigbee NCP

本教程将介绍如何使用Module Gateway H2搭配CoreS3主控运行ESP Zigbee Host/NCP案例程序。ESP Zigbee NCP (Network Co-Processor) 是一种网络协处理器模式,它将 Zigbee 协议栈运行在一个独立的处理器上,通过串口与主处理器通信。这种架构可以让主处理器专注于应用层逻辑,而将 Zigbee 网络相关的处理交给协处理器处理。参考下方教程为Module Gateway H2烧录ESP Zigbee NCP固件, 为CoreS3烧录ESP Zigbee Host固件, 实现创建Coordinator节点。

1.准备工作

git clone --recursive https://github.com/espressif/esp-zigbee-sdk.git
cd esp-zigbee-sdk

  • 4.后续教程使用到的idf.py指令均依赖ESP-IDF, 运行指令前需要执行ESP-IDF中. ./export.sh用于激活相关的环境变量。详细说明请参考 ESP-IDF - ESP32S3上手教程

2.编译NCP固件

  • 1.参考下方指令进入对应的NCP固件目录, 设置编译target为esp32h2
cd examples/esp_zigbee_ncp
idf.py set-target esp32h2
idf.py menuconfig
  • 2.使用idf.py menuconfig进入配置页面。在menuconfig中配置设备的引脚信息:Component config -> Zigbee Network Co-processor
- Component config → Zigbee Network Co-processor
  - UART TX Pin: 24
  - UART RX Pin: 23
- Component config → ESP Zigbee → Configure the Zigbee device type
  - Zigbee Coordinator or Router device # or Zigbee End Device
idf.py build
idf.py erase_flash
idf.py flash # 根据实际端口修改

3.编译HOST固件

  • 1.参考下方指令进入对应的HOST固件目录, 设置编译target为esp32s3
cd examples/esp_zigbee_host
idf.py set-target esp32s3 # 使用 CoreS3
idf.py menuconfig
  • 2.使用idf.py menuconfig进入配置页面。在menuconfig中配置设备的引脚信息:Component config -> Zigbee NCP Host
- Component config → Zigbee NCP Host
  - UART TX Pin: 17
  - UART RX Pin: 10
idf.py build
idf.py flash

4.开始运行

  • 将CoreS3与Module Gateway H2连接。
  • 将CoreS3连接至电脑
  • 通过idf.py monitor或其他的串口调试工具在115200bps配置下查看运行日志。

正常运行日志内容:

  • NCP 端显示 Zigbee 协议栈初始化成功
  • Host 端显示与 NCP 连接成功
  • Zigbee 网络创建成功(Coordinator 模式)
On This Page