esp-idf/examples/zigbee/esp_zigbee_gateway
Harshit Malpani bbbede07d0
fix(partition_table): Check partition size for type APP
The size of partition of type APP should be multiple of 4 KB. Partition
generation tool now make this as a mandatory requirement. This is
minimum flash erase size. If the size of the APP type partition is not
aligned to 4 KB then the last erase operation could go beyond the allocated
partition and hence may fail. This issue would only be observed when the
firmware size grows very close to the allocated partition size, and hence
causing the OTA update to fail.

For already deployed devices on-field with the size of APP partition not
aligned to flash sector boundary, it is best to ensure that firmware
size always remains within the lower 4 KB boundary of the total
allocated space. While migrating to ESP-IDF 5.3 release, partition table
for an existing project can be adjusted accordingly for the build to
succeed.

Found during discussion in https://github.com/espressif/esp-idf/pull/12460
2023-12-11 10:14:57 +05:30
..
main fix(wifi/mesh): fix the IE crypto disable error and update doc 2023-11-08 10:24:45 +08:00
CMakeLists.txt feat(examples): add local components via idf_component.yml 2023-09-19 10:38:24 +02:00
partitions.csv fix(partition_table): Check partition size for type APP 2023-12-11 10:14:57 +05:30
README.md docs: update the readme for Thread/Zigbee examples 2023-04-07 12:22:52 +08:00
sdkconfig.defaults zigbee: zigbee gateway support for single chip esp32-c6 solution 2023-04-07 11:24:19 +08:00

Supported Targets ESP32 ESP32-C3 ESP32-C6 ESP32-S2 ESP32-S3

Gateway Example

This example demonstrates how to build a Zigbee Gateway device.

The ESP Zigbee SDK provides more examples and tools for productization:

Hardware Required

By default, two SoCs are required to run this example:

  • An ESP32 series Wi-Fi SoC (ESP32, ESP32-C, ESP32-S, etc) loaded with this esp_zigbee_gateway example.
  • An ESP32-H2 802.15.4 SoC loaded with esp_zigbee_rcp example

Connect the two SoCs via UART, below is an example setup with ESP32-DevKitC and ESP32-H2-DevKitC: Zigbee_gateway

ESP32 pin ESP32-H2 pin
GND G
GPIO4 (RX) TX
GPIO5 (TX) RX
  • TX, RX pin can be also configured by user in esp_zigbee_gateway.h

The example could also run on a single SoC which supports both Wi-Fi and Zigbee (e.g., ESP32-C6), but since there is only one RF path in ESP32-C6, which means Wi-Fi and Zigbee can't receive simultaneously, it has a significant impact on performance. Hence the two SoCs solution is recommended.

Configure the project

Before project configuration and build, make sure to set the correct chip target using idf.py set-target <chip_name>.

In order to run the example on single SoC which supports both Wi-Fi and Thread, the option CONFIG_ESP_COEX_SW_COEXIST_ENABLE and option CONFIG_ZB_RADIO_NATIVE should be enabled. The two options are enabled by default for ESP32-C6 target.

Erase the NVRAM

Before flash it to the board, it is recommended to erase NVRAM if user doesn't want to keep the previous examples or other projects stored info using idf.py -p PORT erase-flash

Build and Flash

Build the project, flash it to the board, and start the monitor tool to view the serial output by running idf.py -p PORT flash monitor

(To exit the serial monitor, type Ctrl-].)

Example Output

As you run the example, you will see the following log:

esp_zigbee_gateway:

I (660) ESP_ZB_GATEWAY: status: -1
I (670) ESP_ZB_GATEWAY: Zigbee stack initialized
I (680) ESP_ZB_GATEWAY: Zigbee rcp device booted
I (1280) ESP_ZB_GATEWAY: Start network formation
I (3060) ESP_ZB_GATEWAY: Formed network successfully (ieee extended address: f9:54:2d:01:a0:03:f7:84, PAN ID: 0x8651)
I (4060) ESP_ZB_GATEWAY: status: 0
I (4400) ESP_ZB_GATEWAY: Network steering started

Gateway Functions

  • After Zigbee gateway starts up, it will read MAC ieee address and Zigbee stack version number from the Zigbee rcp and start working together with Zigbee rcp via UART communication to form a Zigbee network
  • More Gateway functionalities supporting Wi-Fi interaction will come later

Troubleshooting

For any technical queries, please open an issue on GitHub. We will get back to you soon