Other Parts Discussed in Thread: SYSCONFIG, Z-STACK
Good morning.
We are testing some topology architectures based on a CC2652P ZNP coordinator connected to a straight line of devices which are a mix of custom routers and custom end-devices, each one with 8 endpoints of type "Smart Plug", intended to be polled for their metering/onOff values and to be reached by onOff commands.
Our application would need some lines of at least 30 devices, spaced out around 20 meters, minimizing the number of coordinators. Any number of devices below those numbers would not justify the use of Zigbee instead of a traditional big Wi-Fi network.
The firmwares are variants of zr_genericapp and zed_genericapp, with working endpoints, clusters and attributes added manually.
1 - We first tried to put a series of 20 routers in a straight line, distantiated about 20/30 meter
The results were not well promising: the in-field pairing of the devices used to work at the first attempt until the 9th 10th node, then the interview used to fail gradually until it needed 6,7 attempts to finally finish with success. Then, polling the devices goes well for the first nodes, then resulted in timeout when polling the 12th/13th device and above. So we can deduct that the maximum number of hops is something around 10 (as Ryan told me some times ago). Is it possible to increment this number in any way? I tried to tune some knobs it default/ti_zstack_config.h and Stack/nwk_globals.h without differences:
/* * ti_zstack_config.h * * DO NOT EDIT - This file was generated by the SysConfig tool. * * Macros used to define a TI Z-Stack ZigBee device. New user defined * options may be added to this file, as necessary. * */ #ifndef TI_ZSTACK_CONFIG_H #define TI_ZSTACK_CONFIG_H /* Default (primary) and secondary channel masks. Secondary mask is used when the * default channels fail. * Channels are defined in the following: * 11 - 26 : 2.4 GHz 0x07FFF800 */ #ifndef DEFAULT_CHANLIST #define DEFAULT_CHANLIST 0x04000000 #endif #ifndef SECONDARY_CHANLIST #define SECONDARY_CHANLIST 0x00000000 #endif /* Define the default PAN ID. * * Setting this to a value other than 0xFFFF causes * ZDO_COORD to use this value as its PAN ID and * Routers and end devices to join PAN with this ID */ #ifndef ZDAPP_CONFIG_PAN_ID #define ZDAPP_CONFIG_PAN_ID 0xFFFE #endif /* Specifiy whether to set the EPID to the Extended Address, or to use the * custom Extended Pan ID (EPID) defined by ZDAPP_CONFIG_EPID */ #ifndef SET_EPID_AS_EXT_ADDR #define SET_EPID_AS_EXT_ADDR TRUE #endif /* Define the default Extended Pan ID (EPID) * ZDAPP_CONFIG_EPID is only used if SET_EPID_AS_EXT_ADDR is FALSE. Otherwise, * the EPID is set to the Extended Address. */ #ifndef ZDAPP_CONFIG_EPID #define ZDAPP_CONFIG_EPID {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF} #endif /* in seconds; set to 255 to turn off route expiry */ #ifndef ROUTE_EXPIRY_TIME #define ROUTE_EXPIRY_TIME 30 #endif /* Default indirect message holding timeout value: * 1-65535 (0 -> 65536) X CNT_RTG_TIMER X RTG_TIMER_INTERVAL */ #ifndef NWK_INDIRECT_MSG_TIMEOUT #define NWK_INDIRECT_MSG_TIMEOUT 7 #endif /* The number of simultaneous route discoveries in network */ #ifndef MAX_RREQ_ENTRIES #define MAX_RREQ_ENTRIES 8 #endif /* The maximum number of MAC frame transmission attempts allowed */ #ifndef ZMAC_MAX_FRAME_RETRIES #define ZMAC_MAX_FRAME_RETRIES 3 #endif /* Max number of times attempts looking for the next hop address of a message */ #ifndef NWK_MAX_DATA_RETRIES #define NWK_MAX_DATA_RETRIES 2 #endif /* The maximum number of times APS frames are retried after not receiving an APS ACK */ #ifndef APSC_MAX_FRAME_RETRIES #define APSC_MAX_FRAME_RETRIES 3 #endif /* This number is used by polled devices, since the spec'd formula * doesn't work for sleeping end devices. For non-polled devices, * a formula is used. Value is in 2 milliseconds periods */ #ifndef APSC_ACK_WAIT_DURATION_POLLED #define APSC_ACK_WAIT_DURATION_POLLED 3000 #endif /* The maximum number of groups in the groups table */ #ifndef APS_MAX_GROUPS #define APS_MAX_GROUPS 40 #endif /* Number of entries in the regular routing table plus additional * entries for route repair */ #ifndef MAX_RTG_ENTRIES #define MAX_RTG_ENTRIES 40 #endif /* Maximum number of entries in the Binding table. */ #ifndef NWK_MAX_BINDING_ENTRIES #define NWK_MAX_BINDING_ENTRIES 40 #endif /* Default security key. */ #ifndef DEFAULT_KEY #define DEFAULT_KEY {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} #endif /* ZigBee Alliance Pre-configured Distributed Link Key (for Distributed networks) */ #ifndef DISTRIBUTED_GLOBAL_LINK_KEY #define DISTRIBUTED_GLOBAL_LINK_KEY {0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF} #endif /* ZigBee Alliance Pre-configured TC Link Key - 'ZigBeeAlliance09' (for Centralized networks) */ #ifndef DEFAULT_TC_LINK_KEY #define DEFAULT_TC_LINK_KEY {0x5a,0x69,0x67,0x42,0x65,0x65,0x41,0x6c,0x6c,0x69,0x61,0x6e,0x63,0x65,0x30,0x39} #endif /* The number of milliseconds to wait between data request polls to the coordinator. */ #ifndef TXPOWER #define TXPOWER 20 #endif /**************************************** * The following are for End Devices only ***************************************/ /* Determine whether the radio on an End Device is always on */ #ifndef RFD_RX_ALWAYS_ON_CAPABLE #define RFD_RX_ALWAYS_ON_CAPABLE TRUE #endif #ifndef RFD_RX_ALWAYS_ON #define RFD_RX_ALWAYS_ON TRUE #endif /* The minimum poll rate. */ #ifndef MINIMUM_APP_POLL_RATE #define MINIMUM_APP_POLL_RATE 100 #endif /* The number of milliseconds to wait between data request polls to the coordinator. */ #ifndef POLL_RATE #define POLL_RATE 3000 #endif /* This is used after receiving a data indication to poll immediately * for queued messages...in milliseconds. */ #ifndef QUEUED_POLL_RATE #define QUEUED_POLL_RATE 100 #endif /* This is used after receiving a data confirmation to poll immediately * for response messages...in milliseconds */ #ifndef RESPONSE_POLL_RATE #define RESPONSE_POLL_RATE 100 #endif /* This is used as an alternate response poll rate only for rejoin request. * This rate is determined by the response time of the parent that the device * is trying to join. */ #ifndef REJOIN_POLL_RATE #define REJOIN_POLL_RATE 440 #endif /* Maximum number of devices in the Assoc/Device list. */ #ifndef NWK_MAX_DEVICE_LIST #define NWK_MAX_DEVICE_LIST 20 #endif /* Total Number of APS keys that a TC can manage. This is equal to the number of devices a ZC can allow to join the network */ #ifndef ZDSECMGR_TC_DEVICE_MAX #define ZDSECMGR_TC_DEVICE_MAX 3 #endif /* Value used by end device when sending End Device Timeout Request */ /* This is an index into table timeoutValue[] defined in nwk_globals.c */ #ifndef END_DEV_TIMEOUT_VALUE #define END_DEV_TIMEOUT_VALUE 8 #endif #endif /* TI_ZSTACK_CONFIG_H */
/************************************************************************************************** Filename: nwk_globals.h Revised: $Date: 2015-01-08 16:32:12 -0800 (Thu, 08 Jan 2015) $ Revision: $Revision: 41678 $ Description: User definable Network Parameters. Copyright 2004-2015 Texas Instruments Incorporated. All rights reserved not granted herein. Limited License. Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive license under copyrights and patents it now or hereafter owns or controls to make, have made, use, import, offer to sell and sell ("Utilize") this software subject to the terms herein. With respect to the foregoing patent license, such license is granted solely to the extent that any such patent is necessary to Utilize the software alone. The patent license shall not apply to any combinations which include this software, other than combinations with devices manufactured by or for TI ("TI Devices"). No hardware patent is licensed hereunder. Redistributions must preserve existing copyright notices and reproduce this license (including the above copyright notice and the disclaimer and (if applicable) source code license limitations below) in the documentation and/or other materials provided with the distribution. Redistribution and use in binary form, without modification, are permitted provided that the following conditions are met: * No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any software provided in binary form. * Any redistribution and use are licensed by TI for use only with TI Devices. * Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code. If software source code is provided to you, modification and redistribution of the source code are permitted provided that the following conditions are met: * Any redistribution and use of the source code, including any resulting derivative works, are licensed by TI for use only with TI Devices. * Any redistribution and use of any object code compiled from the source code and any resulting derivative works, are licensed by TI for use only with TI Devices. Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or promote products derived from this software without specific prior written permission. DISCLAIMER. THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **************************************************************************************************/ #ifndef NWK_GLOBALS_H #define NWK_GLOBALS_H #ifdef __cplusplus extern "C" { #endif /********************************************************************* * INCLUDES */ #include "zcomdef.h" #include "nwk_bufs.h" #include "assoc_list.h" #include "binding_table.h" #include "zglobals.h" /********************************************************************* * MACROS */ /********************************************************************* * CONSTANTS */ #if !defined ( CONFIG_ITEM ) #define CONFIG_ITEM CONST #endif #if !defined ( NWK_LINK_STATUS_PERIOD ) #define NWK_LINK_STATUS_PERIOD 60 // 15 seconds #endif #if !defined ( ZIGBEE_FRAGMENTATION ) #define ZIGBEE_FRAGMENTATION #endif #if ( RFD_RX_ALWAYS_ON_CAPABLE == TRUE ) || ( ZG_BUILD_RTR_TYPE ) // The PANID Conflict feature is mandatory for both 2007 and 2007 PRO. // So, it will be ON all the time (except sleeping end devices). #if !defined ( ZIGBEE_PANID_CONFLICT ) #define ZIGBEE_PANID_CONFLICT #endif #endif #if ( ZG_BUILD_RTR_TYPE ) // The Frequency Agility feature is mandatory for both 2007 and 2007 PRO. // So, it will be ON all the time for routers. #if !defined ( ZIGBEE_FREQ_AGILITY ) #define ZIGBEE_FREQ_AGILITY #endif #endif #if defined ( ZIGBEE_FREQ_AGILITY ) || defined ( ZBIT ) // Make Frequency Agility to look for all MAC errors for Certification test // by setting the following to TRUE. The default value is FALSE meaning // that only ZMacChannelAccessFailure error code will trigger a scan. #if !defined ( NWK_FREQ_AGILITY_ALL_MAC_ERRS ) #define NWK_FREQ_AGILITY_ALL_MAC_ERRS FALSE #endif #endif // Controls various stack parameter settings #define ZIGBEEPRO_PROFILE 2 // Channel mask #define MAX_CHANNELS_868MHZ 0x00000001 #define MAX_CHANNELS_915MHZ 0x000007FE #if !defined ( MAX_CHANNELS_24GHZ ) #define MAX_CHANNELS_24GHZ 0x07FFF800 #endif #define STACK_PROFILE_ID ZIGBEEPRO_PROFILE //Z-Stack does not support other than ZigbeePro_Profile. //These parameters must not be modified to keep Zigbee Core compliance. // Refer to Zigbee PRO Stack Profile 2 (07-4855-05) for more information #if ( STACK_PROFILE_ID == ZIGBEEPRO_PROFILE ) #define MAX_NODE_DEPTH 30 #define USE_NWK_SECURITY 1 // true or false #define SECURITY_LEVEL 5 #endif // Zigbee protocol version #define ZB_PROT_V1_0 1 #define ZB_PROT_V1_1 2 #define ZB_PROT_VERS ZB_PROT_V1_1 #define ZIGBEE_PROT_ID 0x00 // Status and error codes for extra information #define NWK_STATUS_PING_RCVD 0x0001 #define NWK_STATUS_ASSOC_CNF 0x0002 #define NWK_STATUS_ED_ADDR 0x0003 #define NWK_STATUS_PARENT_ADDR 0x0004 #define NWK_STATUS_COORD_ADDR 0x0005 #define NWK_STATUS_ROUTER_ADDR 0x0006 #define NWK_STATUS_ORPHAN_RSP 0x0007 #define NWK_ERROR_ASSOC_RSP 0x1001 #define NWK_ERROR_ASSOC_RSP_MF 0x1002 #define NWK_ERROR_ASSOC_CNF_DENIED 0x1003 #define NWK_ERROR_ENERGY_SCAN_FAILED 0x1004 // Indicate whether incoming NWK frames must be all checked for freshness // when the memory for incoming frame counts is exceeded #if !defined( NWK_ALL_FRESH ) #define NWK_ALL_FRESH TRUE // Default to TRUE - Check all frames #endif // Indicate whether to use Multicast in NIB value #if !defined( MULTICAST_ENABLED ) #define MULTICAST_ENABLED TRUE // Default to TRUE #endif // Maximum number in tables #if !defined( NWK_MAX_DEVICE_LIST ) #define NWK_MAX_DEVICE_LIST 60 // Maximum number of devices in the // Assoc/Device list. #endif // Don't change this value to set the number of devices. Change // NWK_MAX_DEVICE_LIST above #define NWK_MAX_DEVICES ( NWK_MAX_DEVICE_LIST + 1 ) // One extra space for parent // Number of End Devices that will be stored in the SrcMatch and NotMyChildList lists // when aged out by the Child Table Management process #define MAX_NOT_MYCHILD_DEVICES 5 // Number of reserved places for router and end device children, to be used in stochastic addressing. #if !defined ( NWK_MIN_ROUTER_CHILDREN ) #define NWK_MIN_ROUTER_CHILDREN 0 #endif #if !defined ( NWK_MIN_ENDDEVICE_CHILDREN ) #define NWK_MIN_ENDDEVICE_CHILDREN 0 #endif #if !defined ( MAX_NEIGHBOR_ENTRIES ) #if ( ZG_BUILD_RTR_TYPE ) #define MAX_NEIGHBOR_ENTRIES 16 #else #define MAX_NEIGHBOR_ENTRIES 4 #endif #endif #if !defined ( APS_MAX_GROUPS ) #define APS_MAX_GROUPS 10 #endif #define NWK_MAX_REFLECTOR_ENTRIES ( NWK_MAX_BINDING_ENTRIES ) #if !defined( MAX_BCAST ) #define MAX_BCAST 9 #endif #if !defined ( NWK_MAX_BROADCAST_JITTER ) // The maximum broadcast jitter time in 2 msec periods (0x40 msec on 2.4GHz) #define NWK_MAX_BROADCAST_JITTER 0x20 #endif // Maxiumum number of secure partners(Commercial mode only). #if ZG_BUILD_COORDINATOR_TYPE // Adding 5 entries to allow up to 5 legacy devices join concurrently when the rest of the // table is filled with ZigBee 3.0 devices, binding table related addresses, association // table related addresses, etc. the usage of these 5 entries is just temporary during joining // of the legacy devices. A few seconds (BDB_DEFAULT_TC_NODE_JOIN_TIMEOUT) after they joined, // these entries are released and can be used for joining more legacy devices. #define NWK_MAX_SECURE_PARTNERS (5 + ZDSECMGR_TC_DEVICE_MAX) #else // Add 1 for the Trust Center(Coordinator) if it is not the parent. #define NWK_MAX_SECURE_PARTNERS 1 #endif // Maximum number of addresses managed by the Address Manager #define NWK_MAX_ADDRESSES (uint16_t) \ ( ( NWK_MAX_DEVICES ) + \ ( NWK_MAX_REFLECTOR_ENTRIES ) + \ ( NWK_MAX_SECURE_PARTNERS ) ) // Network PAN Coordinator Address #define NWK_PAN_COORD_ADDR 0x0000 // Network Addressing modes #define NWK_ADDRESSING_DISTRIBUTED 0x00 #define NWK_ADDRESSING_STOCHASTIC 0x02 #if !defined ( NWK_LINK_STATUS_PERIOD ) #define NWK_LINK_STATUS_PERIOD 60 // 15 seconds #endif #if !defined ( LINK_STATUS_JITTER_MASK ) #define LINK_STATUS_JITTER_MASK 0x007F // 127 milliseconds #endif #if !defined ( NWK_ROUTE_AGE_LIMIT ) #define NWK_ROUTE_AGE_LIMIT 3 // 3 missed link satus frames #endif #if !defined ( MAX_RTG_SRC_ENTRIES ) #define MAX_RTG_SRC_ENTRIES 60 #endif #if !defined ( SRC_RTG_EXPIRY_TIME ) #define SRC_RTG_EXPIRY_TIME 20 // seconds before the source route entry expires #endif #if !defined ( MTO_RREQ_LIMIT_TIME ) // in milliseconds. The time limited to one MTO RReq (Concentrator Announce) #define MTO_RREQ_LIMIT_TIME 1000 #endif #if !defined ( MTO_ROUTE_EXPIRY_TIME ) // The number of seconds a MTO routing entry will last. Default to not expiring. #define MTO_ROUTE_EXPIRY_TIME RTG_NO_EXPIRY_TIME #endif #if ( ZG_BUILD_ENDDEVICE_TYPE ) #define APS_MAX_ENDDEVICE_BROADCAST_ENTRIES ( 2 * MAX_BCAST ) #endif #if !defined( NWK_CONFLICTED_ADDR_EXPIRY_TIME ) #define NWK_CONFLICTED_ADDR_EXPIRY_TIME 4 // number of link status period after the // last received address conflict // report (network status command) #endif #if !defined ( LINK_DOWN_TRIGGER ) #define LINK_DOWN_TRIGGER 3 // Link is down if txCounter exceeds this #endif #if !defined ( GOOD_LINK_COST ) #define GOOD_LINK_COST ( MAX_LINK_COST / 2 ) // 3 is considered good cost #endif // This the size of the conflicted address table // Scale it up if the size of the network is over 100 nodes #if !defined( CONFLICTED_ADDR_TABLE_SIZE ) #define CONFLICTED_ADDR_TABLE_SIZE 3 #endif // Maximum number of relays in source routing #if !defined ( MAX_SOURCE_ROUTE ) #define MAX_SOURCE_ROUTE 12 #endif #if !defined ( MAX_BROADCAST_QUEUED ) #define MAX_BROADCAST_QUEUED 10 #endif #if !defined ( DEFAULT_ROUTE_REQUEST_RADIUS ) #define DEFAULT_ROUTE_REQUEST_RADIUS DEF_NWK_RADIUS #endif #if !defined ( DEF_NWK_RADIUS ) // the default network radius set twice the value of <nwkMaxDepth> #define DEF_NWK_RADIUS ( 2 * BEACON_MAX_DEPTH ) #endif #if !defined ( MAX_PASSIVE_ACK_CNT ) #define MAX_PASSIVE_ACK_CNT 8 #endif //Define the number of network security material entries that this device can have. //The first MAX_NWK_SEC_MATERIAL_TABLE_ENTRIES-1 networks will be stored, while the last //will be used for the remaining networks joined #define MAX_NWK_SEC_MATERIAL_TABLE_ENTRIES 5 #if !defined ( NWK_JOIN_SECURITY_TIMEOUT_PERIOD ) #define NWK_JOIN_SECURITY_TIMEOUT_PERIOD 5000 #endif /********************************************************************* * TYPEDEFS */ #if ( MAX_NEIGHBOR_ENTRIES > 255 ) || defined ( LARGE_NEIGHBOR_TABLE ) typedef uint16_t neighborTableIndex_t; #else typedef uint8_t neighborTableIndex_t; #endif #if ( NWK_MAX_DEVICES > 255 ) || defined ( LARGE_DEVICE_TABLE ) typedef uint16_t deviceTableIndex_t; #else typedef uint8_t deviceTableIndex_t; #endif #if ( MAX_RTG_ENTRIES > 255 ) || defined ( LARGE_ROUTING_TABLE ) typedef uint16_t rtgTableIndex_t; #else typedef uint8_t rtgTableIndex_t; #endif #if ( MAX_RTG_SRC_ENTRIES > 255 ) || defined ( LARGE_SOURCE_ROUTE_TABLE ) typedef uint16_t srcRtgTableIndex_t; #else typedef uint8_t srcRtgTableIndex_t; #endif #if ( MAX_RREQ_ENTRIES > 255 ) || defined ( LARGE_ROUTE_REQUEST_TABLE ) typedef uint16_t rreqTableIndex_t; #else typedef uint8_t rreqTableIndex_t; #endif #if ( NWK_MAX_BINDING_ENTRIES > 255 ) || defined ( LARGE_BINDING_TABLE ) typedef uint16_t bindTableIndex_t; #else typedef uint8_t bindTableIndex_t; #endif #if ( MAX_BCAST > 255 ) || defined ( LARGE_BROADCAST_TABLE ) typedef uint16_t bcastTableIndex_t; #else typedef uint8_t bcastTableIndex_t; #endif #if defined ( FEATURE_MNP ) #if !defined ( MAX_MNP_QUEUED ) #define MAX_MNP_QUEUED 2 #endif #endif /********************************************************************* * NWK GLOBAL VARIABLES */ // Variables for MAX data buffer levels extern CONST byte gNWK_MAX_DATABUFS_WAITING; extern CONST byte gNWK_MAX_DATABUFS_SCHEDULED; extern CONST byte gNWK_MAX_DATABUFS_CONFIRMED; extern CONST byte gNWK_MAX_DATABUFS_TOTAL; extern CONST byte gNWK_INDIRECT_CNT_RTG_TMR; extern CONST byte gNWK_INDIRECT_MSG_MAX_PER; extern CONST byte gNWK_INDIRECT_MSG_MAX_ALL; extern CONFIG_ITEM neighborTableIndex_t gMAX_NEIGHBOR_ENTRIES; extern CONFIG_ITEM rtgTableIndex_t gMAX_RTG_ENTRIES; extern CONFIG_ITEM srcRtgTableIndex_t gMAX_RTG_SRC_ENTRIES; extern CONFIG_ITEM rreqTableIndex_t gMAX_RREQ_ENTRIES; extern CONST uint16_t gMTO_RREQ_LIMIT_TIME; extern CONST uint8_t gMTO_ROUTE_EXPIRY_TIME; extern CONST uint8_t gMAX_PASSIVE_ACK_CNT; // Variables for MAX list size extern CONST deviceTableIndex_t gNWK_MAX_DEVICE_LIST; extern CONST uint8_t gNWK_TREE_ALLOCATE_ROUTERADDR_FOR_ENDDEVICE; extern CONST uint16_t gNWK_MIN_ROUTER_CHILDREN; extern CONST uint16_t gNWK_MIN_ENDDEVICE_CHILDREN; extern byte gMIN_TREE_LQI; extern CONFIG_ITEM byte defaultKey[]; #if (ZG_BUILD_JOINING_TYPE) extern CONFIG_ITEM byte distributedDefaultKey[]; #endif extern CONST byte defaultTCLinkKey[]; extern CONST uint8_t gMAX_SOURCE_ROUTE; extern uint16_t rtgSrcRelayList[]; extern CONFIG_ITEM bcastTableIndex_t gMAX_BCAST; extern CONST byte gNWK_CONFLICTED_ADDR_EXPIRY_TIME; #if defined ( ZIGBEE_FREQ_AGILITY ) || defined ( ZBIT ) extern CONST uint8_t gNWK_FREQ_AGILITY_ALL_MAC_ERRS; #endif extern CONST uint8_t gMAX_BROADCAST_QUEUED; extern CONST uint8_t gLINK_DOWN_TRIGGER; extern CONST uint8_t gGOOD_LINK_COST; extern CONST uint8_t gDEFAULT_ROUTE_REQUEST_RADIUS; extern CONST uint8_t gDEF_NWK_RADIUS; #if ( ZSTACK_ROUTER_BUILD ) || defined ( ZBIT ) extern CONST uint16_t gLINK_STATUS_JITTER_MASK; #endif extern CONST uint8_t gMAX_NOT_MYCHILD_DEVICES; extern CONST uint32_t timeoutValue[]; extern CONST uint32_t gMAX_NWK_FRAMECOUNTER_CHANGES; #if defined ( FEATURE_MNP ) extern uint8_t gMAX_MNP_QUEUED; #endif extern CONFIG_ITEM uint16_t gNWK_MAX_BROADCAST_JITTER; extern CONST uint32_t gNWK_JOIN_SECURITY_TIMEOUT_PERIOD; /********************************************************************* * APS GLOBAL VARIABLES */ // Variables for Binding Table extern CONFIG_ITEM bindTableIndex_t gNWK_MAX_BINDING_ENTRIES; extern CONFIG_ITEM uint8_t gMAX_BINDING_CLUSTER_IDS; extern CONST uint16_t gBIND_REC_SIZE; extern CONFIG_ITEM uint8_t gAPS_MAX_GROUPS; extern uint8_t gAPS_MAX_ENDDEVICE_BROADCAST_ENTRIES; /********************************************************************* * GLOBAL VARIABLES - Statistics */ #if defined ( FEATURE_PACKET_FILTER_STATS ) extern uint32_t apsInvalidPackets; extern uint32_t apsSecurityFailures; extern uint32_t nwkInvalidPackets; extern uint32_t nwkSecurityFailures; #endif /********************************************************************* * FUNCTIONS */ /* * Init Global Variables */ extern void nwk_globals_init( void ); extern void NIB_init( void ); extern void nwk_Status( uint16_t statusCode, uint16_t statusValue ); extern uint16_t nwk_adjustDelay( uint16_t existingDelay, uint8_t confirmStatus, uint16_t bufOptions ); /********************************************************************* *********************************************************************/ #ifdef __cplusplus } #endif #endif /* NWK_GLOBALS_H */
I also post my sysconfig for the routers
/** * These arguments were used when this file was generated. They will be automatically applied on subsequent loads * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments. * @cliArgs --board "/ti/boards/CC1352P_2_LAUNCHXL" --rtos "tirtos" --product "simplelink_cc13xx_cc26xx_sdk@6.20.00.29" * @versions {"tool":"1.13.0+2553"} */ /** * Import the modules used in this configuration. */ const CCFG = scripting.addModule("/ti/devices/CCFG"); const rfdesign = scripting.addModule("/ti/devices/radioconfig/rfdesign"); const AESCBC = scripting.addModule("/ti/drivers/AESCBC"); const AESCBC1 = AESCBC.addInstance(); const AESCCM = scripting.addModule("/ti/drivers/AESCCM"); const AESCCM1 = AESCCM.addInstance(); const AESECB = scripting.addModule("/ti/drivers/AESECB"); const AESECB1 = AESECB.addInstance(); const DMA = scripting.addModule("/ti/drivers/DMA"); const ECDH = scripting.addModule("/ti/drivers/ECDH"); const ECDH1 = ECDH.addInstance(); const ECDSA = scripting.addModule("/ti/drivers/ECDSA"); const ECDSA1 = ECDSA.addInstance(); const GPIO = scripting.addModule("/ti/drivers/GPIO", {}, false); const GPIO1 = GPIO.addInstance(); const GPIO2 = GPIO.addInstance(); const GPIO3 = GPIO.addInstance(); const NVS = scripting.addModule("/ti/drivers/NVS"); const NVS1 = NVS.addInstance(); const NVS2 = NVS.addInstance(); const Power = scripting.addModule("/ti/drivers/Power"); const RF = scripting.addModule("/ti/drivers/RF"); const SHA2 = scripting.addModule("/ti/drivers/SHA2"); const SHA21 = SHA2.addInstance(); const SPI = scripting.addModule("/ti/drivers/SPI", {}, false); const SPI1 = SPI.addInstance(); const TRNG = scripting.addModule("/ti/drivers/TRNG"); const TRNG1 = TRNG.addInstance(); const Timer = scripting.addModule("/ti/drivers/Timer", {}, false); const Timer1 = Timer.addInstance(); const UART = scripting.addModule("/ti/drivers/UART", {}, false); const UART1 = UART.addInstance(); const Button = scripting.addModule("/ti/drivers/apps/Button"); const Button1 = Button.addInstance(); const Button2 = Button.addInstance(); const LED = scripting.addModule("/ti/drivers/apps/LED"); const LED1 = LED.addInstance(); const LED2 = LED.addInstance(); const zstack = scripting.addModule("/ti/zstack/zstack"); /** * Write custom configuration values to the imported modules. */ CCFG.xoscCapArray = true; CCFG.xoscCapArrayDelta = 0xC1; CCFG.enableBootloader = true; CCFG.enableBootloaderBackdoor = true; CCFG.dioBootloaderBackdoor = 15; CCFG.levelBootloaderBackdoor = "Active low"; CCFG.forceVddr = true; CCFG.ccfgTemplate.$name = "ti_devices_CCFG_CCFGCC26XXTemplate0"; rfdesign.rfDesign = "LAUNCHXL-CC1352P-2"; AESCBC1.$name = "CONFIG_AESCBC_0"; AESCCM1.$name = "CONFIG_AESCCM_0"; AESCCM1.interruptPriority = "2"; AESECB1.$name = "CONFIG_AESECB_0"; AESECB1.interruptPriority = "1"; ECDH1.$name = "CONFIG_ECDH_0"; ECDSA1.$name = "CONFIG_ECDSA_0"; GPIO1.$name = "CONFIG_GPIO_TEST_OUT"; GPIO1.mode = "Output"; GPIO2.$name = "CONFIG_GPIO_RFID_SS"; GPIO2.mode = "Output"; GPIO3.$name = "CONFIG_GPIO_RFID_RST"; GPIO3.mode = "Output"; NVS1.$name = "CONFIG_NVSINTERNAL"; NVS1.internalFlash.$name = "ti_drivers_nvs_NVSCC26XX0"; NVS1.internalFlash.regionSize = 0x4000; NVS1.internalFlash.regionBase = 0x52000; NVS2.$name = "CONFIG_NVSEXTERNAL"; NVS2.nvsType = "External"; NVS2.$hardware = system.deviceData.board.components.MX25R8035F; NVS2.externalFlash.$name = "ti_drivers_nvs_NVSSPI25X0"; NVS2.externalFlash.regionSize = 0x256000; NVS2.externalFlash.verifyBufferSize = 64; RF.$hardware = system.deviceData.board.components["SKY13317-373LF"]; SHA21.$name = "CONFIG_SHA2_0"; TRNG1.$name = "CONFIG_TRNG_0"; Timer1.$name = "CONFIG_TIMER_0"; Timer1.timerType = "32 Bits"; Timer1.timerInstance.$name = "CONFIG_GPTIMER_0"; UART1.$name = "CONFIG_UART"; UART1.txPinInstance.$name = "CONFIG_GPIO_1"; UART1.rxPinInstance.$name = "CONFIG_GPIO_2"; Button1.$name = "CONFIG_BTN_LEFT"; Button1.autoHwConfig = false; Button1.button.$assign = "boosterpack.8"; Button1.gpioPin.$name = "CONFIG_GPIO_BTN1"; Button1.gpioPin.pull = "Pull Up"; Button2.$name = "CONFIG_BTN_RIGHT"; Button2.autoHwConfig = false; Button2.button.$assignAllowConflicts = "boosterpack.4"; Button2.gpioPin.$name = "CONFIG_GPIO_BTN2"; Button2.gpioPin.pull = "Pull Up"; scripting.suppress("Connected to hardware,@@@.+?@@@ is connected to XDS110 UART on the CC1352P-2 LaunchPad\. Consider selecting it in 'use hardware' above\. @@@.+?@@@", Button2, "button"); LED1.$name = "CONFIG_LED_RED"; LED1.$hardware = system.deviceData.board.components.LED_RED; LED1.gpioPin.$name = "CONFIG_GPIO_RLED"; LED2.$name = "CONFIG_LED_GREEN"; LED2.$hardware = system.deviceData.board.components.LED_GREEN; LED2.gpioPin.$name = "CONFIG_GPIO_GLED"; const NVSSPI25XDevice = scripting.addModule("/ti/drivers/nvs/NVSSPI25XDevice", {}, false); const NVSSPI25XDevice1 = NVSSPI25XDevice.addInstance({}, false); NVSSPI25XDevice1.$name = "CONFIG_NVS_SPI_0"; NVS2.externalFlash.spiFlashDevice = NVSSPI25XDevice1; NVSSPI25XDevice1.slaveSelectPinInstance.$name = "CONFIG_GPIO_0"; NVSSPI25XDevice1.sharedSpiInstance = SPI1; SPI1.$name = "CONFIG_SPI_RFID"; zstack.deviceType = "zr"; zstack.deviceTypeReadOnly = true; zstack.touchlink.$name = "ti_zstack_touchlink_zstack_touchlink0"; zstack.pm.$name = "ti_zstack_pm_zstack_pm0"; zstack.rf.$name = "ti_zstack_rf_zstack_rf0"; zstack.rf.txPower = "20"; zstack.rf.primaryChannels = [26]; zstack.rf.radioConfig.$name = "ti_devices_radioconfig_settings_ieee_15_40"; zstack.rf.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param0"; zstack.rf.coexSettings.$name = "ti_zstack_rf_zstack_coex_mod0"; zstack.network.$name = "ti_zstack_network_zstack_network0"; zstack.network.panID = "0xFFFE"; zstack.advanced.$name = "ti_zstack_advanced_zstack_advanced0"; zstack.advanced.routing.$name = "ti_zstack_advanced_zstack_routing0"; zstack.advanced.packetSending.$name = "ti_zstack_advanced_zstack_packet_sending0"; zstack.advanced.tableSize.$name = "ti_zstack_advanced_zstack_table_size0"; zstack.advanced.tableSize.bindingTableSize = 40; zstack.advanced.tableSize.groupTableSize = 40; /** * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future * version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to * re-solve from scratch. */ GPIO1.gpioPin.$suggestSolution = "boosterpack.10"; GPIO2.gpioPin.$suggestSolution = "boosterpack.36"; GPIO3.gpioPin.$suggestSolution = "boosterpack.19"; RF.rfAntennaPin0.$suggestSolution = "ball.41"; RF.rfAntennaPin1.$suggestSolution = "ball.42"; RF.rfAntennaPin2.$suggestSolution = "ball.43"; Timer1.timerInstance.timer.$suggestSolution = "GPTM0"; UART1.uart.$suggestSolution = "UART0"; UART1.uart.txPin.$suggestSolution = "boosterpack.31"; UART1.uart.rxPin.$suggestSolution = "boosterpack.32"; LED1.ledPin.$suggestSolution = "boosterpack.39"; LED2.ledPin.$suggestSolution = "boosterpack.40"; NVSSPI25XDevice1.slaveSelect.$suggestSolution = "boosterpack.38"; SPI1.spi.$suggestSolution = "SSI0"; SPI1.spi.sclkPin.$suggestSolution = "boosterpack.7"; SPI1.spi.misoPin.$suggestSolution = "boosterpack.14"; SPI1.spi.mosiPin.$suggestSolution = "boosterpack.15"; SPI1.spi.dmaRxChannel.$suggestSolution = "DMA_CH3"; SPI1.spi.dmaTxChannel.$suggestSolution = "DMA_CH4";
2 - We limited the number of routers to 8, obtaining the following topology:
I then created a script to poll the devices' endpoints (using Zigbee2Mqtt API's) and measure elapsed times, first polling only a single endpoint (2 clusters, metering and onoff) per device and then all 8 endpoints (smart plug) for each of the 8 devices. No timeout have occurred. Here are the logs:
Field test, polling 1 endpoint per device, Routers only Device: 0x00124b002590e188 [Router], Time elapsed: 153.884ms, Average per attribute : 76.942ms Device: 0x00124b0025907b5c [Router], Time elapsed: 208.8629ms, Average per attribute : 104.43145ms Device: 0x00124b0025908a25 [Router], Time elapsed: 219.8165ms, Average per attribute : 109.90825ms Device: 0x00124b0025907b63 [Router], Time elapsed: 238.5847ms, Average per attribute : 119.29235ms Device: 0x00124b00259087a1 [Router], Time elapsed: 118.6589ms, Average per attribute : 59.32945ms Device: 0x00124b002590dd78 [Router], Time elapsed: 185.6975ms, Average per attribute : 92.84875ms Device: 0x00124b002590e021 [Router], Time elapsed: 146.0539ms, Average per attribute : 73.02695ms Device: 0x00124b002590dd33 [Router], Time elapsed: 184.1201ms, Average per attribute : 92.06005ms Full poll time: 1.4556785s
Field test, polling 8 endpoint per device, Routers only Device: 0x00124b0025907b5c [Router], Time elapsed: 1.7198454s, Average per attribute : 107.490331ms Device: 0x00124b0025908a25 [Router], Time elapsed: 1.5746697s, Average per attribute : 98.416852ms Device: 0x00124b0025907b63 [Router], Time elapsed: 1.7933287s, Average per attribute : 112.083037ms Device: 0x00124b00259087a1 [Router], Time elapsed: 914.7183ms, Average per attribute : 57.169888ms Device: 0x00124b002590dd78 [Router], Time elapsed: 1.4159681s, Average per attribute : 88.498001ms Device: 0x00124b002590e021 [Router], Time elapsed: 1.1336071s, Average per attribute : 70.850438ms Device: 0x00124b002590dd33 [Router], Time elapsed: 1.4949566s, Average per attribute : 93.434781ms Device: 0x00124b002590e188 [Router], Time elapsed: 1.23612s, Average per attribute : 77.257493ms Full poll time: 11.2832139s
3 - We bound 8 end devices along the line, obtaining the following topology with 16 devices:
Now i have run the script again, no timeout have occurred, but the end-devices have presented huge delays, here are the logs:
Field test, polling 1 endpoint per device, 8 Routers + 8 EndDevices Device: 0x00124b0025908a25 [Router], Time elapsed: 176.9852ms, Average per attribute : 88.4926ms Device: 0x00124b002590fbf6 [EndDevice], Time elapsed: 222.6546ms, Average per attribute : 111.3273ms Device: 0x00124b0025908a6a [EndDevice], Time elapsed: 1.0652301s, Average per attribute : 532.61505ms Device: 0x00124b0025907b5c [Router], Time elapsed: 198.8744ms, Average per attribute : 99.4372ms Device: 0x00124b0025907b63 [Router], Time elapsed: 197.2419ms, Average per attribute : 98.62095ms Device: 0x00124b002590dd78 [Router], Time elapsed: 167.8257ms, Average per attribute : 83.91285ms Device: 0x00124b002591071d [EndDevice], Time elapsed: 1.431613s, Average per attribute : 715.8065ms Device: 0x00124b0025910009 [EndDevice], Time elapsed: 5.8469776s, Average per attribute : 2.9234888s Device: 0x00124b002590f613 [EndDevice], Time elapsed: 2.9179497s, Average per attribute : 1.45897485s Device: 0x00124b00259087a1 [Router], Time elapsed: 103.736ms, Average per attribute : 51.868ms Device: 0x00124b002590dd33 [Router], Time elapsed: 177.8675ms, Average per attribute : 88.93375ms Device: 0x00124b002590e1d0 [EndDevice], Time elapsed: 4.1672753s, Average per attribute : 2.08363765s Device: 0x00124b0025906ff3 [EndDevice], Time elapsed: 5.6209016s, Average per attribute : 2.8104508s Device: 0x00124b002590e188 [Router], Time elapsed: 120.3848ms, Average per attribute : 60.1924ms Device: 0x00124b002590e021 [Router], Time elapsed: 126.3897ms, Average per attribute : 63.19485ms Device: 0x00124b0025907cb1 [EndDevice], Time elapsed: 4.1024619s, Average per attribute : 2.05123095s Full poll time: 26.644369s
Field test, polling 8 endpoint per device, 8 Routers + 8 End devices Device: 0x00124b0025908a6a [EndDevice], Time elapsed: 4.1211526s, Average per attribute : 257.572031ms Device: 0x00124b0025907b5c [Router], Time elapsed: 1.3779558s, Average per attribute : 86.122231ms Device: 0x00124b0025908a25 [Router], Time elapsed: 1.0705681s, Average per attribute : 66.910501ms Device: 0x00124b002590dd78 [Router], Time elapsed: 1.0820209s, Average per attribute : 67.626301ms Device: 0x00124b002590e021 [Router], Time elapsed: 806.58ms, Average per attribute : 50.411245ms Device: 0x00124b002591071d [EndDevice], Time elapsed: 2.0414714s, Average per attribute : 127.591957ms Device: 0x00124b002590e188 [Router], Time elapsed: 982.7829ms, Average per attribute : 61.423924ms Device: 0x00124b00259087a1 [Router], Time elapsed: 726.5046ms, Average per attribute : 45.40653ms Device: 0x00124b002590dd33 [Router], Time elapsed: 1.2341957s, Average per attribute : 77.137225ms Device: 0x00124b002590e1d0 [EndDevice], Time elapsed: 43.8911905s, Average per attribute : 2.7431994s Device: 0x00124b0025906ff3 [EndDevice], Time elapsed: 47.6144099s, Average per attribute : 2.975900614s Device: 0x00124b0025910009 [EndDevice], Time elapsed: 47.1970158s, Average per attribute : 2.949813481s Device: 0x00124b0025907cb1 [EndDevice], Time elapsed: 29.1029119s, Average per attribute : 1.818931989s Device: 0x00124b002590f613 [EndDevice], Time elapsed: 3.3832635s, Average per attribute : 211.453963ms Device: 0x00124b0025907b63 [Router], Time elapsed: 1.4299035s, Average per attribute : 89.368962ms Device: 0x00124b002590fbf6 [EndDevice], Time elapsed: 4.2789814s, Average per attribute : 267.436331ms Full poll time: 3m10.3409085s
So, it seems that adding end-devices to a central line of routers does the job of reducing the number of hops and make the network bigger, but those order of magnitude of delays could not be acceptable for our application.
4 - We also took the 16 devices from the previous test (8 routers + 8 End-Devices) inside in our lab, preserving the bindings and pairing, and have repeated the measure test
Lab test, polling 1 endpoint per device, 8 Routers + 8 End-Devices
Device: 0x00124b0025906ff3 [EndDevice], Time elapsed: 1.4267376s, Average per attribute : 713.3688ms
Device: 0x00124b0025910009 [EndDevice], Time elapsed: 2.4122712s, Average per attribute : 1.2061356s
Device: 0x00124b002590fbf6 [EndDevice], Time elapsed: 2.1348938s, Average per attribute : 1.0674469s
Device: 0x00124b002590dd33 [Router], Time elapsed: 91.4669ms, Average per attribute : 45.73345ms
Device: 0x00124b002590e021 [Router], Time elapsed: 92.4419ms, Average per attribute : 46.22095ms
Device: 0x00124b0025907b63 [Router], Time elapsed: 83.5755ms, Average per attribute : 41.78775ms
Device: 0x00124b002590dd78 [Router], Time elapsed: 93.2088ms, Average per attribute : 46.6044ms
Device: 0x00124b002590e1d0 [EndDevice], Time elapsed: 2.0595667s, Average per attribute : 1.02978335s
Device: 0x00124b002590f613 [EndDevice], Time elapsed: 1.4978588s, Average per attribute : 748.9294ms
Device: 0x00124b002590e188 [Router], Time elapsed: 89.6877ms, Average per attribute : 44.84385ms
Device: 0x00124b0025908a6a [EndDevice], Time elapsed: 917.0266ms, Average per attribute : 458.5133ms
Device: 0x00124b0025907b5c [Router], Time elapsed: 97.2496ms, Average per attribute : 48.6248ms
Device: 0x00124b002591071d [EndDevice], Time elapsed: 1.5685691s, Average per attribute : 784.28455ms
Device: 0x00124b0025907cb1 [EndDevice], Time elapsed: 2.7326952s, Average per attribute : 1.3663476s
Device: 0x00124b0025908a25 [Router], Time elapsed: 88.3405ms, Average per attribute : 44.17025ms
Device: 0x00124b00259087a1 [Router], Time elapsed: 96.2979ms, Average per attribute : 48.14895ms
Full poll time: 15.4818878s
Lab test, polling 8 endpoint per device, 8 Routers + 8 End-Devices
Device: 0x00124b002590e021 [Router], Time elapsed: 864.2836ms, Average per attribute : 54.017718ms
Device: 0x00124b00259087a1 [Router], Time elapsed: 1.1681567s, Average per attribute : 73.00979ms
Device: 0x00124b0025907b63 [Router], Time elapsed: 744.4813ms, Average per attribute : 46.530076ms
Device: 0x00124b002590e1d0 [EndDevice], Time elapsed: 4.7857835s, Average per attribute : 299.111463ms
Device: 0x00124b0025908a25 [Router], Time elapsed: 727.6489ms, Average per attribute : 45.47805ms
Device: 0x00124b0025910009 [EndDevice], Time elapsed: 4.1694748s, Average per attribute : 260.592169ms
Device: 0x00124b002590f613 [EndDevice], Time elapsed: 2.5862343s, Average per attribute : 161.639637ms
Device: 0x00124b0025907b5c [Router], Time elapsed: 1.1745931s, Average per attribute : 73.412063ms
Device: 0x00124b002590dd33 [Router], Time elapsed: 1.1568752s, Average per attribute : 72.304694ms
Device: 0x00124b0025906ff3 [EndDevice], Time elapsed: 4.7752102s, Average per attribute : 298.450632ms
Device: 0x00124b0025907cb1 [EndDevice], Time elapsed: 4.2859462s, Average per attribute : 267.871634ms
Device: 0x00124b002590e188 [Router], Time elapsed: 648.5117ms, Average per attribute : 40.531974ms
Device: 0x00124b0025908a6a [EndDevice], Time elapsed: 3.9794359s, Average per attribute : 248.714738ms
Device: 0x00124b002590dd78 [Router], Time elapsed: 964.7451ms, Average per attribute : 60.296564ms
Device: 0x00124b002590fbf6 [EndDevice], Time elapsed: 3.5703009s, Average per attribute : 223.1438ms
Device: 0x00124b002591071d [EndDevice], Time elapsed: 3.2085772s, Average per attribute : 200.536071ms
Full poll time: 38.8102586s
How could i proceed? How can i increment the number of hops which can be realiably done by a message, or how can i reduce the end devices polling delays?
Thank you in advance for any hint.
Regards
RN