<?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>CRC8 Check in NRF Connect 1.8.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87346/crc8-check-in-nrf-connect-1-8-0</link><description>Hello, 
 I am working with a sensor that generates a simple crc8 XOR on based on this code from the nrf sdk 17 and sends it to a central: 
 
 I need to check this CRC8 on the central and noticed that zephyr had a crc8 function: https://docs.zephyrproject</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 03 May 2022 08:21:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87346/crc8-check-in-nrf-connect-1-8-0" /><item><title>RE: CRC8 Check in NRF Connect 1.8.0</title><link>https://devzone.nordicsemi.com/thread/365901?ContentTypeID=1</link><pubDate>Tue, 03 May 2022 08:21:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5c8ed41-7191-4ead-8636-231991cdbd05</guid><dc:creator>jake11212</dc:creator><description>&lt;p&gt;You&amp;#39;re right, I think there was a difference in the string that was coming in because I checked it with test data, one array initialized with bytes ie: 0x52, 0x48, then the other with decimal ie: 82,72 and the check comes back the same for both.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for the help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CRC8 Check in NRF Connect 1.8.0</title><link>https://devzone.nordicsemi.com/thread/365893?ContentTypeID=1</link><pubDate>Tue, 03 May 2022 08:01:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e2e8661-4f54-4eb6-9f73-622019165480</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Are you sure that it is actually an issue with decimal to hexadecimal conversion? 0x58 is equal to (dec)88. They are identical in the memory. The only difference is when you print the data, whether you choose to print with %d or %x.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If I have a function:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void my_function(uint8_t input_number)
{
    printk(&amp;quot;hexadecimal 0x%02x&amp;quot;, input_number);
    printk(&amp;quot;decimal %d&amp;quot;, input_number);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This function would behave exactly the same if I call:&lt;/p&gt;
&lt;p&gt;my_function(0x58);&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;my_function(88);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So I suspect that if you see any issues, they are caused by something else.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What do you see, exactly?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CRC8 Check in NRF Connect 1.8.0</title><link>https://devzone.nordicsemi.com/thread/365870?ContentTypeID=1</link><pubDate>Tue, 03 May 2022 05:05:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d35d3d2e-4b09-4f00-a4d0-09ab9c974f1e</guid><dc:creator>jake11212</dc:creator><description>&lt;p&gt;Okay I was able to port it directly, that&amp;#39;s definitely the best option thanks.&amp;nbsp; The issue I&amp;#39;m running into now is that I&amp;#39;m receiving a byte array that is being cast to decimal when it&amp;#39;s saved.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;For example the first byte coming in is 0x58, but the value stored in my data array is 88.&amp;nbsp; For the crc check to function properly I need to pass it the same number of bytes in their hex form.&amp;nbsp; So just passing the first member of the data array (88) fails the check. I also can&amp;#39;t do something like convert the data to a hex string since it would increase the length.&amp;nbsp; Is there a 1:1 method to pass my data array as hex and not as decimal?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In memory the first member of the array should be in its hex form, so is there a way to dereference the memory location to get the hex value?&amp;nbsp; Or is there a better way?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CRC8 Check in NRF Connect 1.8.0</title><link>https://devzone.nordicsemi.com/thread/365180?ContentTypeID=1</link><pubDate>Wed, 27 Apr 2022 12:13:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b12ef29-2ba6-46a4-a990-669f8905dc65</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Since you already have a simple CRC8 function at hand, I suggest that you just copy it into your NCS application.&lt;/p&gt;
&lt;p&gt;If you really want to use the existing CRC8 function, just look at the implementation to figure out what the initial value and polynomial value is. I have not studied them, but I would guess the initial value is the initial value of crc_reg (0xFFFF) in your old function, and that the polynomial is either CRC_GEN_POLY or CRC_WORK_POLY from your old function.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>