Hi Ahed,

> buf[1] = IEEE802154_FCF_VERS_V1  means the 12th bit is set to 1, or the 11th 
> bit if we start counting FCF bits from 0 to 15.

Not quite, it sets 12th bit counting from 0 (or 13th counting from 1,
but let's not count from 1 :) ).

See https://pastebin.com/D29acwf4

Hope this helps.

Best,
Anton


On Wed, Nov 27, 2019 at 3:09 PM Aboodi Ahed Hussein Ali
<abo...@student.usm.my> wrote:
>
> Thank you, Anton. Please bear with me if I misunderstood any programming 
> fundamentals,
>
> I agree that the 4th bit of buf[1] is set to 1, but according to FCF format 
> the 13th and 14th bits, of buf[0-1], must be set for frame version, or if you 
> start counting the FCF bits from 0 to 15, bit 12 and bit 13 are the frame 
> version bits.
>
> buf[1] = IEEE802154_FCF_VERS_V1  means the 12th bit is set to 1, or the 11th 
> bit if we start counting FCF bits from 0 to 15.
>
> Besides, when I did print buf[1] I get decimal 16, while I should get decimal 
> 8 for the frame version to be set.
>
> Ahed
> .
> ________________________________
> From: Aboodi Ahed Hussein Ali <abo...@student.usm.my>
> Sent: Wednesday, November 27, 2019 9:15 PM
> To: RIOT OS developers list <devel@riot-os.org>
> Subject: Re: IEEEE 802.15.4 FCF Format in 
> "RIOT/sys/net/link_layer/ieee802154/ieee802154.c"
>
> Thank you, Joakim, but I don't think it is correct.
>
> Starting from 0, bit No. 3 of the IEEE802154_FCF_VERS_V1 (Hex 0x10 or binary: 
> 0001 0000) have the value 1, thus 0 to 3 represent 8 to 11 on buf[1]. 
> therefor, the bit No. 3, in 0x10, is set on bit No. 11 of the FCF.
>
> Not sure if the below illustration will be on a layout.
> ---buf[0]         buf[1]
> 0000 0000   0000 0000       <-- FCF
> ------------- 0001 0000       <-- IEEE802154_FCF_VERS_V1
>
> This means that the Frame version is not really set probably or this file 
> "RIOT/sys/net/link_layer/ieee802154/ieee802154.c" follows a different FCF 
> format!!
>
> Am I correct or did I misunderstand that?
>
> Ahed
> ________________________________
> From: Aboodi Ahed Hussein Ali
> Sent: Wednesday, November 27, 2019 5:58 AM
> To: RIOT OS developers list <devel@riot-os.org>
> Subject: IEEEE 802.15.4 FCF Format in 
> "RIOT/sys/net/link_layer/ieee802154/ieee802154.c"
>
> Hi all,
>
> I am having a hard time understanding how the "ieee802154_set_frame_hdr" 
> function, found in this link, sets the Frame Control Field (FCF) for 802.15.4 
> frame header.
> Following the IEEE 802.15.4 FCF format, frame version should be at the 
> 12-13th bit of the 2-byte FCF, while in the function code, the frame version 
> was set at the 11th bit. Does it uses different FCF format or am I missing 
> something?
>
> This is the first part of the function:
>
> size_t ieee802154_set_frame_hdr(uint8_t *buf, const uint8_t *src, size_t 
> src_len,
>                                 const uint8_t *dst, size_t dst_len,
>                                 le_uint16_t src_pan, le_uint16_t dst_pan,
>                                 uint8_t flags, uint8_t seq)
> {
>     int pos = 3;    /* 0-1: FCS, 2: seq */
>     uint8_t type = (flags & IEEE802154_FCF_TYPE_MASK);
>
>     buf[0] = flags;
>     buf[1] = IEEE802154_FCF_VERS_V1;          // IEEE802154_FCF_VERS_V1 is 
> defined as 0x10
>
>     if (((src_len != 0) && (src == NULL)) ||
>         ((dst_len != 0) && (dst == NULL))) {
>         return 0;
>     }
> ...
> ...
>
> The first two bytes of the *buf represent the FCF. I would appreciate it if 
> someone explains or provides the FCF format that RIOT-OS uses.
>
> Thank you,
> Ahed
>
> _______________________________________________
> devel mailing list
> devel@riot-os.org
> https://lists.riot-os.org/mailman/listinfo/devel
_______________________________________________
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel

Reply via email to