<?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>NRF52805 Issue: UICR Reading via application</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/105865/nrf52805-issue-uicr-reading-via-application</link><description>Hardware setup: Custom board using BC805M-P (with App protect) Software: nrf5 SDK S112 v17.0.2 -&amp;gt; Segger V7.30 
 My Objective: 
 Show the serial number read from the &amp;quot;UICR Customer 0&amp;quot; register during runtime by the application code under DIS on BLE. P</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 27 Nov 2023 10:50:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/105865/nrf52805-issue-uicr-reading-via-application" /><item><title>RE: NRF52805 Issue: UICR Reading via application</title><link>https://devzone.nordicsemi.com/thread/457527?ContentTypeID=1</link><pubDate>Mon, 27 Nov 2023 10:50:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f3fc789-219b-47ec-9807-3040c9515bb1</guid><dc:creator>Gokulnath</dc:creator><description>&lt;p&gt;Thanks&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I&amp;#39;ve made it work like this.&lt;br /&gt;&lt;br /&gt;char SERIAL_NUMBER[12];&lt;br /&gt;&lt;br /&gt;itoa((int)NRF_UICR-&amp;gt;CUSTOMER[0],SERIAL_NUMBER, 16);&amp;nbsp; //getting the serial number from UICR&lt;br /&gt;&lt;br /&gt;Then passing it to the &amp;quot;DIS&amp;quot;.&lt;br /&gt;&lt;br /&gt;Thanks for your suggestion&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52805 Issue: UICR Reading via application</title><link>https://devzone.nordicsemi.com/thread/457183?ContentTypeID=1</link><pubDate>Thu, 23 Nov 2023 13:56:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aad55feb-ed15-453f-a3a3-20152ea0f039</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is quite basic C programming syntax that you&amp;#39;re asking about. I can give you some hints, but you have to learn this if you are to develop firmware. You can setup generic itoa() examples on your host OS instead of running it on the embedded device, if you want to play around with how string conversions work.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;* You need to declare an array instead of&amp;nbsp;the pointer &amp;quot;SERIAL_NUMBER&amp;quot;.&lt;/p&gt;
&lt;p&gt;* You can provide the NRF_UICR-&amp;gt;CUSTOMER[0] directly to itoa, if this is the only number you want to convert from hex to ascii.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52805 Issue: UICR Reading via application</title><link>https://devzone.nordicsemi.com/thread/457000?ContentTypeID=1</link><pubDate>Wed, 22 Nov 2023 15:53:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a21ef40-b613-47e9-b4af-8d080f4982a4</guid><dc:creator>Gokulnath</dc:creator><description>&lt;p&gt;Hey, I&amp;#39;ve checked out &amp;amp; I&amp;#39;m unable to solve it. I&amp;#39;m not very experienced in coding.&lt;br /&gt;&lt;br /&gt; could you help me with the example code, please? or some sample suggestions would be greatly appreciated.&lt;/p&gt;
&lt;p&gt;Thanks and have a good day.&lt;br /&gt;Gokulnath&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52805 Issue: UICR Reading via application</title><link>https://devzone.nordicsemi.com/thread/456459?ContentTypeID=1</link><pubDate>Mon, 20 Nov 2023 14:26:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7cb3bca1-4517-44dc-ba4e-b263000cbbab</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;You need to give itoa() a valid memory area, not a uninitialized pointer.&lt;/p&gt;
&lt;p&gt;See the documentation for the standard function:&amp;nbsp;&lt;a href="https://cplusplus.com/reference/cstdlib/itoa/"&gt;https://cplusplus.com/reference/cstdlib/itoa/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52805 Issue: UICR Reading via application</title><link>https://devzone.nordicsemi.com/thread/456431?ContentTypeID=1</link><pubDate>Mon, 20 Nov 2023 13:35:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80d2e71b-aa02-4cc6-becf-adb9f66240d2</guid><dc:creator>Gokulnath</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Thanks for your reply.&lt;br /&gt;&lt;br /&gt;Sorry my bad on the original explanation:&amp;nbsp; i basically meant xxxx value of an Hex string max 8 char&lt;br /&gt;&lt;br /&gt;I basically mean this for example.&lt;br /&gt;2) nrfjprog --memwr 0x10001080 --val 0x0E (or) &lt;strong&gt;as an eg. (005A340E)&lt;/strong&gt;&lt;/p&gt;
[quote userid="2115" url="~/f/nordic-q-a/105865/nrf52805-issue-uicr-reading-via-application/456411"]2) nrfjprog --memwr 0x10001080 --val xxxxxxxx&amp;nbsp; &amp;nbsp;[/quote]
&lt;p&gt;&lt;br /&gt;&amp;nbsp;to convert it to Ascii could you let me know some example code here, please?on itoa() function I&amp;#39;m unable to find it on my side.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;code on my side.&lt;/strong&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;uint8_t* SERIAL_NUMBER;&lt;br /&gt;&lt;br /&gt; uint8_t* uicr_val= (uint8_t *)NRF_UICR-&amp;gt;CUSTOMER[0]; //getting the serial number from UICR&lt;br /&gt;&lt;br /&gt; itoa(*uicr_val, &amp;amp;SERIAL_NUMBER,16);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span&gt;ble_srv_ascii_to_utf8(&amp;amp;dis_init.serial_num_str, (char *)SERIAL_NUMBER);&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// sending it to DIS&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;getting this error &lt;/strong&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;quot;passing argument 2 of &amp;#39;itoa&amp;#39; from incompatible pointer type [-Wincompatible-pointer-types]&amp;quot; finding it difficult to solve this issue on my side.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Thanks&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52805 Issue: UICR Reading via application</title><link>https://devzone.nordicsemi.com/thread/456411?ContentTypeID=1</link><pubDate>Mon, 20 Nov 2023 12:58:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a829a82e-b4b7-4649-88c4-aa06add4a1f5</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]2) nrfjprog --memwr 0x10001080 --val xxxxxxxx&amp;nbsp; &amp;nbsp; &amp;nbsp;[/quote]
&lt;p&gt;This requires that you write an actual string, ie a ASCII null terminated byte array.&lt;/p&gt;
&lt;p&gt;What&amp;nbsp;ble_srv_ascii_to_utf8 does is to convert an ASCII string to utf8, and if the input is not \0 terminated, it will not work as you intend it to.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I suspect you first have to convert your value(s) to ASCII (itoa() for instance)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>