Frame Receive Procedure (RX)

For receiving frames in the Basic Operating Mode, the radio transceiver needs to be in the state RX_ON, as deescribed in section Transitions to State RX_ON.

The end of a frame reception is denoted by the TRX_IRQ_TRX_END interrupt. Just after this interrupt the SR_RX_CRC_VALID bit can be read. If this bit is set, the FCS of the received frame was valid. Otherwise, a corrupted frame was received. The SR_RX_CRC_VALID bit will be cleared after the next TRX_IRQ_TRX_END.

A received frame is stored in the frame buffer of the radio transceiver as follows:

             0   1   2                    L-2 L-1  L
           +---+---+---+---+---+---+/.../+---+---+---+
           | D | D | D | D | D | D |     |D/F|D/F|LQI|
           +-o-+---+---+---+---+---+/.../+-o-+-o-+-o-+
           |                                       |
           |<-- access via "SRAM Read Access"  --->|

             0   1   2                    L-2 L-1  L
    +---+  +---+---+---+---+---+---+/.../+---+---+---+
    | P |  | D | D | D | D | D | D |     |D/F|D/F|LQI|
    +-o-+  +-o-+---+---+---+---+---+/.../+-o-+-o-+-o-+
      |                                            |
      |<---- access via "Frame Read Access"  ----->|

      P   : PHR field containing the PSDU length information L
      D,F : D = data byte, F = FCS byte (D and F belong to the PSDU)
      LQI = link quality indication value for the received frame

  

The PHR field of a received frame is stored in an internal register of the radio transceiver and has a range from
L = [1...127].
It can only be read from the MCU with a SPI frame buffer read command (see trx_frame_read).

Note:
The LQI value for the currently received frame is stored directly behind the last byte of the received frame in the frame buffer. It is available after the TRX_IRQ_TRX_END interrupt.

If needed, the RG_PHY_ED_LEVEL can be read out after reception of the frame, refer to PHY_ED_FRAME_END.

Use Cases:


PHY_DATA_INDICATION_MATCH

This procedure loads the frame from the radio transceiver, when it is completely received and stored in the frame buffer. In this use case it is assumed, that the incoming frame passes the Address Filter and thus the interrupt TRX_IRQ_AMI occurs. If the entire frame buffer read takes longer than tTR27, there is a risk, that the currently stored frame is overwritten by the next frame being received. This can be avoided with one of the procedures described in Frame Buffer Protection (Static/Dynamic).

inline_mscgraph_71
Code example
    /* AT86RF231::RX_ON && AT86RF231::BUSY_RX */
    /* TRX_IRQ_RX_START occurs here */
    /* TRX_IRQ_AMI occurs here */
    /* TRX_IRQ_TRX_END occurs here */
    /* AT86RF231::RX_ON */
    crc_valid = trx_bit_read(SR_RX_CRC_VALID);
    frame = trx_frame_read();

PHY_DATA_INDICATION_NOMATCH

This use case describes the same procedure as PHY_DATA_INDICATION_MATCH. The only difference is that the address field of the incoming frame does not pass the frame filter according to the filter rules described in section section 7.2.3.5 of the datasheet of the AT86RF231 datasheet. Thus, no TRX_IRQ_AMI occurs.

inline_mscgraph_72
Code example
    /* AT86RF231::RX_ON && AT86RF231::BUSY_RX */
    /* TRX_IRQ_RX_START occurs here */
    /* TRX_IRQ_TRX_END occurs here */
    /* AT86RF231::RX_ON */
    crc_valid = trx_bit_read(SR_RX_CRC_VALID);
    frame = trx_frame_read();

PHY_DATA_INDICATION_FAST

In order to meet the strict timing constraints of the acknowledgement procedure in the IEEE 802.15.4 standard, the frame buffer can be read in parallel to the frame reception. In order to avoid a RX underrun condition, the frame read procedure has to be started so that it is finished after the reception of the last PSDU octet.

After the TRX_IRQ_RX_START interrupt the PHR field is read in order to determine the frame length flen (see trx_frame_length_read()). The value twait denotes the waiting time before the frame buffer read is started. It depends on the SPI transfer rate Rspi [octets/s], the data rate Rdata [octets/s] and the frame length flen [octets]. It is computed according the following formula:

twait [s] > flen *(1/Rdata-1/Rspi)

When the TRX_IRQ_TRX_END interrupt occurs, the frame is already uploaded in a buffer and the acknowledge procedure can be started immediately.

Note:
If the frame upload is started earlier than twait, a TRX_IRQ_TRX_UR interrupt is generated and the data has to be uploaded again (see PHY_EVENT_TRX_UR_RX). However, this can be avoided by using the Frame Buffer Empty Indicator. In this case, the calculation of twait and the corresponding delay is not needed.
inline_mscgraph_73
Code example
    /* AT86RF231::RX_ON && AT86RF231::BUSY_RX */
    /* TRX_IRQ_RX_START occurs here */
    flen = trx_frame_length_read();
    delay(twait);
    frame = trx_frame_read();
    /* TRX_IRQ_TRX_END occurs here */
    crc_valid = trx_bit_read(SR_RX_CRC_VALID);
    ASSERT(crc_valid==1);
    /* AT86RF231::RX_ON */
    generate_ack(frame);

Generated on Mon Jan 12 18:32:18 2009 for SWPM AT86RF231 by  doxygen 1.5.2