-
Notifications
You must be signed in to change notification settings - Fork 29
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
Fail to connect to short PAN ID (TZ-1021) #388
Comments
@kgkask , The Extended PAN ID is defined that it is the globally unique 64-bit PAN identifier of the network. This identifier should be |
@xieqinan This is what I expect it, and as work around I thought that using the short PAN ID would work and it happens sometimes after multiple attempts to join the wrong network. So I want to look for a way to connect to the setted network without using "esp_zb_bdb_start_top_level_commissioning()" function since it does not follow the behavior I am looking for. |
@xieqinan Is there other way to check if connecting or setting the extended PAN ID is working ? |
Is there an update to solve this issue? |
@kgkask , If you intend to connect to the network without using |
@xieqinan The use of |
@kgkask , I think there might be a misunderstanding. The issue you're encountering, where the End Devices (EDs) randomly connect to any network, is likely caused by the use of the same Extended PAN ID across multiple networks in your test environment. This behavior occurs because the same Extended PAN ID is being used due to calling Could you please explain why you need the same Extended PAN ID across multiple networks in your environment? To address this issue, we should use |
@xieqinan first thanks for the reply As you can see when I scan the extended Pan ID is not unique at all not sure why? , so as work around I used the short Pan ID. if there is a way to start each coordinator with different extended Pan ID it might be helpful but as you can see below: |
@kgkask , If you have not changed the example in the SDK, the extended PAN ID will be set using the device's MAC address. To resolve this issue, I need to confirm the following questions:
|
The feature I want to add non, but the basic behavior light_switch example
acta the same.
I am using a way changed code for my project so it might me confusing, for the main differences they are stated in the issue.
I am using Arduino version for this project, which is 3.0.4.
…On Wed, Aug 7, 2024, 4:16 PM xieqinan ***@***.***> wrote:
@kgkask <https://github.com/kgkask> ,
Which example of SDK used by you acts as the coordinator?
—
Reply to this email directly, view it on GitHub
<#388 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BIMZNFL5BW7CH426RUO226LZQIF2DAVCNFSM6AAAAABLN76DB6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZTGMZTENZSGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I suggest you try using the default |
Good idea I will try it and let you know. Thanks |
As an update for this issue, the and |
@kgkask , Good job! You can call |
after long debugging, I reached to what I expect to be the source of the issue which is memcpy() func in Arduino which I think it copies the extended_PAN_ID in wrong way so when I use it to connect to certain it fails and I do not know since the below image shows the error appears from copying the PAN ID. here is the simple light_switch example I used to reproduce the issue. NOTE: I could not find a simple example to try if |
@kgkask , Please ensure the |
I according to my case I need it to be used within the Zigbee loop, which is after calling Anyhow, I will make sure that it works first in the same manner you mentioned and then try it in other cases. one question, the argument passed to the function is of type basically, I mean what is the format of the argument passed to the function ? ? Much thanks |
I called the function Here is the output of the code: at the beginning the ED connected to "74:4d:bd:ff:fe:60:31:13" and the scanned all available networks and then copied the first scanned network which is "40:4c:ca:ff:fe:47:ad:c0" to SO!!! basically here is the code if someone wanna verify |
@kgkask ,
From the logs, it appears that the available networks are being scanned after the device has already joined a network, so the I have modified the example you provided and attached it here. I have not the environment to test the code, but you can search for |
I have checked the code Thanks for that. the issue is I need to connect to the ZCR based on certain value that I need to fetch from the ED first then decided, not only scan for available networks. anyway, your code answers the question of how to used Much thanks <3 @xieqinan |
@kgkask feel free to reopen if any follow up questions. |
Question
how to make end devices join the correct Zigbee network based on a manually set serial number in multiple Zigbee network environment?
Additional context.
I am using three ESP32-H2 and one ESP32-C6. I want to implement a mechanism for joining a network based on a manually set serial number on each device. I was able to do this part where I can check it from the end device and remove it from the network based on that. However, now I want to check it in the existence of multiple networks. So I used two H2 and one C6 as coordinators; one of them has the correct serial number, and the others do not. At the beginning of the communication, I join any network normally and exchange the serial number. If it matches, done. Otherwise, the end device is removed from the network, scans all available networks once using 'esp_zb_zdo_active_scan_request', saves the result in a stack, and then checks if the current short PAN ID 'esp_zb_get_pan_id' matches one of the available ones. It removes it from the stack and sets the last network PAN ID in the stack using 'esp_zb_set_pan_id'.
I am not using 'esp_zb_set_extended_pan_id' because the scan result shows all extended PAN IDs are the same.
I referred to #378 #81 and see that setting the PAN does not work, and even for me, the behavior sometimes meets my expectations where it must iterate and join all networks in the stack one by one, but this did not happen.
I am not sure if there is a shortcut for this, but here is my implementation for the callback function of the scan procedure.
`void zigbee_scan_available_nwk_callback(esp_zb_zdp_status_t zdo_status, uint8_t count, esp_zb_network_descriptor_t *nwk_descriptor) {
// get current nwk PAN id before leaving it
uint16_t current_pan_id = esp_zb_get_pan_id();
//#################### Leave nwk serial number did not match ###########
// Initialize the leave request parameter structure
esp_zb_zdo_mgmt_leave_req_param_t leave_req;
esp_zb_ieee_addr_t ieee_addr;
uint16_t short_addr = esp_zb_get_short_address(); // Example network address
// Copy the retrieved IEEE address to the leave request structure
memcpy(leave_req.device_address, ieee_addr, sizeof(esp_zb_ieee_addr_t));
leave_req.dst_nwk_addr = short_addr;
leave_req.reserved = 0;
leave_req.remove_children = 1; // Set to 1 if children should be removed
leave_req.rejoin = 0; // Set to 1 if the device should rejoin after leaving
// Call the leave request function
esp_zb_lock_acquire(portMAX_DELAY);
//esp_zb_zdo_device_leave_req(&leave_req, NULL, NULL);
esp_zb_bdb_reset_via_local_action();
esp_zb_lock_release();
//########################################################################
if (!has_scanned) {
// Perform network scan
if (zdo_status != ESP_ZB_ZDP_STATUS_SUCCESS) {
log_i("Zigbee network scan failed with status: %d\n", zdo_status);
}
}
}`
here is scan result:
The text was updated successfully, but these errors were encountered: