<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Calculation of CRC in Frame Check Sequence (FCS) field of IEEE 802.15.4</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110467/calculation-of-crc-in-frame-check-sequence-fcs-field-of-ieee-802-15-4</link><description>Hello Devzone Community, 
 I try to redo the CRC check of an incoming IEEE 802.15.4 frame in software after manipulating certain positions. 
 Since the check of the Frame Check Sequences (FCS) is done in HW directly at the arrival of the frame, I extract</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 23 Apr 2024 14:33:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110467/calculation-of-crc-in-frame-check-sequence-fcs-field-of-ieee-802-15-4" /><item><title>RE: Calculation of CRC in Frame Check Sequence (FCS) field of IEEE 802.15.4</title><link>https://devzone.nordicsemi.com/thread/480253?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 14:33:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d8a94e7-2b8d-4f64-8631-c99053e9f42b</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Thank you for sharing the details to make this work!&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Calculation of CRC in Frame Check Sequence (FCS) field of IEEE 802.15.4</title><link>https://devzone.nordicsemi.com/thread/480220?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 13:12:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:246be756-b899-4963-9cee-ae7586639abe</guid><dc:creator>fabian2</dc:creator><description>&lt;p&gt;Hello Kenneth,&lt;/p&gt;
&lt;p&gt;Thanks for the fast response. I was able to solve my issue and it was indeed related to endianess on bit level!&lt;/p&gt;
&lt;p&gt;Furthermore, I have found a different blog post about the CRC topic on the nRF in&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/109415/esb-crc-calculation"&gt;ESB CRC calculation&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To re-calculate the CRC of the payloads, that I have provided in the upper table, I have tried out different algorithm implementations. However, it makes more sense to test at first with bit-symmetric payloads, i.e, 0xE7 =&amp;nbsp;&lt;span&gt;11100111&lt;/span&gt; or 0xFF to make sure that we don&amp;#39;t face any endianess issues.&lt;/p&gt;
&lt;p&gt;With these test payloads, I identified that the big-endian version of the CRC algorithm in RIOT OS works as the one on the nRF.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/RIOT-OS/RIOT/blob/master/sys/checksum/ucrc16.c#L26"&gt;https://github.com/RIOT-OS/RIOT/blob/master/sys/checksum/ucrc16.c#L26&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;(Maybe interesting ... there are corresponding unit tests demonstrating the use of the algorithm, too:&amp;nbsp;&lt;a id="" href="https://github.com/RIOT-OS/RIOT/blob/0dc150f3fbc5cc7bf050a8bf209298d430e23bab/tests/unittests/tests-checksum/tests-checksum-ucrc16.c"&gt;https://github.com/RIOT-OS/RIOT/blob/0dc150f3fbc5cc7bf050a8bf209298d430e23bab/tests/unittests/tests-checksum/tests-checksum-ucrc16.c&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;When using this CRC16 algorithm and poly set to 0x1021 and seed set to 0x0000, I was able to reproduce the CRC values of the nRF for bit-symmetric payloads.&lt;/p&gt;
&lt;p&gt;Since my test-script ran on a little-endian based system, the&amp;nbsp;payload had to be converted bit-wise, i.e., a 0x01 payload corresponds to 0x80 input of the algorithm.&lt;/p&gt;
&lt;p&gt;This helped me to re-calculate the CRC values in the FCS field of an IEEE 802.15.4 frame transmitted among nRF nodes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Calculation of CRC in Frame Check Sequence (FCS) field of IEEE 802.15.4</title><link>https://devzone.nordicsemi.com/thread/480012?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2024 13:30:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86f2272b-bb36-43fd-95ee-11ab9a61f645</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;As you write, this is handled in hardware and not something we usually are much involved in. Tyically we configure the radio, and the hardware does the rest. I don&amp;#39;t have any indication this is done wrong. The common problem with calculating crc in software is related to endianess, seed and what data it should be calculated over (e.g. should the address be included, is there any data related to length that is not directly part of the payload etc).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So for instance a payload of 0x01&amp;nbsp;might be either 0000 0001 or 1000 0000 depending on endianess on bit level.&lt;/p&gt;
&lt;p&gt;Kenneth&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>