The end of a frame reception is indicated by the TRX_IRQ_TRX_END interrupt. At the same time, the sub register SR_RX_CRC_VALID is updated with the result of the FCS check. The value {1} in this sub register indicates, that the received frame contains a correct CRC16.
A received frame is stored in the frame buffer of the radio transceiver in the following way:
0 1 2 L-1 L L+1 L+2 L+3
+--- --- --- --- --- --- --- ~~~~~~ --- ---+--- --- ---+
| P | D | D | D | D | D | D | |D/F|D/F|LQI|ED |RXS|
+--- --- --- --- --- --- --- ~~~~~~ --- ---+--- --- ---+
| | |
|<--- access via "SRAM Read Access" ----->| |
| |
|<--- 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
ED : energy value for the received frame
RXS : RX_STATUS value for the received frame
The PHR field of a received frame contains the PSDU length L, which has a valid range from {1,...,127}. The PHR field and the PSDU bytes can be read with the functions trx_frame_read() and/or trx_sram_read(). The RX Frame Status Information (LQI, ED, RX_STATUS) is stored directly after the last byte of the PSDU and is only accessible with the function trx_frame_read().
Use Cases:
/* AT86RF212::RX_ON && AT86RF212::BUSY_RX */ /* TRX_IRQ_RX_START occurs here */ /* TRX_IRQ_AMI occurs here */ /* TRX_IRQ_TRX_END occurs here */ /* AT86RF212::RX_ON */ crc_valid = trx_bit_read(SR_RX_CRC_VALID); frame = trx_frame_read();
/* AT86RF212::RX_ON && AT86RF212::BUSY_RX */ /* TRX_IRQ_RX_START occurs here */ /* TRX_IRQ_TRX_END occurs here */ /* AT86RF212::RX_ON */ crc_valid = trx_bit_read(SR_RX_CRC_VALID); frame = trx_frame_read();
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.
/* AT86RF212::RX_ON && AT86RF212::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 */ /* AT86RF212::RX_ON */ generate_ack(frame);
1.5.6