espressif / esp-zigbee-sdk

Espressif Zigbee SDK
Apache License 2.0
151 stars 26 forks source link

esp_zb_set_extended_pan_id has no effect (TZ-980) #378

Open rsibille opened 2 months ago

rsibille commented 2 months ago

Question

Hello I'm facing the same issue as described in issue #81 : setting the extended PAN ID on the ED (end device) seems to have no effect.

The situation is :

Enabling the trace :

So my questions are :

  1. is this call correct ?
    esp_zb_ieee_addr_t ext_pan_id = {0xF4, 0x82, 0x44, 0xFE, 0xFF, 0xCA, 0x4C, 0x40}; // 40:4c:ca:ff:fe:44:82:f4
    esp_zb_set_extended_pan_id(ext_pan_id);
  2. must I also call esp_zb_set_pan_id()
  3. when should I do these calls ? They are currently inside case ESP_ZB_BDB_SIGNAL_DEVICE_REBOOT:

Thanks in advance for any clue.

Additional context.

No response

lpy4105 commented 1 month ago
  1. is this call correct ?

It's correct, but please do it before the stack starts. You can do this after esp_zb_init and before esp_zb_start. I hope this would work for you.

rsibille commented 1 month ago

Thanks a lot for your indication, I was indeed calling it too late. Now the device seems to correctly record the extpanid, but I have to try more than 10 times to start network steering before it succeeds. The call is : esp_zb_scheduler_alarm((esp_zb_callback_t) cb_bdb_start_top_level_commissioning, ESP_ZB_BDB_MODE_NETWORK_STEERING, 2000);

and the failing attemps log :

ZBOSS: commissioning/bdb/zdo_commissioning_bdb.c:349   dev type 2, joined 1, ext_pan_id 1, authenticated 1, tclk_valid 1
ZBOSS: nwk/nwk_join.c:629   Rejoin failure: no dev with xpanid 40:4c:ca:ff:fe:44:82:f4 or can't choose best parent
ZBOSS: commissioning/bdb/zdo_commissioning_bdb.c:549   COMMISSIONING_STOP: app signal 6 comm status 3

Is this the expected behavior ?

lpy4105 commented 1 month ago

@rsibille Could you please share the steps to reproduce the issue?

xieqinan commented 1 month ago

@rsibille ,

The esp_zb_set_extended_pan_id() function allows devices to join a specific network. However, this also depends on the network's state, meaning that if the beacon LQI is lower than 32 (the default setting in the SDK) or if the network is closed as indicated in the beacon frame, the device based on the ESP Zigbee stack will reject joining it.

The esp-zigbee-sdk provides the esp_zb_secur_network_min_join_lqi_set() function to set the minimum LQI threshold for device joining. You can use it to adjust the threshold and test again.