Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zigbee_On_Off_Light fails to connect immediately on ESP32C6 #10951

Open
1 task done
sierra-m opened this issue Feb 10, 2025 · 1 comment
Open
1 task done

Zigbee_On_Off_Light fails to connect immediately on ESP32C6 #10951

sierra-m opened this issue Feb 10, 2025 · 1 comment
Assignees
Labels
Area: Zigbee Issues and Feature Request about Zigbee

Comments

@sierra-m
Copy link

Board

ESP32C6

Device Description

Seeed Studio XIAO ESP32C6

Hardware Configuration

No

Version

other

IDE Name

Arduino IDE

Operating System

Windows 11

Flash frequency

80MHz

PSRAM enabled

yes

Upload speed

921600

Description

After flashing the example Zigbee_On_Off_Light.ino sketch to the device, it appears to initialize Zigbee, then almost immediately fails with Network steering was not successful. I expected it to connect to my open Sonoff Zigbee dongle, which I successfully detected (after like 5-10 seconds) with the Zigbee_Scan_Networks.ino sketch:

[  7994][V][ZigbeeCore.cpp:367] scanCompleteCallback(): Network 0: PAN ID: 0x2ac8, Permit Joining: Yes, Extended PAN ID: db:94:6e:a1:2d:85:41:56, Channel: 11, Router Capacity: Yes, End Device Capacity: Yes

Normally, Zigbee devices connect automatically to it, so I'm not sure why this one won't.

Sketch

// Copyright 2024 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @brief This example demonstrates simple Zigbee light bulb.
 *
 * The example demonstrates how to use Zigbee library to create a end device light bulb.
 * The light bulb is a Zigbee end device, which is controlled by a Zigbee coordinator.
 *
 * Proper Zigbee mode must be selected in Tools->Zigbee mode
 * and also the correct partition scheme must be selected in Tools->Partition Scheme.
 *
 * Please check the README.md for instructions and more detailed description.
 *
 * Created by Jan Procházka (https://github.com/P-R-O-C-H-Y/)
 */

#ifndef ZIGBEE_MODE_ED
#error "Zigbee end device mode is not selected in Tools->Zigbee mode"
#endif

#include "Zigbee.h"

/* Zigbee light bulb configuration */
#define ZIGBEE_LIGHT_ENDPOINT 10
uint8_t led = LED_BUILTIN;
uint8_t button = BOOT_PIN;

ZigbeeLight zbLight = ZigbeeLight(ZIGBEE_LIGHT_ENDPOINT);

/********************* RGB LED functions **************************/
void setLED(bool value) {
  digitalWrite(led, value);
}

/********************* Arduino functions **************************/
void setup() {
  Serial.begin(115200);

  // Init LED and turn it OFF (if LED_PIN == RGB_BUILTIN, the rgbLedWrite() will be used under the hood)
  pinMode(led, OUTPUT);
  digitalWrite(led, LOW);

  // Init button for factory reset
  pinMode(button, INPUT_PULLUP);

  //Optional: set Zigbee device name and model
  zbLight.setManufacturerAndModel("Espressif", "ZBLightBulb");

  // Set callback function for light change
  zbLight.onLightChange(setLED);

  //Add endpoint to Zigbee Core
  Serial.println("Adding ZigbeeLight endpoint to Zigbee Core");
  Zigbee.addEndpoint(&zbLight);

  // When all EPs are registered, start Zigbee. By default acts as ZIGBEE_END_DEVICE
  if (!Zigbee.begin()) {
    Serial.println("Zigbee failed to start!");
    Serial.println("Rebooting...");
    ESP.restart();
  }
  Serial.println("Connecting to network");
  while (!Zigbee.connected()) {
    Serial.print(".");
    delay(100);
  }
  Serial.println();
}

void loop() {
  // Checking button for factory reset
  if (digitalRead(button) == LOW) {  // Push button pressed
    // Key debounce handling
    delay(100);
    int startTime = millis();
    while (digitalRead(button) == LOW) {
      delay(50);
      if ((millis() - startTime) > 3000) {
        // If key pressed for more than 3secs, factory reset Zigbee and reboot
        Serial.println("Resetting Zigbee to factory and rebooting in 1s.");
        delay(1000);
        Zigbee.factoryReset();
      }
    }
    // Toggle light by pressing the button
    zbLight.setLight(!zbLight.getLightState());
  }
  delay(100);
}

Debug Message

[     0][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Dein=========== Before Setup Start ===========
Chip Info:
------------------------------------------
  Model             : ESP32-C6
  Package           : 1
  Revision          : 0.01
  Cores             : 1
  CPU Frequency     : 160 MHz
  XTAL Frequency    : 4Embedded Flash    : No
  Embedded PSRAM    : No
  2.4GHz WiFi       : Yes
  Classic BT        : No
  BT Low Energy     : Yes
  IEEE 802.15.4     : Yes
------------------------------------------
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   451132 B ( 440.6 KB)
  Free Bytes        :   415388 B ( 405.7 KB)
  Allocated Bytes   :    28584 B (  27.9 KB)
  Minimum Free Bytes:   410400 B ( 400.8 KB)
  Largest Free Block:   385012 B ( 376.0 KB)
------------------------------------------
Flash Info:
------------------------------------------
  Chip Size         :  4194304 B (4 MB)
  Block Size        :    65536 B (  64.0 KB)
  Sector Size       :     4096 B (   4.0 KB)
  Page Size         :      256 B (   0.2 KB)
  Bus Speed         : 40 MHz
  Bus Mode          : QIO
------------------------------------------
Partitions Info:
------------------------------------------
                nvs : addr: 0x00009000, size:    20.0 KB, type: DATA, subtype: NVS
            otadata : addr: 0x0000E000, size:     8.0 KB, type: DATA, subtype: OTA
               app0 : addr: 0x00010000, size:  1280.0 KB, type:  APP, subtype: OTA_0
               app1 : addr: 0x00150000, size:  1280.0 KB, type:  APP, subtype: OTA_1
             spiffs : addr: 0x00290000, size:  1388.0 KB, type: DATA, subtype: SPIFFS
         zb_storage : addr: 0x003EB000, size:    16.0 KB, type: DATA, subtype: FAT
             zb_fct : addr: 0x003EF000, size:     4.0 KB, type: DATA, subtype: FAT
           coredump : addr: 0x003F0000, size:    64.0 KB, type: DATA, subtype: COREDUMP
------------------------------------------
Software Info:
------------------------------------------
  Compile Date/Time : Feb  9 2025 22:07:20
  Compile Host OS   : windows
  ESP-IDF Version   : v5.3.2-282-gcfea4f7c98-dirty
  Arduino Version   : 3.1.1
------------------------------------------
Board Info:
------------------------------------------
  Arduino Board     : XIAO_ESP32C6
  Arduino Variant   : XIAO_ESP32C6
  Arduino FQBN      : esp32:esp32:XIAO_ESP32C6:UploadSpeed=921600,CDCOnBoot=cdc,CPUFreq=160,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=zigbee,DebugLevel=verbose,EraseFlash=none,JTAGAdapter=default,ZigbeeMode=ed
============ Before Setup End ============
[  4496][I][esp32-hal-periman.c:141] perimanSetPinBus(): Pin 12 already has type USB_DM (38) with bus 0x40810238
[  4496][I][esp32-hal-periman.c:141] perimanSetPinBus(): Pin 13 already has type USB_DP (39) with bus 0x40810238
[  4497][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x4200372a
[  4497][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 15 successfully set to type GPIO (1) with bus 0x10
[  4498][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x4200372a
[  4498][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 9 successfully set to type GPIO (1) with bus 0xa
Adding ZigbeeLight endpoint to Zigbee Core
[  4499][D][ZigbeeCore.cpp:84] addEndpoint(): Endpoint: 10, Device ID: 0x0100
[  4499][D][ZigbeeCore.cpp:123] zigbeeInit(): Initialize Zigbee stack
[  4556][D][ZigbeeCore.cpp:130] zigbeeInit(): Register all Zigbee EPs in list
[  4557][I][ZigbeeCore.cpp:138] zigbeeInit(): List of registered Zigbee EPs:
[  4558][I][ZigbeeCore.cpp:140] zigbeeInit(): Device type: On/Off Light Device, Endpoint: 10, Device ID: 0x0100
[  4561][V][ZigbeeCore.cpp:352] esp_zb_app_signal_handler(): ZDO signal: ZDO Config Ready (0x17), status: ESP_FAIL
[  4562][I][ZigbeeCore.cpp:219] esp_zb_app_signal_handler(): Zigbee stack initialized
[  4564][I][ZigbeeCore.cpp:225] esp_zb_app_signal_handler(): Device started up in  factory-reset mode
[  4565][I][ZigbeeCore.cpp:232] esp_zb_app_signal_handler(): Start network steering
Connecting to network
.......................[  6792][I][ZigbeeCore.cpp:290] esp_zb_app_signal_handler(): Network steering was not successful (status: ESP_FAIL)
................................[ 10021][I][ZigbeeCore.cpp:290] esp_zb_app_signal_handler(): Network steering was not successful (status: ESP_FAIL)
................................[ 13249][I][ZigbeeCore.cpp:290] esp_zb_app_signal_handler(): Network steering was not successful (status: ESP_FAIL)
.................................[ 16477][I][ZigbeeCore.cpp:290] esp_zb_app_signal_handler(): Network steering was not successful (status: ESP_FAIL)
................................[ 19706][I][ZigbeeCore.cpp:290] esp_zb_app_signal_handler(): Network steering was not successful (status: ESP_FAIL)
......

Other Steps to Reproduce

Running on board version 3.1.1, but it wasn't in the versions drop-down. The only modification I made to the sketch was changing RBG_BUILTIN to LED_BUILTIN.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@sierra-m sierra-m added the Status: Awaiting triage Issue is waiting for triage label Feb 10, 2025
@P-R-O-C-H-Y
Copy link
Member

Hi @alecthegeek, I am also using the SonOff Zigbee dongle without any issues. Can you please select to use the debug zigbee libs in the Tools menu - Zigbee mode: Zigbee ED (end Device) - Debug and post a full log again?

From what I remember on other issues, the seedstudio may have a poor antenna. We will see from logs :)

@P-R-O-C-H-Y P-R-O-C-H-Y self-assigned this Feb 10, 2025
@P-R-O-C-H-Y P-R-O-C-H-Y added Area: Zigbee Issues and Feature Request about Zigbee and removed Status: Awaiting triage Issue is waiting for triage labels Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Zigbee Issues and Feature Request about Zigbee
Projects
None yet
Development

No branches or pull requests

2 participants