BeeStack: How to form/join nwk and start binding automatically?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BeeStack: How to form/join nwk and start binding automatically?

1,083 Views
AlanCollins
Contributor V

To form the network automatically, you should add the “ZDO_Start” function at the end of “BeeAppInit” routine in “BeeApp.c” file, or else you can start a single-shot timer, so the start network executes after 1 second (or similar) or power-on reset.

You may shot the En Device binding request when the status of the starting network is success: gZDOToAppMgmtZCRunning_c, gZDOToAppMgmtZRRunning_c or gZDOToAppMgmtZEDRunning_c. You can look for this on the “ASL_Userinterface.c” file (inside the ASL folder) within the “ASL_UpdateDevice()” function.  Inside that function you will find the next lines:                              

case gZDOToAppMgmtZCRunning_c:
case gZDOToAppMgmtZRRunning_c:
case gZDOToAppMgmtZEDRunning_c:

before the break line of the case sentence you can put the binding request (ASL_EndDeviceBindRequest(NULL,aDestAddress,endPointList[0].pEndpointDesc->pSimpleDesc);
where: aDestAddress is a zbNwkAddr_t type and you can initialize it with the address of the device you want to bind. For examble: zbNwkAddr_t aDestAddress = {0x00,0x00};

After this in the same function, look for the gBindingSuccess_c case. Before the break of the case and inside the if (appState == mStateBindRequest_c) you should put the next lines, in order to change from configuration mode to user application mode:

ASL_ChangeUserInterfaceModeTo(gConfigureMode_c);
ASL_DisplayChangeToCurrentMode(gmUserInterfaceMode);

If you want to change from configure mode to user application mode you should use ASL_ChangeUserInterfaceModeTo(gApplicationMode_c) and to change from user application mode to configure mode you should use ASL_ChangeUserInterfaceModeTo(gConfigureMode_c).

Your automatic network formation is ready now, and you can use the free space for your events and not for the network formation events.

If you need to bind 2 or more endpoints, then you need to make a button that can send the end device bind for each endpoint, or if you want this automatically you should create a state machine inside de binding success case to send the bind request each time the binding success occur, but the next time you should ensure to send the bind request to the next endpoint to bind.


Please notice this guide was for End Device binding. If you want to use direct Bind.Request commands, you need to discover the remote node information by using the ZDP commands.

Labels (1)
Tags (1)
0 Kudos
0 Replies