zigbee_router_c6/readme.md

56 lines
2.4 KiB
Markdown

# ESP32-C6 Zigbee Router
A dedicated Zigbee router firmware for an ESP32-C6 development board. Its purpose is to extend the range and improve the reliability of a Zigbee mesh network.
## Hardware
* ESP32-C6 Development Board (with 4MB Flash)
## Software
* ESP-IDF v5.4.2
## Build and Flash
1. Clone the repository.
2. Navigate to the project directory.
3. Source the ESP-IDF environment:
```bash
. /path/to/esp-idf/export.sh
```
4. Set the target and open the configuration menu:
```bash
idf.py set-target esp32c6
idf.py menuconfig
```
5. Confirm the settings are correct (especially Partition Table and Flash Size), then Save and Quit.
6. Build the project:
```bash
idf.py build
```
7. Flash the device (replace `/dev/ttyACM0` with your device's port):
```bash
idf.py -p /dev/ttyACM0 flash
```
## Key Configuration & Troubleshooting Notes
This project required several specific configurations to resolve build and runtime errors:
1. **Partition Table (`partitions.csv`):** The ESP-Zigbee stack requires `zb_storage` and `zb_fct` partitions. These must be defined in `partitions.csv` with explicit hexadecimal sizes to ensure correct parsing.
2. **`menuconfig` - Partition Table:** The build system will ignore the custom `partitions.csv` file unless explicitly configured. This is set under `Partition Table --->` by changing the type to `Custom partition table CSV`.
3. **`menuconfig` - Flash Size:** The project must be configured to match the board's physical flash size (4MB). This is set under `Serial flasher config --->`. A mismatch causes a boot loop with `invalid header: 0xffffffff` errors.
4. **`main/CMakeLists.txt` Dependencies:** The main component requires explicit dependencies to find necessary headers. The `REQUIRES` line must include `esp-zigbee-lib`, `nvs_flash`, and `freertos`.
5. **API Versioning:** The Zigbee configuration macros must match the installed `esp-zigbee-lib` version. This firmware uses:
* `.esp_zb_role = ESP_ZB_DEVICE_TYPE_ROUTER`
* `.nwk_cfg.zczr_cfg` for the router network configuration.
* `.app_device_id = ESP_ZB_HA_TEST_DEVICE_ID` as a valid, defined device ID.
## Behavior
Once flashed and powered, the device will automatically attempt to join an open Zigbee network. To pair, put your Zigbee coordinator (e.g., ZHA, Zigbee2MQTT) into "Permit Join" or "Add Device" mode and power on the router.