The ZigBee PRO Stack User Guide (JN-UG-3101) suggests that an application can determine the network to connect to (from a list of networks obtained with a Network Discovery) based on the LQI. However, the network discovery complete event structure does not include any direct or indirect LQI value for the discovered networks. Is there a relatively simple way to accomplish this functionality (connect to network with highest LQI value)?
Hi Peter,
The beacon filtering is enabled using API ZPS_bAppAddBeaconFilter in Base device application code in bdb_start.c as below:
PUBLIC void BDB_vSetAssociationFilter()
{
sBeaconFilter.pu64ExtendPanIdList = NULL;
sBeaconFilter.u8ListSize = 0;
sBeaconFilter.u8Lqi = BEACON_FILTER_LQI_VALUE;
switch(ZPS_eAplZdoGetDeviceType())
{
case ZPS_ZDO_DEVICE_ENDDEVICE:
sBeaconFilter.u16FilterMap = BF_BITMAP_CAP_ENDDEVICE | \
BF_BITMAP_PERMIT_JOIN |\
BF_BITMAP_LQI;
break;
case ZPS_ZDO_DEVICE_ROUTER:
sBeaconFilter.u16FilterMap = BF_BITMAP_CAP_ROUTER | \
BF_BITMAP_PERMIT_JOIN |\
BF_BITMAP_LQI;
break;
default:
//impossible!
break;
}
ZPS_bAppAddBeaconFilter(&sBeaconFilter);
}
The parameters for beacon filtering are explained in details in section 7.2.3.5 tsBeaconFilterType of JN-UG-3113 and description for LQI is as below:
u8Lqi is the minimum LQI value (in the range 0 to 255) of an acceptable beacon (any beacon with LQI value less than this minimum will be filtered out) - if required, this field must be enabled through bit 2 in the u8FilterMap bitmap. So, this means
So, if you set BEACON_FILTER_LQI_VALUE to 0 , this means the device will reject any beacon which has an LQI value less than 0 which means it shall accept all the beacons irrespective of LQI value as the range of LQI is 0 to 255.
Regards,
Mario
Mario, thank you for your response.
The Beacon filtering is the only possible solution I could see as well. However, this is a bit of a hack for being able to select the network with the best LQI. You would have to complete multiple Network Discovery scans with a lower LQI filter on each successive scan until you found a network. It seems counter-intuitive that the LQI of each discovered network is not included in the ZPS_EVENT NWK_DISCOVERY_COMPLETE structure. I assume the stack has the value, it's just not passed along with the event structure.
All that being said, I do understand that LQI is probably typically one of the last considerations when choosing a network to join and the Beacon Filter is probably sufficient for TouchLink-type Network Discovery.
Hi Peter,
You are right the LQI is not the first consideration when the device is choosing a network. As you know, that value is not constant and could be affected by the walls, temperature, humidity, etc...
Please let me know if you have any further question.
Regards,
Mario