Frame Reception (RX)

For the reception of frames in the basic mode, the radio transceiver needs to be in the state RX_ON (see also section Transitions to State RX_ON [06]).

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

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

      L = length byte, D = data byte, F = FCS byte,
      LQI = link quality indication value for the received frame

  

The length byte L 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 Receive Mode" access (see trx_frame_read).

Note:
The LQI value for the currently received frame is stored one byte after the last frame byte in the SRAM. It is available 32 us 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.

The following sequences are defined:


PHY_DATA_INDICATION

This procedure loads the frame from the radio transceiver, when it is completely received and stored in the SRAM. If the entire frame upload takes longer than 96 us, there is a risk, that the currently stored frame is overwritten by the next frame beeing received. With a temporary switch to state PLL_ON this risk is eliminated (see PHY_STATE_[PLL_ACTIVE]__PLL_ON).

inline_mscgraph_57
Code example
    /* TRX_IRQ_RX_START occurs here */
    /* TRX_IRQ_TRX_END occurs here */
    frame = trx_frame_read();

PHY_DATA_INDICATION_FAST

In order to meet the timing constraints for ACK frame generation, the frame upload might be started so, that it is finished at the same time, when the last byte is completely received. Therefore, after the TRX_IRQ_RX_START interrupt the frame length value has to be read from the tranceiver using the "Frame Receive Mode" command (see trx_frame_length_read).

Because the TRX_IRQ_RX_START interrupt is generated right after the reception of the SFD, a wait period of 32 us is necessary before the frame length byte can be read.

The duration twait is computed with the function frame_rx_delay() after the frame length is available. The value of twait depends on the SPI transfer rate and the frame length itself. It denotes the point in time, when the frame upload can be started. When the TRX_IRQ_TRX_END interrupt occurs, the uploaded frame is available in a buffer and the acknowledge procedure can be started.

Note:
If the frame upload is started too early, an TRX_IRQ_TRX_UR interrupt is generated and the data have to be uploaded again (see PHY_EVENT_TRX_UR_RX).
inline_mscgraph_58
Code example
    /* TRX_IRQ_RX_START occurs here */
    delay_us(32);
    flen = trx_frame_length_read();
    twait = frame_rx_delay(flen);
    frame = trx_frame_read();
    /* TRX_IRQ_TRX_END occurs here */
    generate_ack(frame);

Generated on Fri Aug 10 16:10:05 2007 for SWPM AT86RF230 Rev. A by  doxygen 1.5.2