[riot-devel] at86rf2xx: packet too large -> FCS check

Baptiste Clenet bapclenet at gmail.com
Tue May 16 15:09:32 CEST 2017


Thomas, Hauke, Martine, Kaspar what do you think about it?

My last question: how do I send a packet with length 127 octets with
at86rf2xx transceiver?

2017-05-15 14:59 GMT+02:00 Baptiste Clenet <bapclenet at gmail.com>:
> Hi,
>
> When I want to send a pkt which is 126 Octet long, I get a message
> from [at86rf2xx]:
> [at86rf2xx] error: packet too large (2 byte) to be send
>
> IEE802.15.4 MAX length is 127 so it should be sent.
> #define IEEE802154_FRAME_LEN_MAX        (127U)  /**< maximum frame length */
>
> I checked source code of at86rf2xx driver and I think I understand the
> magic number +2 in the if condition but I don't know why this is
> checked.
>
> at86rf2xx_netdev.c:110:
>
>         /* current packet data + FCS too long */
>         if ((len + ptr->iov_len + 2) > AT86RF2XX_MAX_PKT_LENGTH) {
>             DEBUG("[at86rf2xx] error: packet too large (%u byte) to be
> send (iov_len %d, i %d, count %d)\n",
>                   (unsigned)len + 2, ptr->iov_len, i, count);
>             return -EOVERFLOW;
>         }
>
> +2 mean two FCS octets?
> In the samr21 datasheet, 37.3 Frame Check Sequence (FCS) [1]:
>
> For a frame with a frame length specified as N (3 ≤ N ≤ 127), the FCS
> is calculated on the first N-2 octets in the Frame Buffer, and the
> resulting FCS field is transmitted in place of the last two octets
> from the Frame Buffer.
> Example:
> A frame transmission of length five with TX_AUTO_CRC_ON set, is
> started with a Frame Buffer write access of five bytes (the last two
> bytes can be omitted). The first three bytes are used for FCS
> generation; the last two bytes are replaced by the internally
> calculated FCS.
>
> So while I think we should remove the +2 test and let the possibility
> to send packet up to 127 octets and I don't understand the part in
> datasheet: "the last two bytes are replaced by the internally
> calculated FCS". This mean that a part of data is erased? (for 5
> octets or 127)
>
> Cheers,
>
> [1] http://www.atmel.com/Images/Atmel-42223%E2%80%93SAM-R21_Datasheet.pdf
>
>
> --
> Baptiste



-- 
Baptiste


More information about the devel mailing list