1.3.1 How the Meters And More PAL Module Works

Description

The Physical Abstraction Layer is the access point to the PHY Layer when using the Meters And More Stack.

It provides the API to Data Link Layer running on top of the Meters And More PHY Layer.
Figure 1-11. PAL interaction with upper and lower layers
The Physical Abstraction Layer module offers the necessary functions to control the Meters And More PHY Layer, which include:
  • Module initialization
  • Transmitting and Receiving frames
  • Accessing Parameter Information Base (PIB) to get/set configuration parameters
  • Resetting the PLC transceiver
  • State Machine maintenance

Module Initialization

First of all, module has to be initialized by upper layer (DLL) by calling PAL_Init Function.

This function takes the pointers to PAL callback handlers as parameter, through the PAL_INIT Struct. See PAL_HANDLERS Struct to explore the callbacks to be implemented.

Before using the PAL module for data exchange, user has to ensure PAL is ready (i.e. has finished its initialization duties). This is done by means of PAL_Status Function, which returns the internal Status of PAL module. When Status is equal to PAL_STATUS_READY, module is ready to be used.

Transmitting and Receiving frames

Data Transmission is done by means of the PAL_TxRequest Function, which receives a pointer to data to be transmitted and its length as parameters.

The result of requested transmission, is provided to upper layer by invoking PAL_TxConfirm Typedef.

Received frames are reported to upper layer by invoking PAL_DataIndication Typedef, and previous to this callback, another one is generated, PAL_RxParamsIndication Typedef, along with reception parameters contained in PAL_RX_PARAMS Struct.

The application layer must set and manage these callbacks in order to receive frames and to capture the result of transmitted ones.

Accessing Information Base

Parameter Information Base (PIB) is a set of parameters that can be accessed for reading and/or writing. They serve mainly 2 purposes: PHY layer configuration through PIB writing, and information retrieval through PIB reading.

The reading and writing of parameters are made by means of PAL_GetPhyPib Function and PAL_SetPhyPib Function primitives respectively.

These functions are synchronous, in the sense that they return the result of the Get/Set operation, and the read value (in case of Get operation) in one of the function parameters itself.

Resetting the PLC transceiver

If the Meters And More Stack is reset, or in the event of a PAL/PHY Error, user may want to reset the PAL layer,which in turn resets the underlying PHY layer and PLC transceiver. This is done by means of the PAL_Reset Function.

State Machine maintenance

PAL State Machine is called periodically by upper layer (DLL) though the PAL_Tasks Function.

This State Machine handles the initialization process of PAL, and monitors PHY layer and PLC transceiver initialization in order to ensure that the Ready Status is set only when lower layers are completely initialized.