The CC2530 low-power terminal keeps reconnecting to the network and consumes power
[Copy link]
Test the low power mode of its ZIGBEE protocol stack. TI has indeed spent a lot of effort on this protocol stack and the operating system OSAL that supports it. It is very easy to use. After making a few simple configurations, it can enter the low power mode, and data collection and communication are normal.
When I thought it was OK, I turned off the coordinator. After a while, I turned it back on and found that the terminal could not connect. I measured the battery voltage of the terminal (CR1220, 40mA/H) and found that it was out of power. The root cause of the problem was that the terminal found that the coordinator was not online and kept reconnecting to the network. You should know that the reconnection process consumes a lot of power. How to solve it? I found the information on the Internet, as follows:
///////////////////////////////////////////////////// ///////////////////////////////////
I have studied this. If DEV_HOLD is not configured, the device will continue to connect to the network until there is a network. If you want the device to connect to the network after a period of time, you can refer to the following method (it should be noted that I only verified that the device will connect to the network according to the set time, which does not mean that the power consumption is reduced).
#define NWK_INIT_fAIL_MAX 5
UINT16 ZDApp_event_loop( uint8 task_id, UINT16 events )
{
……
if ( events & ZDO_NETWORK_INIT )
{
static uint8 initFailCounter = 0;
// Initialize apps and start the network
devState = DEV_INIT;
osal_set_event( ZDAppTaskID, ZDO_STATE_CHANGE_EV T );
//by asura 20140901
if(initFailCounter++ >= NWK_INIT_fAIL_MAX )
{
osal_start_timerEx( ZDAppTaskID, ZDO_NETWORK_INIT, 60000 );
initFailCounter = 0;
return(events ^ ZDO_NETWORK_INIT);
}
ZDO_StartDevice( (uint8)ZDO_Config_Node_Descriptor.LogicalType, devStartMode,
DEFAULT_BEACON_ORDER, DEFAULT_SUPERFRAME_ORDER );
// Return unprocessed events
return (events ^ ZDO_NETWORK_INIT);
}
...
}
After this change, the device will first try to connect to the network 5 times when it is powered on. If all of them fail, it will try to connect to the network once every 1 minute.
In addition, since the second parameter of osal_start_timerEx() is of type uint16, this limits the delay time. I would like to ask, how to set a delay of 5 minutes or longer?
///////////////////////////////////////////////////// ////
Another netizen replied: In the latest protocol stack, the time parameter of the osal_start_timerEx function is already 32 bits, so a longer timer can be defined.
|