English
Language : 

UM1573 Datasheet, PDF (19/27 Pages) STMicroelectronics – ST7540 power line modem firmware stack
UM1573
ST7540 stack firmware code
/* Valid data arrived from PLM and addressed to this device or
sent in broadcast by a remote PLM. (broadcast frame are sent with
LL_BROADCAST_FLAG set in the ntw_data.frametype field) */
}
When valid data arrive from the power line, data can be recovered from the structure
NL_Data_t (in this example, pointed by *ntw_data pointer).
typedef struct
{
uint16_t group;// Sender group
uint32_t address;// Sender address
uint8_t framelen;// Arrived frame length
NL_Type_t frametype;// Arrived frame type
uint8_t databuffer[PAYLOAD_SIZE]; // Arrived user data
}NL_Data_t;
The group field is the same as this device if the grouping option is enabled, because, by
enabling the group filter, all the frames coming from a different group are ignored (even
those sent in broadcast).
When the variable nNStatus.operation value is N_SUCCESS, the data are valid,
meaning with a correct preamble, a correct CRC (CRC16 is automatically inserted by the
stack during the transmission and checked, and then removed during the reception), with
one of the admitted frame types, addressed to this device (or sent in broadcast) belonging to
this group and correctly acknowledged by the sender. All of this is transparent to the user as
it is automatically managed by the stack.
The fields data buffer and framelen contain the user raw data and the data length. Refer to
the stk_n.h file for the admitted frame types.
If a data reception error occurs, this can be verified checking the value of the field error of
the NL_Status_t structure (nNStatus.error).
The following enumerations are the possible communication errors (including also the
transmission errors) and are reported in the stk_n.h file.
typedef enum
{
NL_ERR_NONE,// No error
NL_ERR_NOT_READY,// Stack not initialized
NL_ERR_NETWORK_TIMEOUT,// Given timeout elapsed
NL_ERR_TRANSMISSION_ERROR,// Data transmission error
NL_ERR_COMMUNICATION_TIMEOUT,// Communication timeout
NL_ERR_LINE_ERROR,// Power line error
NL_ERR_TARGET_NOT_REACHABLE,// Target device unreachable
NL_ERR_FRAME_CLASS_UNKNOWN,// Unknown frame type
NL_ERR_GENERIC// Unclassified error
Doc ID 023619 Rev 1
19/27