This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

zigbee leave network and join network problem

Based on zigbee sdk 4.1, in the sample code of light_switch, leaving the network and joining the network are completed by buttons, the code is as follows:

static void forget_network(void)
{
    if (ZB_JOINED())
    {
        zb_bdb_reset_via_local_action(0);
    }
}

static void buttons_handler(bsp_event_t evt)
{
    zb_int32_t button;
    zb_int32_t ret;
    zb_ret_t zb_err_code;

    switch(evt)
    {
        case BSP_EVENT_KEY_0:
            break;

        case BSP_EVENT_KEY_1:
            ret = bdb_start_top_level_commissioning(ZB_BDB_NETWORK_STEERING);
            NRF_LOG_INFO("bdb_start_top_level_commissioning >> STEERING:%d", ret);
            break;

        case BSP_EVENT_KEY_2:
            forget_network();
            return;

        case BSP_EVENT_KEY_3:

            return;

        default:
            NRF_LOG_INFO("Unhandled BSP Event received: %d", evt);
            return;
    }
}

Seen from the log, after pressing button3 to let the device leave the network (line 415). The coordinator prohibits the device from joining the network, but the device can still join the network by pressing button2. Through the packet capture, we can see that the Permit Join Request has timed out for 180s (line 334). But the device can still join the network (lines 418-460). The screenshot of the captured packet is as follows: Complete packet capture data:


Complete packet capture data:leave network and join network.pcapng

Under normal circumstances, after the device leaves the network, if the coordinator prohibits the device from joining the network, the device should not join the coordinator's network.
Question: 1. After the device leaves the network, there is no "Permit Join Request" broadcast in the network. Why does the device still join the network?
2. After the device leaves the network, the "Permit Join Request" is not broadcast in the network. How can the device not join the network?

Parents Reply Children
  • Hi,

    Association permit is automatically set to '1' when you enable permit join on the coordinator. The association permit will stay '1' until permit duration time on mgmt_permit_joining_req has passed. The permit duration is set to  ZB_BDBC_MIN_COMMISSIONING_TIME_S (180s).

    In our light control coordinator example you see that a callback is called in order to visualize the network steering period, steering_finished() is called after the commissioning window has closed (180s) nad the ZIGBEE_NETWORK_STATE_LED (led 1 in the DK) is turned off. The association permit flag should be set to 'False' by the stack then.

    Make sure you are not restarting the network steering procedure again in your code. If you wait 180s after opening the network for new nodes the association permit should automatically be set to '0' when the network is closed. If the network is opened then you must have called bdb_start_top_level_commissioning(ZB_BDB_NETWORK_STEERING) somewhere again in your code.

    BR,

    Marjeris

  • Hi Marjeris

    From the packet capture, the difference between "Permit Join Request" (line 334) and "Beacon Request" is about 16 minutes. During these 16 minutes, I did not perform any operations on the light control coordinator example. Why the association permit is "true"

    My operation is just to let the device leave the network through button 3, and then press button 2 to let the device try to join the network. My operation can also be seen from the packet capture. Does "leave" change the association permit to 1?
    If "leave" changes the association permit to 1, why does "leave" change this?

    BR,

    Zero

  • Sending 'Leave' command to a router device should not change the association permit to 1. Most probably you are calling bdb_start_top_level_commissioning() somewhere in your code again, or you haven't waited 3 minutes after the network was opened by the coordinator last time. Perhaps if you share some of your code here it would be easier to see why the coordinator keeps it's network open (association permit set to 'true').

Related