1.4.1.3 Reception

When a PLC message is received, it is processed in the callback function APP_PLC_DataIndCb. This callback receives as parameter a data structure of type DRV_PLC_PHY_RECEPTION_OBJ, containing all the available information from the message.

The callback function checks if CRC validation was OK (CRC computation enabled by PIB PLC_ID_CRC_TX_RX_CAPABILITY) and extracts some data about the modulation and signal received. The function checks the length of the message and prints the content and information about signal level and signal quality through the console.

Structure DRV_PLC_PHY_RECEPTION_OBJ

The reception parameters are stored in the data structure DRV_PLC_PHY_RECEPTION_OBJ, defined in drv_plc_phy_comm.h:
// *****************************************************************************
/* G3 Reception parameters

   Summary
    This struct includes all information to describe any new received message.

   Remarks:
    None
*/
typedef struct __attribute__((packed, aligned(1))) {
   /* Pointer to received data buffer */
  uint8_t *pReceivedData;
  /* Instant when frame was received (end of message) referred to 1us PHY counter */
  uint32_t time;
  /* Frame duration referred to 1us PHY counter (Preamble + FCH + Payload) */
  uint32_t frameDuration;
  /* Length of the received data in bytes */
  uint16_t dataLength;
  /* Reception RSSI in dBuV */
  uint16_t rssi;
  /* ZCT info */
  uint8_t zctDiff;
  /* Errors corrected by Reed-Solomon */
  uint8_t rsCorrectedErrors;
  /* Modulation type */
  DRV_PLC_PHY_MOD_TYPE modType;
  /* Modulation scheme */
  DRV_PLC_PHY_MOD_SCHEME modScheme;
  /* DT field coming in header */
  DRV_PLC_PHY_DEL_TYPE delimiterType;
  /* MAC CRC. 1: OK; 0: BAD; 0xFE: Timeout Error; 0xFF: CRC capability disabled (PLC_ID_CRC_TX_RX_CAPABILITY) */
  uint8_t crcOk;
  /* Test data information */
  uint16_t agcFine;
  /* Test data information */
  uint32_t agcFactor;  
  /* Test data information */
  int16_t agcOffsetMeas;
  /* Test data information */
  uint8_t agcActive;
  /* Test data information */
  uint8_t agcPgaValue;
  /* Test data information */
  int16_t snrFch;
  /* Test data information */
  int16_t snrPay;
  /* Number of corrupted carriers */
  uint16_t payloadCorruptedCarriers;
  /* Number of noised symbols */
  uint16_t payloadNoisedSymbols;
  /* SNR of the worst carrier */
  uint8_t payloadSnrWorstCarrier;
  /* SNR of the worst symbol */
  uint8_t payloadSnrWorstSymbol;
  /* SNR of impulsive noise */
  uint8_t payloadSnrImpulsive;
   /* SNR of Narrowband noise */ 
  uint8_t payloadSnrBand;
  /* Background SNR */
  uint8_t payloadSnrBackground;
  /* Link Quality Indicator */
  uint8_t lqi;
  /* Reception Tone Map */
  uint8_t toneMap[TONE_MAP_SIZE_MAX];
  /* SNR per carrier */
  uint8_t carrierSnr[PROTOCOL_CARRIERS_MAX];
} DRV_PLC_PHY_RECEPTION_OBJ;
 
Where:
  • pReceivedData: Pointer to the buffer containing the data of the received frame.
  • time: Instant when frame was received (end of frame), referred to the 32-bit 1µs PHY time counter.
  • frameDuration: Frame duration in µs (Preamble + FCH + Payload).
  • dataLength: Length of received frame in bytes. It includes padding (if needed). If CRC computation is enabled (PIB PLC_ID_CRC_TX_RX_CAPABILITY), the CRC length (two bytes) is not included.
  • rssi: Received Signal Strength Indicator in dBµV.
  • zctDiff: Phase difference with transmitting node in multiples of 60 degrees (values from 0 to 5). Derived from PDC field in PHY header (FCH) and zero-crossing time. Value 6 indicates that zero-crossing time is not available.
  • rsCorrectedErrors: Number of errors (bytes) corrected by Reed-Solomon decoder.
  • modType: Modulation type of the received frame.
    modType Value Description
    MOD_TYPE_BPSK 0 BPSK Modulation Type
    MOD_TYPE_QPSK 1 QPSK Modulation Type
    MOD_TYPE_8PSK 2 8PSK Modulation Type
    MOD_TYPE_BPSK_ROBO 4 BPSK Robust (4 repetitions) Modulation Type
  • modScheme: Modulation scheme of the received frame.
    modScheme Value Description
    MOD_SCHEME_DIFFERENTIAL 0 Differential Modulation Scheme
    MOD_SCHEME_COHERENT 1 Coherent Modulation Scheme
  • delimiterType: DT field coming in FCH of the received frame.
    delimiterType Value Description
    DT_SOF_NO_RESP 0 Acknowledgment is not requested
    DT_SOF_RESP 1 Acknowledgment is requested
    DT_ACK 2 Positive acknowledgment
    DT_NACK 3 Negative acknowledgment
  • crcOk: CRC verification result (1: OK; 0: BAD; 0xFE: unexpected error; 0xFF: CRC capability disabled). CRC computation enabled by PIB PLC_ID_CRC_TX_RX_CAPABILITY.
  • agcFine: Factor that multiplies the digital input signal (13 bits).
  • agcFactor: Global amplifying factor of the main branch (21 bits).
  • agcOffsetMeas: DC offset after the ADC that will be removed in case the DC Blocker is enabled (10 bits).
  • agcActive: Flag to indicate if AGC attenuation resistor is active.
  • agcPgaValue: Gain value applied to the PGA (3 bits).
  • snrFch: SNR of FCH symbols in dB with sQ13.2 format (0x0000: 0dB; 0x0001: 0.25dB; 0xFFFF: -0.25dB).
  • snrPay: SNR of payload symbols in dB with sQ13.2 format.
  • payloadCorruptedCarriers: Number of corrupted carriers in payload due to narrow/broad-band noise.
  • payloadNoisedSymbols: Number of corrupted symbols in payload due to impulsive noise.
  • payloadSnrWorstCarrier: SNR of the worst carrier within payload symbols in dB with sQ5.2 format (0x00: 0dB; 0x01: 0.25dB; 0xFF: -0.25dB).
  • payloadSnrWorstSymbol: SNR of the worst payload symbol in dB with sQ5.2 format.
  • payloadSnrImpulsive: SNR of payload symbols corrupted by impulsive noise in dB with sQ5.2 format.
  • payloadSnrBand: SNR of carriers corrupted by narrow/broad-band noise within payload symbols in dB with sQ5.2 format.
  • payloadSnrBackground: SNR of payload symbols without taking into account corrupted carriers/symbols in dB with sQ5.2 format.
  • lqi: Link Quality Indicator. SNR of payload symbols in dB with uQ6.2 format and -10 dB offset (0x00: -10 dB; 0x01: -9.75 dB; 0xFF: 53.75 dB).
  • toneMap: Tone Map (Dynamic Notching) in received frame. Each bit corresponds to a sub-band of carriers and it indicates if such carriers carry message data (1) or pseudo-random data (0).
    /* Tone Map size for Cenelec(A,B) bandplan */
    #define TONE_MAP_SIZE_CENELEC                      1
    /* Tone Map size for FCC bandplan */
    #define TONE_MAP_SIZE_FCC                          3
    /* Tone Map size for ARIB bandplan */
    #define TONE_MAP_SIZE_ARIB                         3
    /* Maximum number of tone map */
    #define TONE_MAP_SIZE_MAX                          TONE_MAP_SIZE_FCC
    
    /* Subbands for Cenelec-A bandplan */
    #define NUM_SUBBANDS_CENELEC_A                     6
    /* Subbands for Cenelec-B bandplan */
    #define NUM_SUBBANDS_CENELEC_B                     4
    /* Subbands for FCC bandplan */
    #define NUM_SUBBANDS_FCC                           24
    /* Subbands for ARIB bandplan */
    #define NUM_SUBBANDS_ARIB                          16
  • carrierSnr: Array containing the SNR of each carrier within payload symbols in dB with -10 dB offset (0x00: -10 dB; 0x01: -9 dB; 0xFF: 245 dB).
    /* Number of carriers for Cenelec-A bandplan */
    #define NUM_CARRIERS_CENELEC_A                     36
    /* Number of carriers for Cenelec-B bandplan */      
    #define NUM_CARRIERS_CENELEC_B                     16
    /* Number of carriers for FCC bandplan */      
    #define NUM_CARRIERS_FCC                           72
    /* Number of carriers for ARIB bandplan */      
    #define NUM_CARRIERS_ARIB                          54
    /* Maximum number of protocol carriers */
    #define PROTOCOL_CARRIERS_MAX                      NUM_CARRIERS_FCC