<?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>Device name has only 4 letters</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/82826/device-name-has-only-4-letters</link><description>Hello everyone, 
 I have a problem with my device name. First of all I want tro write the device ID into the device name. I get the device ID over &amp;quot;RF_FICR-&amp;gt;DEVICEID[0]&amp;quot;. 
 That means I want to write the device name into a int or char and not with a #define</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 16 Dec 2021 00:44:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/82826/device-name-has-only-4-letters" /><item><title>RE: Device name has only 4 letters</title><link>https://devzone.nordicsemi.com/thread/343779?ContentTypeID=1</link><pubDate>Thu, 16 Dec 2021 00:44:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f2c724c-3872-4d9f-bb11-82f017b63056</guid><dc:creator>smackenzie</dc:creator><description>&lt;p&gt;This:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;const uint8_t * p_device_name =&amp;amp;device_namee[8];
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Is getting the address of the 8th character in `device_name`, so the p_device_name pointer is pointing to the memory after the string.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You can either change to&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;char device_namee[9] =&amp;quot;EF234ABC&amp;quot;; 
const uint8_t * p_device_name = device_namee;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;(needs to be 9 to accommodate for the null terminator byte)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Or just not bother&amp;nbsp;with the other variable and go with&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static const char* device_name =&amp;quot;EF234ABC&amp;quot;;

static void gap_params_init(void)
{
  ...
    err_code = sd_ble_gap_device_name_set(&amp;amp;sec_mode,
                                          device_name,
                                          strlen(device_name));
   ...
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Device name has only 4 letters</title><link>https://devzone.nordicsemi.com/thread/343777?ContentTypeID=1</link><pubDate>Wed, 15 Dec 2021 23:32:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70260e09-8db2-4d67-9da0-eb0d885b0009</guid><dc:creator>Rob Garner</dc:creator><description>&lt;p&gt;Hi Hani&lt;/p&gt;
&lt;p&gt;I noticed that you declare&amp;nbsp;device_namee like this:&amp;nbsp;char device_namee[8] =&amp;quot;EF234ABC&amp;quot;.&lt;/p&gt;
&lt;p&gt;So basically you are declaring an array with 8 bytes of type char.&lt;/p&gt;
&lt;p&gt;Then you set a pointer to this array, as follows:&amp;nbsp;const uint8_t * p_device_name =&amp;amp;device_namee[8]&lt;/p&gt;
&lt;p&gt;I believe that you should declare the pointer like this:&amp;nbsp;&lt;span&gt;const&amp;nbsp;char * p_device_name =&amp;amp;device_namee&amp;nbsp; &amp;nbsp;(no array size identifier here!)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;That&amp;#39;s my two cents. Let me know how that goes.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Cheers&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Rob&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>