1.9.1.1 G3 Management

The G3 management application file (app_g3_management.c) manages the G3 stack, including:
  • Network creation. A network discovery is performed to detect if there is another network present in order to select a different PAN ID.
  • Configuration of G3 stack (ADP and MAC) parameters.
The state machine is implemented in the APP_G3_MANAGEMENT_Tasks() function. The different states are:
  • APP_G3_MANAGEMENT_STATE_ADP_OPEN: First state in which ADP is opened.
  • APP_G3_MANAGEMENT_STATE_WAIT_ADP_READY: ADP status is checked and when it is ready, G3 stack (ADP and MAC) parameters are configured (using _APP_G3_MANAGEMENT_InitializeParameters() function) and a network discovery is started.
  • APP_G3_MANAGEMENT_STATE_SCANNING: Network discovery in progress. When a network is found (Beacon received) it is indicated by _ADP_DiscoveryIndication() callback function. The end of discovery is indicated by _ADP_DiscoveryConfirm() callback function.
  • APP_G3_MANAGEMENT_STATE_STARTING_NETWORK: Network start in progress. The end of start process is indicated by _ADP_NetworkStartConfirm() callback function.
  • APP_G3_MANAGEMENT_STATE_NETWORK_STARTED: The G3 network has been started.
  • APP_G3_MANAGEMENT_STATE_ERROR: There was an error during G3 stack initialization, probably because neither PLC nor RF transceivers are available.
Five ADP callbacks are registered:
  • _ADP_DiscoveryIndication(): A network is found (Beacon received). The different PAN IDs are stored in a list.
  • _ADP_DiscoveryConfirm(): It indicates the end of network discovery. The PAN ID of the network to be started is 0x781D by default, but the list of PAN IDs detected in network discovery is checked in order to not repeat the PAN ID. Once the PAN ID is selected, the short address (0x0000) is set and the network start is requested using ADP_NetworkStartRequest().
  • _ADP_NetworkStartConfirm(): It indicates the end of network start. If successful, Context Information Table is updated with PAN ID.
  • _ADP_NonVolatileDataIndication(): The G3 stack indicates that non-volatile parameters have changed and need to be updated in non-volatile memory. This is notified to storage application through APP_STORAGE_UpdateNonVolatileData() function.
  • _ADP_BufferIndication(): It indicates that there was a change in ADP buffers availability. This is notified to cycles application through APP_CYCLES_AdpBufferIndication() function.
There are another functions that are called from cycles application:
  • APP_G3_MANAGEMENT_GetPanId(): Returns the PAN ID of the network.
  • APP_G3_MANAGEMENT_GetExtendedAddress(): Returns the extended address (EUI64) of the Coordinator.