<?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>ESB CRC calculation</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/109415/esb-crc-calculation</link><description>Hi, 
 I have two nRF52840-DK with one transmitting and one receiving. I have been trying to calculate the CRC for an ESB packet. However, the CRC reported by the Rx board (using nrf_radio_rxcrc_get(NRF_RADIO) ) differs with my calculations. 
 The ESB</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Mar 2024 10:54:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/109415/esb-crc-calculation" /><item><title>RE: ESB CRC calculation</title><link>https://devzone.nordicsemi.com/thread/474841?ContentTypeID=1</link><pubDate>Wed, 20 Mar 2024 10:54:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d8a9735-43fc-4699-ad04-2c1d0b1d30f0</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;I can find several cases discussing calculation of CRC here on devzone, it should be the same for all variants of the nRF24-, nRF51, nRF52-series. I suggest to take a look at them, but afaik it should be standard CRC-16-CCITT (though I have seen someone mention False at the end, if that make any difference).&lt;/p&gt;
&lt;p&gt;Kenenth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ESB CRC calculation</title><link>https://devzone.nordicsemi.com/thread/474811?ContentTypeID=1</link><pubDate>Wed, 20 Mar 2024 09:36:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1136168-1076-4e67-ae8c-dbec3776a876</guid><dc:creator>RLC</dc:creator><description>&lt;p&gt;Hi Kenneth,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for the quick response.&lt;/p&gt;
&lt;p&gt;You are absolutely correct. I have not found any online calculators that perform a bitwise calculation of the CRC. Hence, I created one in Excel using manual long division (attached).&lt;/p&gt;
&lt;p&gt;I further validated my spreadsheet by deleting a bit from the Packet Control Field. The Address + (modified) Packet Control Field + Payload is then a multiple of 8-bits. This can be conveniently represented as bytes. Using the calculator at&amp;nbsp;&lt;a id="" href="https://crccalc.com/"&gt;https://crccalc.com/&lt;/a&gt;&amp;nbsp;for&amp;nbsp;&lt;span&gt;CRC-16/AUG-CCITT, I get the same CRC as my spreadsheet.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As the link suggests, the MSByte and MSBit ordering can be a source of error. I&amp;#39;ve simplified this by:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;1. Using the same value for all address and prefix bytes. Hence, byte-order is not an issue for the address/prefix.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. Using 0xE7 for the address/prefix. This is 0b11100111 so bit-order is not an issue for the address/prefix.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3. Use payload of all 0x00. Hence, bit/byte order is not an issue for the payload.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Is the ESB 2-byte CRC calculated as per CRC-CCITT? The documentation suggests so but doesn&amp;#39;t say explicitly.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ESB CRC calculation</title><link>https://devzone.nordicsemi.com/thread/474627?ContentTypeID=1</link><pubDate>Tue, 19 Mar 2024 13:17:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54e86201-6d92-4be8-a407-8eb1e85fcfa9</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;It&amp;#39;s a long time since I looked into this, and since it&amp;#39;s done in hardware most of the time (at least for the radio) I must admit I don&amp;#39;t remember the details. What I remember barely is that many (at least online) crc calculators need byte aligned data, while in this case it&amp;#39;s not. So you may need to take a look at this old thread on how to calculate crc on bit (not byte):&lt;br /&gt;&lt;a href="https://stackoverflow.com/questions/27332600/crc-bit-order-confusion"&gt;https://stackoverflow.com/questions/27332600/crc-bit-order-confusion&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>