Jump to main content

# 1.2.2.1 How the Library Works

## PLC PHY Frames Serialization

PLC Sniffer mission is to provide information about every frame present in the PLC medium. This information includes the frame itself and some parameters related to PLC communications. Sniffer library provides functions which perform the encoding of the frames along with their related parameters and store them in a buffer that can be later sent through a Serial interface. On the other side of this interface, the Microchip PLC Sniffer tool will receive the encapsulated packets, process and present them on a GUI to ease visualization and further analysis. This allows monitoring the PLC medium in real time.

Library provides separate functions to be called either when frames are transmitted, and when are received by a device. This leads to 2 different modes of operation for the PLC Sniffer:

- Stand-alone Sniffer: A device which runs an application with the only purpose of acting as a sniffer. In this case, device will never send any frame, and therefore only the received frames serialization will be used.
- Embedded Sniffer: This mode is used when a regular device embeds sniffer capabilities. In this case, received frames will be serialized (after sending them to upper layers for regular processing), and also transmitted frames will be sent to the sniffer library so they are serialized (to simulate reception of own frames).

## Parameters Encoded With Frames for Serialization

The parameters included to provide additional information of the PLC frames depend on the used PLC profile, G3 or PRIME.

### G3 Parameters

Parameter | Description
--- | ---
Modulation Type/Scheme | Modulation in which PLC frame is encoded (Fixed to '0' for ACK frames)
Tone Map | Bitmap indicating which frequencies are used for Payload encoding (Fixed to '0' for ACK frames)
Num Symbols | Number of OFDM symbols that frame payload consists of (Fixed to '0' for ACK frames)
SNR | Indicator of frame reception quality (Fixed to '0xFF' for ACK frames and Transmitted frames)
Delimiter Type | Field to indicate frame type (Data with or without ACK request, ACK, NACK)
Time Ini | Timestamp for the start of frame in line
Time End | Timestamp for the end of frame in line
RSSI | Received Signal Strength Indicator (Fixed to '0xFFFF' for Transmitted frames)
Length | Frame length
PDU | Frame buffer

Note: Number of symbols have to be provided to sniffer library, by means of a dedicated function, before calling encoding functions.

### PRIME Parameters

Parameter | Description
--- | ---
Modulation Scheme | Modulation in which PLC frame is encoded
Num Symbols | Number of OFDM symbols that frame payload consists of
SNR | Indicator of frame reception quality (Fixed to '7' for Transmitted frames)
CINR Average | Auxiliary indicator of frame reception quality (averaged) (Fixed to '60' for Transmitted frames)
CINR Min | Auxiliary indicator of frame reception quality (minimum) (Fixed to '0xFF' for Transmitted frames)
Channel | PLC Channel in which device is operating
BER Average | Bit Error Rate estimation (averaged) (Fixed to '0' for Transmitted frames)
BER Max | Bit Error Rate estimation (maximum) (Fixed to '0' for Transmitted frames)
Time Ini | Timestamp for the start of frame in line
Time End | Timestamp for the end of frame in line
RSSI | Received Signal Strength Indicator (Fixed to '140' for Transmitted frames)
Length | Frame length
PDU | Frame buffer

Note: Number of symbols have to be provided to sniffer library, by means of a dedicated function, before calling encoding functions.

## PLC PHY Sniffer Configuration

There are some parameters that have to be correctly configured in a device in order to communicate with other peers in the network. These parameters can be configured on the Sniffer library so frames are correctly received and/or parameters correctly computed. Parameter differs depending on the used PLC profile, G3 or PRIME.

### G3 Configuration Params

G3 has one configuration parameter that, if different between 2 devices, blocks communication. This parameter is the Tone Mask and it indicates which tones are used for frame encoding/decoding in the working band and which ones are not. Sniffer library provides a dedicated function SRV_PSNIFFER_ConvertToneMask to convert a Tone Mask configuration received from the Microchip PLC Sniffer tool and then write it to the corresponding PLC PHY IB to be used for encoding/decoding.

### PRIME Configuration Params

PRIME has one configuration parameter that, if different between 2 devices, blocks communication. This parameter is the PLC Channel and it indicates which subband is being used inside the available band. Sniffer library provides a dedicated function SRV_PSNIFFER_SetPLCChannel to set the configuration received from the Microchip PLC Sniffer tool and then write it to the corresponding PLC PHY IB.

Rev: G