cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55 ZigBee Neighbours Table size

E.C.
Associate II

Hi,

I am working on a ZigBee project for the STM32WB55 which requires to send commands to all neighbours in the network. I saw in zigbee.nwk.h that I can request the entries of NeighborTable. Where can I see the max dimension of this table?

I found in zigbee.zdo.h this line:

/* NOTE was 64, but end up allocating too much on the stack */
#define ZB_ZDO_NEIGHBOR_LIST_MAX_SZ                 4U

Is that the size that I'm loonking for? If so, considering its size (too small for what I need), is there a way to overcome this limit (or can I modify it)?

1 ACCEPTED SOLUTION

Accepted Solutions
Remy ISSALYS
ST Employee

Hello,

Neighbor table size is controlled through nwkNeighborTblSz field of ZbInitTblSizesT structure.

By default, it is set to 64 for FFD build & 16 for RFD build (End Device only).

=> zigbee_app_info.zb = ZbInit(0U, NULL, NULL);

Custom values can be set using ZbInitTblSizesT structure as follow:

struct ZbInitTblSizesT tblSizes;

=> zigbee_app_info.zb = ZbInit(0U, &tblSizes, NULL);

struct ZbInitTblSizesT {
   void *heapPtr;
   unsigned int heapSz;
   unsigned int nwkNeighborTblSz; /* Default is 64. */
   unsigned int nwkRouteTblSz;
   unsigned int nwkAddrMapTblSz;
   unsigned int nwkBttSz;
   unsigned int nwkRReqSz;
   unsigned int apsPeerLinkKeyTblSz;
};

ZB_ZDO_NEIGHBOR_LIST_MAX_SZ is linked to ZDO Lqi Rsp primitive management and does not set neighbor table size at all.

Content of neighbor table can be dumped as follow:

struct ZbNwkNeighborT neighbor;
uint16_t i=0;
while (ZbNwkGetIndex(zigbee_app_info.zb, ZB_NWK_NIB_ID_NeighborTable, &neighbor, sizeof(neighbor), i++) == ZB_NWK_STATUS_SUCCESS) {
       /* Print Neighbor Table entry */
} 

Best Regards,

Remy 

View solution in original post

4 REPLIES 4
Remy ISSALYS
ST Employee

Hello,

Neighbor table size is controlled through nwkNeighborTblSz field of ZbInitTblSizesT structure.

By default, it is set to 64 for FFD build & 16 for RFD build (End Device only).

=> zigbee_app_info.zb = ZbInit(0U, NULL, NULL);

Custom values can be set using ZbInitTblSizesT structure as follow:

struct ZbInitTblSizesT tblSizes;

=> zigbee_app_info.zb = ZbInit(0U, &tblSizes, NULL);

struct ZbInitTblSizesT {
   void *heapPtr;
   unsigned int heapSz;
   unsigned int nwkNeighborTblSz; /* Default is 64. */
   unsigned int nwkRouteTblSz;
   unsigned int nwkAddrMapTblSz;
   unsigned int nwkBttSz;
   unsigned int nwkRReqSz;
   unsigned int apsPeerLinkKeyTblSz;
};

ZB_ZDO_NEIGHBOR_LIST_MAX_SZ is linked to ZDO Lqi Rsp primitive management and does not set neighbor table size at all.

Content of neighbor table can be dumped as follow:

struct ZbNwkNeighborT neighbor;
uint16_t i=0;
while (ZbNwkGetIndex(zigbee_app_info.zb, ZB_NWK_NIB_ID_NeighborTable, &neighbor, sizeof(neighbor), i++) == ZB_NWK_STATUS_SUCCESS) {
       /* Print Neighbor Table entry */
} 

Best Regards,

Remy 

Hi, and thanks a lot for your help!

May I ask you if there is a way to control the the update period of this table or if there is a way to force-update it? As far as I know, after a while from the last successful exchange message, if the node is not reachable its cost is set to 0, but I was wondering for how long the entry of this node remains in the table. I ask this because I'm trying to understand what is the best way to check if one of my neighbors went down.

Remy ISSALYS
ST Employee

Hello,

Neighbor table entry (Router case) is basically updated every time a Link Status is received.

Neighbor table entry validity is controlled through age parameter.

When Link Status is received from a device, related Neighbor table entry age is reset to 0.

If no Link Status is received, Neighbor table entry age is increased by one every 15 seconds.

If Neighbor table entry age becomes higher than 3 (RouterAgeLimit), Neighbor table entry has “aged out�? and is no more valid.

Neighbor table entries are not removed by default.

Filtering criteria shall be based on Neighbor table entry age.

If a Neighbor table entry is found with age higher than 3, Neighbor can be considered as lost.

struct ZbNwkNeighborT {
    uint64_t extAddr;
    uint16_t nwkAddr; /* Set to ZB_NWK_ADDR_UNDEFINED to invalidate entry */
    uint8_t capability;
    enum ZbNwkNeighborTypeT deviceType;
    enum ZbNwkNeighborRelT relationship;
    uint8_t txFailure;
    uint8_t lqi;
    int8_t unicastRssi;
    uint8_t outgoingCost;
    uint8_t age;
    uint8_t interval;
    ZbUptimeT timeout;
    uint8_t ifc_index;
};

Content of neighbor table can be dumped as follow:

struct ZbNwkNeighborT neighbor;
uint16_t i=0;
uint8_t lv_AgeLimit;
 
ZbNwkGet(zigbee_app_info.zb, ZB_NWK_NIB_ID_RouterAgeLimit, &lv_AgeLimit, sizeof(uint8_t));  
 
while (ZbNwkGetIndex(zigbee_app_info.zb, ZB_NWK_NIB_ID_NeighborTable,
         &neighbor, sizeof(neighbor), i++) == ZB_NWK_STATUS_SUCCESS) {
 
        /* Check if this is a stale entry. */  
        if((neighbor.nwkAddr != ZB_NWK_ADDR_UNDEFINED) &&
            (neighbor.age <= lv_AgeLimit)) {
 
            /* Dump Neighbor table valid entries */
        }
 
} 

Best Regards

E.C.
Associate II

Thanks for the explanation, it really helped me!