1.5.1.3 Reception

When G3 MAC-RT layer receives a PLC message, first it checks the Frame Check Sequence (FCS, CRC), so it is not needed to check it in upper layers. If the FCS is correct, the frame is decoded and depending on the destination PAN identifier and destination address it is reported to the upper layer:
  • If the PAN ID is different to the PAN ID configured by the upper layer (MAC_RT_PIB_PAN_ID) and is not the Broadcast PAN ID (0xFFFF), a communication status indication event is reported through DRV_G3_MACRT_COMM_STATUS_IND_CALLBACK. The only parameter is a pointer to the received MAC header. This callback is not set in this example. For more information about the usage of this event, refer to the G3-PLC specification.
  • If the frame type is beacon, it is always processed. Otherwise, if the destination PAN ID is the Broadcast PAN ID or is the same as the PAN ID configured by the upper layer, and the destination address is the Broadcast Address (0xFFFF) or is the same as the address configured by the upper layer (MAC_RT_PIB_SHORT_ADDRESS, MAC_RT_PIB_MANUF_EXTENDED_ADDRESS), the frame is processed and acknowledgment (ACK) is sent if requested in the MAC header (ackRequest bit on the MAC_RT_FRAME_CONTROL structure). If the frame is processed and it is not duplicated or repetition:
    • If the frame type is MAC command (Beacon Request or Tone Map Response) it is automatically handled by MAC-RT and is not reported to the upper layer.
      • Beacon Request: Beacon frame is sent as response.
      • Tone Map Response: Neighbor table is updated with modulation and Tone Map information for the transmitter node.
    • If the frame type is Beacon or Data, it is reported to the upper layer in two steps:
      1. Reception parameters indication event: Specific to G3-PLC MAC implementation. It is processed in the callback function APP_PLC_RxParamsIndCallback. This callback receives as parameter a data structure of type MAC_RT_RX_PARAMETERS_OBJ, containing all the available information from the message.
      2. Reception data indication event: Reception of standard 802.15.4 MAC data frame, handled by callback APP_PLC_DataIndCallback where the pointer to received data (pData) and length in bytes (length) are given.

Structure MAC_RT_RX_PARAMETERS_OBJ

The reception parameters are stored in the data structure MAC_RT_RX_PARAMETERS_OBJ, defined in drv_g3_macrt_comm.h:
// *****************************************************************************
/* G3 MAC RT Reception parameters

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

   Remarks:
    None
*/
typedef struct __attribute__((packed, aligned(1))) {
    /* High Priority */
    bool highPriority;
    /* PDU Link Quality */
    uint8_t pduLinkQuality;
    /* Phase Differential */
    uint8_t phaseDifferential;
    /* Modulation Type */
    MAC_RT_MOD_TYPE modType;
    /* Modulation Scheme */
    MAC_RT_MOD_SCHEME modScheme;
    /* Tone map */
    MAC_RT_TONE_MAP toneMap;
    /* Tone map Response */
    MAC_RT_TONE_MAP_RSP_DATA toneMapRsp;
} MAC_RT_RX_PARAMETERS_OBJ;
Where:
  • highPriority: Indicates if the frame was sent with high priority.
  • pduLinkQuality: PDU Link Quality (LQI).
  • phaseDifferential: 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.
  • modType: Modulation type of the received frame.
    modType Value Description
    MAC_RT_MOD_ROBUST 0 BPSK Robust (4 repetitions) Modulation Type
    MAC_RT_MOD_BPSK 1 BPSK Modulation Type
    MAC_RT_MOD_QPSK 2 QPSK Modulation Type
    MAC_RT_MOD_8PSK 3 8PSK Modulation Type
    MAC_RT_MOD_16QAM 4 16QAM Modulation Type. Not supported.
  • modScheme: Modulation scheme of the received frame.
    modScheme Value Description
    MAC_RT_MOD_SCHEME_DIFFERENTIAL 0 Differential Modulation Scheme
    MAC_RT_MOD_SCHEME_COHERENT 1 Coherent Modulation Scheme
  • 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
    
    #define MAX_PHY_TONE_GROUPS             24
    
    // *****************************************************************************
    /* G3 Tone Map
    
       Summary
        Tone Map definition supported by G3 spec.
    
       Remarks:
        None
    */
    typedef struct {
        uint8_t toneMap[(MAX_PHY_TONE_GROUPS + 7) / 8];
    } MAC_RT_TONE_MAP;
  • toneMapRsp: Tone Map Response data. It contains the most optimal modulation and Tone Map for the transmitter node, in terms of data-rate and robustness.
    // *****************************************************************************
    /* G3 Tone map response data
    
       Summary
        This struct includes modulation type, modulation scheme and Tone Map data
    
       Remarks:
        For more information about Tone Map Response functionality, please refer to
        G3 Specification
    */
    typedef struct {
        /* Modulation type */
        MAC_RT_MOD_TYPE modType;       
        /* Modulation scheme */             
        MAC_RT_MOD_SCHEME modScheme;   
        /* Tone Map */             
        MAC_RT_TONE_MAP toneMap;           
    } MAC_RT_TONE_MAP_RSP_DATA;