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).
If needed, the RG_PHY_ED_LEVEL can be read out after reception of the frame, refer to PHY_ED_FRAME_END.
/* 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();
/* 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();
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.
/* 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);
1.5.2