<?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>get the DEVICEADDR from the advertising packet?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17452/get-the-deviceaddr-from-the-advertising-packet</link><description>I read that the DEVICEADDR is always in the advertising packet, so i need to take these data from the master each time that a slave is conected to them. I trying do something like that but i coldn&amp;#39;t get what i like, here is part of my code: 
 //Definition</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 01 Nov 2016 15:49:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17452/get-the-deviceaddr-from-the-advertising-packet" /><item><title>RE: get the DEVICEADDR from the advertising packet?</title><link>https://devzone.nordicsemi.com/thread/67057?ContentTypeID=1</link><pubDate>Tue, 01 Nov 2016 15:49:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e561683a-af6d-41de-bfc0-58a06eb20ee7</guid><dc:creator>Pablo</dc:creator><description>&lt;p&gt;Ok. Now yes i see the same.
Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: get the DEVICEADDR from the advertising packet?</title><link>https://devzone.nordicsemi.com/thread/67053?ContentTypeID=1</link><pubDate>Tue, 01 Nov 2016 15:47:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:083f9798-2d0b-452b-9f73-8ec6f13f3b55</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Feel free to mark the answer as correct, if you think I have answered your question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: get the DEVICEADDR from the advertising packet?</title><link>https://devzone.nordicsemi.com/thread/67056?ContentTypeID=1</link><pubDate>Tue, 01 Nov 2016 15:35:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4aa617aa-f5b3-4809-af3e-3942c5ce61ce</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Also, you should not use %u when printing hex values, use %08X instead.&lt;/p&gt;
&lt;p&gt;E.g. &lt;code&gt;printf(&amp;quot;adviceaddr0: %08X\n&amp;quot;, NRF_FICR-&amp;gt;DEVICEADDR[0]);&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: get the DEVICEADDR from the advertising packet?</title><link>https://devzone.nordicsemi.com/thread/67055?ContentTypeID=1</link><pubDate>Tue, 01 Nov 2016 15:28:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:098c984d-eae7-4e5d-914a-41caa7f95ef3</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Example:&lt;/p&gt;
&lt;p&gt;On the central I get advertisement packet with: “Address &lt;code&gt;0xE104D4DAF4F9&lt;/code&gt;”&lt;/p&gt;
&lt;p&gt;This is in LSB format, so in MSB format this is: &lt;code&gt;F9:F4:DA:DF:04:E1&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;On the peripheral I have this:&lt;/p&gt;
&lt;p&gt;DEVICEADDR[0]: &lt;code&gt;0xDAD404E1 -&amp;gt; DA:D4:04:E1&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;DEVICEADDR[1]: &lt;code&gt;0x2B8679F4 -&amp;gt; 2B:86:79:F4&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The reason why &amp;quot;79&amp;quot; becomes &amp;quot;F9&amp;quot; is because the specification says that the 2 MSBit of the address must be set &amp;#39;11&amp;#39; .
E.g. 79 binary -&amp;gt; &lt;code&gt;01:11:10:01&lt;/code&gt;
We set ‘11’ as the MSBit -&amp;gt; &lt;code&gt;11:11:10:01&lt;/code&gt; -&amp;gt; F9&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: get the DEVICEADDR from the advertising packet?</title><link>https://devzone.nordicsemi.com/thread/67054?ContentTypeID=1</link><pubDate>Tue, 01 Nov 2016 14:47:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4cad0ee0-fd4a-4da9-89a4-282e0f9d6ecb</guid><dc:creator>Pablo</dc:creator><description>&lt;p&gt;This number should be the same that i print in the slave if i execute this lines:&lt;/p&gt;
&lt;p&gt;printf(&amp;quot;adviceaddr0: %u&amp;quot;, NFR_FICR-&amp;gt;DEVICEADDR[0]);
printf(&amp;quot;adviceaddr1: %u&amp;quot;, NFR_FICR-&amp;gt;DEVICEADDR[1]);&lt;/p&gt;
&lt;p&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: get the DEVICEADDR from the advertising packet?</title><link>https://devzone.nordicsemi.com/thread/67052?ContentTypeID=1</link><pubDate>Tue, 01 Nov 2016 12:22:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1c84ad0-2fa5-44d3-97bd-5f55f371e8ab</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;You can read it directly from the advertisement packet. You can do it like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void on_adv_report(ble_evt_t * p_ble_evt)
{
    uint32_t              err_code;
    const ble_gap_evt_t * p_gap_evt = &amp;amp;p_ble_evt-&amp;gt;evt.gap_evt;

    
    const ble_gap_evt_adv_report_t * p_adv_report = &amp;amp;p_gap_evt-&amp;gt;params.adv_report;
            
    const ble_gap_addr_t peer_addr = p_adv_report-&amp;gt;peer_addr;
    
    printf(&amp;quot;Address %02x%02x%02x%02x%02x%02x\r\n&amp;quot;,
                             peer_addr.addr[0],
                             peer_addr.addr[1],
                             peer_addr.addr[2],
                             peer_addr.addr[3],
                             peer_addr.addr[4],
                             peer_addr.addr[5]
                             );
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>