<?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>Unique BLE device name</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16389/unique-ble-device-name</link><description>Hi, 
 I am currently writing the firmware of one of our products that will be produced in mass market, and now my goal is to have a unique BLE device name for every sample. I try to use the DEVICEADDR register to generate a 16 bit number that will be</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 14 Sep 2016 09:42:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16389/unique-ble-device-name" /><item><title>RE: Unique BLE device name</title><link>https://devzone.nordicsemi.com/thread/62743?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2016 09:42:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06fe47db-0898-41d4-9e9d-2b747b43c9b9</guid><dc:creator>Guillaume Levant</dc:creator><description>&lt;p&gt;Thanks Alex, I&amp;#39;ll use deviceid !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unique BLE device name</title><link>https://devzone.nordicsemi.com/thread/62745?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2016 09:41:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72f8e8ff-0496-4800-b5ae-c01f6abac6f3</guid><dc:creator>Guillaume Levant</dc:creator><description>&lt;p&gt;Thanks for your answer, instead of using BLE address I will use device id which tend to be more unique. But anyway I use your code as a template :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unique BLE device name</title><link>https://devzone.nordicsemi.com/thread/62740?ContentTypeID=1</link><pubDate>Tue, 13 Sep 2016 13:28:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5828ad08-04c7-45dd-8952-d2f3d9fade43</guid><dc:creator>Alex</dc:creator><description>&lt;p&gt;Just a reminder that MAC address is not guaranteed to be unique although in most cases it is more than enough.  If you need really unique number then use NRF_FICR-&amp;gt;DEVICEID[0], NRF_FICR-&amp;gt;DEVICEID[1]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unique BLE device name</title><link>https://devzone.nordicsemi.com/thread/62744?ContentTypeID=1</link><pubDate>Tue, 13 Sep 2016 13:15:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7598492e-1508-4aee-a8a5-6f7baa69ee7d</guid><dc:creator>Christopher</dc:creator><description>&lt;p&gt;If you want to add the Bluetooth address (or some bytes) at the end of the advertising name of your device, you should do something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define DEVICE_NAME           &amp;quot;&amp;lt;name&amp;gt;&amp;quot;
#define DEVICE_NAME_MAX_SIZE  18

// Append the two MSB of the BLE address, for instance
// - BLE address  = AB:CD:XX:XX:XX:XX
// - BLE ADV name = &amp;lt;name&amp;gt; ABCD

char device_name[DEVICE_NAME_MAX_SIZE];
uint8_t name_size = strlen(DEVICE_NAME);

memcpy(device_name, DEVICE_NAME, name_size);

// Encode the BLE address as a String and set the advertising name
sprintf(&amp;amp;device_name[name_size], &amp;quot; %X%X&amp;quot;, addr.addr[BLE_GAP_ADDR_LEN - 1], addr.addr[BLE_GAP_ADDR_LEN - 2]);
uint32_t errCode= sd_ble_gap_device_name_set(&amp;amp;sec_mode, (const uint8_t *) device_name, name_size + 5);
APP_ERROR_CHECK(errCode);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can use the &lt;code&gt;sprintf&lt;/code&gt; function to format the advertising name as you like.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unique BLE device name</title><link>https://devzone.nordicsemi.com/thread/62741?ContentTypeID=1</link><pubDate>Tue, 13 Sep 2016 13:02:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8089fa5e-9beb-4b7f-9f91-02b59f055650</guid><dc:creator>Guillaume Levant</dc:creator><description>&lt;p&gt;Thanks for your comment, I added the errors in the main post ;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unique BLE device name</title><link>https://devzone.nordicsemi.com/thread/62742?ContentTypeID=1</link><pubDate>Tue, 13 Sep 2016 12:58:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d330200-5de8-4f33-ad33-ebe5c77915fc</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;&amp;quot;the code doesn&amp;#39;t compile&amp;quot; any errors?
also:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ble_gap_addr_t *p_addr;
sd_ble_gap_address_get(p_addr);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;should be:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ble_gap_addr_t p_addr;
sd_ble_gap_address_get(&amp;amp;p_addr);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;so there is some memory reserved for that address... change the rest of the code according to the changed type.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>