<?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>to generate random address</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23456/to-generate-random-address</link><description>since im working on sdk9... advertising program(hello world).i wanted to generate a random address .but i couldnot complete it sucessfully.can you please help me in providing me the code for sdk9 to generate random address.
thanking you 
 with regards</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 13 Jul 2017 12:05:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23456/to-generate-random-address" /><item><title>RE: to generate random address</title><link>https://devzone.nordicsemi.com/thread/92153?ContentTypeID=1</link><pubDate>Thu, 13 Jul 2017 12:05:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8c07a69-ef07-43b2-8402-4856dcdc0bd6</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;We don&amp;#39;t deliver any specific code examples on how to generate you own BLE address.
The default BLE address for your chip is derived from the NRF_FICR-&amp;gt;DEVICEADDR registers. These registers are randomly generated in our production, and they are unique for each device (2^46 different combinations, due to MSbits set to &amp;#39;11&amp;#39;). See &lt;a href="https://devzone.nordicsemi.com/question/6566/how-to-get-6-byte-mac-address-at-nrf51822/?answer=6677#post-id-6677"&gt;this post&lt;/a&gt; for more information about that.&lt;/p&gt;
&lt;p&gt;You can set your own BLE address using the function &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v4.0.2/group___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html?cp=2_3_0_1_1_2_1_2_1#gaef69dc212534adf4b78d211edce2267b"&gt;sd_ble_gap_addr_set()&lt;/a&gt;. You can use e.g. the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/rng.html?cp=2_1_0_25#concept_h35_c1l_cs"&gt;Random number generator&lt;/a&gt; on the nRF5x as a basis if you want to generate your own random address.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;The device address may be of either of the following &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v3.0.0/group___b_l_e___g_a_p___a_d_d_r___t_y_p_e_s.html?cp=2_3_0_1_2_2_1_0_0"&gt;types defined here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The Nordic default is the random static address , for a random static address you do not need to change it periodically. Using a random static address does not require any management by the application.&lt;/p&gt;
&lt;p&gt;Remember that when setting your own generated Static Device Address it should follow these requirements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The two most significant bits of the address shall be equal to 1&lt;/li&gt;
&lt;li&gt;At least one bit of the random part of the address shall be 0&lt;/li&gt;
&lt;li&gt;At least one bit of the random part of the address shall be 1&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note that a device shall not change its static address value once initialized
until the device is power cycled.  If you have dont any pairing/bonding, and If the static address of a device is changed, then the address stored in
peer devices will not be valid and the ability to reconnect using the old address
will be lost.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;The private address may be of either of the following two sub-types:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Non-resolvable private address&lt;/li&gt;
&lt;li&gt;Resolvable private address&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For private address you need to use the function &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v4.0.2/group___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html?cp=2_3_0_1_1_2_1_2_26#ga2203b7709d7178bc35e7f903bd0e913f"&gt;sd_ble_gap_privacy_set()&lt;/a&gt; to set the address.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;See &lt;a href="https://www.bluetooth.com/specifications/adopted-specifications"&gt;BLUETOOTH SPECIFICATION Version 5.0&lt;/a&gt; | Vol 6, Part B for more information about this topic.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>