This tutorial will guide you on how to run the ESP Zigbee Host/NCP example program using the Unit Gateway H2 paired with the CoreS3 main controller. ESP Zigbee NCP (Network Co-Processor) is a network co-processor mode that runs the Zigbee protocol stack on a separate processor, communicating with the main processor via a serial interface. This architecture allows the main processor to focus on application-layer logic while offloading Zigbee network-related processing to the co-processor. Follow the tutorial below to flash the ESP Zigbee NCP firmware onto the Unit Gateway H2 and the ESP Zigbee Host firmware onto the CoreS3 to create a Coordinator node.
v5.3.1
for compiling this example.git clone --recursive https://github.com/espressif/esp-idf.git
cd esp-idf
git checkout v5.3.1 # recommend
./install.sh
. ./export.sh
clone recursive
to clone the ESP-Zigbee-SDK repository.git clone --recursive https://github.com/espressif/esp-zigbee-sdk.git
cd esp-zigbee-sdk
idf.py
depend on ESP-IDF. Before running the commands, execute . ./export.sh
in ESP-IDF to activate the relevant environment variables. For detailed instructions, refer to the
ESP-IDF - ESP32S3 Getting Started Guide
.esp32h2
.cd examples/esp_zigbee_ncp
idf.py set-target esp32h2
idf.py menuconfig
idf.py menuconfig
to enter the configuration page. Configure the device pin information under Component config
-> Zigbee Network Co-processor
.- Component config → Zigbee Network Co-processor
- UART RX Pin: 23
- UART TX Pin: 24
- 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
to erase the flash.idf.py erase_flash
idf.py flash
esp32s3
.cd examples/esp_zigbee_host
idf.py set-target esp32s3 # Use CoreS3
idf.py menuconfig
idf.py menuconfig
to enter the configuration page. Configure the device pin information under Component config
-> Zigbee NCP Host
.- Component config → Zigbee NCP Host
- UART RX Pin: 18
- UART TX Pin: 17
Add the following functions and header files, and call and initialize them at the beginning of app_main to enable the Grove power supply output capability of CoreS3.
#include "driver/i2c.h"
void fix_aw9523_p0_pull_up(void)
{
/* AW9523 P0 is in push-pull mode */
const i2c_config_t i2c_conf = {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_12,
.sda_pullup_en = GPIO_PULLUP_DISABLE,
.scl_io_num = GPIO_NUM_11,
.scl_pullup_en = GPIO_PULLUP_DISABLE,
.master.clk_speed = 400000
};
i2c_param_config(I2C_NUM_1, &i2c_conf);
i2c_driver_install(I2C_NUM_1, i2c_conf.mode, 0, 0, 0);
uint8_t data[2];
data[0] = 0x11;
data[1] = 0x10;
i2c_master_write_to_device(I2C_NUM_1, 0x58, data, sizeof(data), 1000 / portTICK_PERIOD_MS);
i2c_driver_delete(I2C_NUM_1);
}
idf.py build
idf.py flash
idf.py monitor
or other serial debugging tools to view the running logs at 115200bps.Normal Running Log Content: