LQI on coordinator

Hello, I developed for my customer, a ZigBee coordinator in last 2019, using nRF5 SDK for Thread and Zigbee v3.2.0.
Now my customer ask me if it possible to have the LQI value for each end node
There are any ways to get this value from Coordinator?
I see the function zdo mgmt_lqi ... is this helpful?
Thaks
Abele Barbieri

Parents
  • Hi Abele,

    You can use zdo mgmt_lqi for this, but if you want to know the LQI between the coordinator and its neighbor then you do not need to send a Mgmt_Lqi_req command. This command is for obtaining the neighbor table of a remote devices. One of the fields of the neighbor table is LQI, so if you want to know the LQI between a remote device and all of its neighbors, then this command is useful. On the coordinator you can check the entries of its neighbor table locally.

    I have made a function that will iterate through the neighbor table and print to log the short address and LQI of each neighbor:

    static zb_void_t get_lqi()
    {
        uint32_t i;
        zb_uint16_t addr;
    
        /* If gc_neighbor[i].used is 0, the entry is not used */
        /* If gc_neighbor[i].ext_neighbor is 1, this is ext neighbor record, else base neighbor */
        for (i = 0; i < gc_neighbor_table_size; i++) {
            if ((gc_neighbor[i].used == 0) ||
                (gc_neighbor[i].ext_neighbor != 0))
            {
                continue;
            }
            zb_address_short_by_ref(&addr, gc_neighbor[i].u.base.addr_ref);
            NRF_LOG_INFO("short_addr: 0x%04x, #LQI: %d", addr, gc_neighbor[i].lqi);
        }
        
    }

    Be aware that this will only show the LQI of the devices that are neighbors to the coordinator. If they are not neighbors, either because they are out of range or because the remote device is an end device with a parent that is not the coordinator, then you cannot use the above. In that case you do not have a direct link between the coordinator and the remote device, so you would not have a LQI between the coordinator and remote device anyway.

    Best regards,

    Marte

Reply
  • Hi Abele,

    You can use zdo mgmt_lqi for this, but if you want to know the LQI between the coordinator and its neighbor then you do not need to send a Mgmt_Lqi_req command. This command is for obtaining the neighbor table of a remote devices. One of the fields of the neighbor table is LQI, so if you want to know the LQI between a remote device and all of its neighbors, then this command is useful. On the coordinator you can check the entries of its neighbor table locally.

    I have made a function that will iterate through the neighbor table and print to log the short address and LQI of each neighbor:

    static zb_void_t get_lqi()
    {
        uint32_t i;
        zb_uint16_t addr;
    
        /* If gc_neighbor[i].used is 0, the entry is not used */
        /* If gc_neighbor[i].ext_neighbor is 1, this is ext neighbor record, else base neighbor */
        for (i = 0; i < gc_neighbor_table_size; i++) {
            if ((gc_neighbor[i].used == 0) ||
                (gc_neighbor[i].ext_neighbor != 0))
            {
                continue;
            }
            zb_address_short_by_ref(&addr, gc_neighbor[i].u.base.addr_ref);
            NRF_LOG_INFO("short_addr: 0x%04x, #LQI: %d", addr, gc_neighbor[i].lqi);
        }
        
    }

    Be aware that this will only show the LQI of the devices that are neighbors to the coordinator. If they are not neighbors, either because they are out of range or because the remote device is an end device with a parent that is not the coordinator, then you cannot use the above. In that case you do not have a direct link between the coordinator and the remote device, so you would not have a LQI between the coordinator and remote device anyway.

    Best regards,

    Marte

Children
  • Ok, it is clear.
    Then, there are NO way for coordinator to know the LQI of end nodes that aren't neighbors?

  • Hi Abele,

    Yes, you can find LQI of non neighbor devices as well. LQI indicates the quality of a link between two devices, so for a non neighbor device you will have one LQI for each link. In the case where you have a coordinator, a router, and an end device, and the router is the parent of the end device you will have two links between the coordinator and end device (coordinator --- router --- end device), where each link will have their own LQI. 

    To do this you can send a Mgmt_lqi_req command, for example with zdo mgmt_lqi if you're using Zigbee shell commands. If the coordinator sends this to the router then the router will respond with its neighbor table, which will contain LQI for each entry in the neighbor table. You can see this yourself if you test with Zigbee shell. This is an example where I sent zdo mgmt_lqi from my coordinator to a light bulb (router), and the resulting neighbor table from the light bulb:

    > zdo mgmt_lqi 0x3f4d
    [idx] ext_pan_id       ext_addr         short_addr flags permit_join depth lqi
    [ 0]  f4ce36ab839f2ac6 f4ce36ab839f2ac6 0x0000     0x84  1           0     228
    [ 1]  f4ce36ab839f2ac6 f4ce36314cd4585a 0xd0f2     0x16  0           2     248

    The light bulb has two entries in its neighbor table, where the first one (short addr 0x0000) is the coordinator, and the second (0xd0f2) is a light switch, which is an end device with the light bulb as its parent. 

    Best regards,

    Marte

  • Thanks Marte,
    I tried the function cmd_zb_mgmt_lqi on my stack 3.2.0 and I get same result on my side, the "router" resturn the LQI to Coordinator / LQI to SED (Coordinator -- smart plug -- SED device)
    Note that when SED awakes, the data are sent "directly" to coordinator, right?

  • What kind of data are you thinking about? An end device will always route packets via its parent device, so all communication with other devices on the network will go through the parent.

  • Sorry, I forgot to inform about my coding ...
    The steering and network formation of all end node is trough the Coordinator
    The custom application of my "Coordinator" needs to receive also information (battery, on/off status, ... ) to take some actions related
    Then, for all end nodes that are allowed to entry on the network, my "Coordinator" custom application make some binding and subscription for needed clusters
    If I chek the communication "over the air" I see that some end nodes send directly to coordinator, but they are not on the Coordinator neighbor table

Related