We have a cc2530 based system with a single gateway, and multiple routers and sensor modules. All communications is between sensors and the gateway, and never between sensors. Routers are also setup as sensors, if only to ensure connectivity. The system works, however, it does not reliably route when a router goes offline, i.e. a sensor connected through a router will not reroute to ensure connectivity to the gateway and will only come back online once the router it was originally connected to comes back. This was tested in rather close proximity to ensure that there were alternative routes.
I am using the z-stack simple API with only a slight modification to get signal strengths from incoming packets. This was built up from the sample code. Somewhere along the line I must have set some parameter incorrectly, or am doing something out of order so that the routing tables are not correct. I am hoping that someone can take a look at my stripped down code and tell me what I missed. There is no issue with initial connectivity, just rerouting when a node goes offline. I'm guessing either I have a parameter incorrect, or my error handling in some of the events is not correct.
The sensor and router use almost identical code. Both send a periodic report back to the gateway. The router functionality is handled by the Z-stack simple API. Since this forum doesn't appear to have a good way to paste code with proper indentation, I'm attaching the reduced code stripped to the essentials.
Sensor + Router code:
(Please visit the site to view this file)
Gateway code:
(Please visit the site to view this file)
Config:
(Please visit the site to view this file)
Sensor also has the following flags:
NWK_AUTO_POLL
HOLD_AUTO_START
REFLECTOR
POWER_SAVING
NV_INIT
DEVICE_LOGICAL_TYPE=ZG_DEVICETYPE_ENDDEVICE
ZIGBEEPRO
HAL_LED=FALSE
HAL_KEY=FALSE
HAL_SPI=FALSE
HAL_IRGEN=FALSE
HAL_UART_DMA_RX_MAX=128
HAL_UART_DMA_TX_MAX=128
HAL_UART=TRUE
INT_HEAP_LEN=2048
and in Enddev.cfg:
-DCPU32MHZ // CC2530s Run at 32MHz
-DROOT=__near_func // MAC/ZMAC code in NEAR
/* MAC Settings */
-DMAC_CFG_TX_DATA_MAX=3
-DMAC_CFG_TX_MAX=6
-DMAC_CFG_RX_MAX=3
Router has the following flags:
HOLD_AUTO_START
BUILD_ALL_DEVICES
REFLECTOR
NV_INIT
DEVICE_LOGICAL_TYPE=ZG_DEVICETYPE_ROUTER
ZIGBEEPRO
HAL_LED=FALSE
HAL_KEY=FALSE
HAL_SPI=FALSE
HAL_IRGEN=FALSE
HAL_UART_DMA_RX_MAX=128
HAL_UART_DMA_TX_MAX=128
HAL_UART=TRUE
INT_HEAP_LEN=2048
_REPEATER
Gateway has the following flags:
HOLD_AUTO_START
BUILD_ALL_DEVICES
REFLECTOR
NV_INIT
DEVICE_LOGICAL_TYPE=ZG_DEVICETYPE_COORDINATOR
ZDO_COORDINATOR
RTR_NWK
CONCENTRATOR_ENABLE=true
ZIGBEEPRO
HAL_LED=FALSE
HAL_KEY=FALSE
HAL_SPI=FALSE
HAL_IRGEN=FALSE
HAL_UART_DMA_RX_MAX=128
HAL_UART_DMA_TX_MAX=128
HAL_UART=TRUE
INT_HEAP_LEN=2048