the Freescale Support wrote me this answer.
The answer to your question is yes, you can send your binding request using events when the event occurs. This is good but I suggest you that shot your 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:
ASL_ChangeUserInterfaceModeTo(gConfigureMode_c);
ASL_DisplayChangeToCurrentMode(gmUserInterfaceMode);
in order to change from configuration mode to user application mode. Your automatic network formation is ready now, and you can use the free space for your events and not for the network formation events.
Manuel Davalos
Technical Support
Freescale Semiconductor
Sorry for mistake! In order to change from configuration mode to user application mode you have to write
ASL_ChangeUserInterfaceModeTo(gApplicationMode_c);
Elisa