<?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>MAC address of peripheral from advertising packet</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/60115/mac-address-of-peripheral-from-advertising-packet</link><description>I am creating a peripheral and central. The peripheral is done and appears to work fine. The central is in progress. It will use the serial port to communicate with a host computer system. One of the things that it has to communicate is the MAC address</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 13 Apr 2020 00:23:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/60115/mac-address-of-peripheral-from-advertising-packet" /><item><title>RE: MAC address of peripheral from advertising packet</title><link>https://devzone.nordicsemi.com/thread/244267?ContentTypeID=1</link><pubDate>Mon, 13 Apr 2020 00:23:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56a35adf-f083-46c9-a568-0c162dcf53ec</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Might help to look at a sample UICR update, there are a couple of items to consider. Here&amp;#39;s the Reset pin example:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    /* Configure GPIO pads as pPin Reset pin if Pin Reset capabilities desired. If CONFIG_GPIO_AS_PINRESET is not
      defined, pin reset will not be available. One GPIO (see Product Specification to see which one) will then be
      reserved for PinReset and not available as normal GPIO. */
    #if defined (CONFIG_GPIO_AS_PINRESET)
        if (((NRF_UICR-&amp;gt;PSELRESET[0] &amp;amp; UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected &amp;lt;&amp;lt; UICR_PSELRESET_CONNECT_Pos)) ||
            ((NRF_UICR-&amp;gt;PSELRESET[1] &amp;amp; UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected &amp;lt;&amp;lt; UICR_PSELRESET_CONNECT_Pos))){
            NRF_NVMC-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Wen &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos; // Write Enable
            while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy){}
            NRF_UICR-&amp;gt;PSELRESET[0] = 21;
            while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy){}
            NRF_UICR-&amp;gt;PSELRESET[1] = 21;
            while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy){}
            NRF_NVMC-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Ren &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos; // Read-only Enable
            while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy){}
            // UICR changes require a reset to be effective
            NVIC_SystemReset();
        }
    #endif
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It&amp;#39;s a case of waiting for the NVMC signal between steps; the reset would not be required though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MAC address of peripheral from advertising packet</title><link>https://devzone.nordicsemi.com/thread/244266?ContentTypeID=1</link><pubDate>Sun, 12 Apr 2020 23:18:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4752fa6f-d5cc-4a8c-8068-fbbe7407ebf7</guid><dc:creator>jbmillard</dc:creator><description>&lt;p&gt;Thanks for the explanation. &amp;nbsp;It looks like I have erased it on my development hardware. &amp;nbsp;I&amp;#39;ll have to find the provisioning doc Rigado references and see what I can do.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MAC address of peripheral from advertising packet</title><link>https://devzone.nordicsemi.com/thread/244264?ContentTypeID=1</link><pubDate>Sun, 12 Apr 2020 22:39:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3cc26ab-9c9e-495b-8c82-543a77bb7999</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;A tale of two MAC addresses perhaps. Rigado has defined a MAC address within &lt;em&gt;NRF_UICR&lt;/em&gt; as noted, but many of the Nordic examples (eg uart) use the Device Id in &lt;span&gt;&lt;em&gt;NRF_FICR&lt;/em&gt;&amp;nbsp;&lt;/span&gt;to form a MAC address, which is different and fixed:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;
// Example:
// BLE MAC Address: Id 71959DCC72DCF09E, Peer 0, Type 1, Addr 9E:F0:DC:72:CC:DD

#if defined(SOFTDEVICE_PRESENT)
   // Get actual BLE address in case it is different from hardware register BLE address
   ble_gap_addr_t device_addr; /**&amp;lt; 48-bit address, LSB format. */
   sd_ble_gap_addr_get(&amp;amp;device_addr);
   snprintf(Settings, sizeof(Settings), &amp;quot;Id %08X%08X, Peer %u, Type %u, Addr %02X:%02X:%02X:%02X:%02X:%02X&amp;quot;,
                      NRF_FICR-&amp;gt;DEVICEADDR[1], NRF_FICR-&amp;gt;DEVICEADDR[0],
                      device_addr.addr_id_peer, device_addr.addr_type, device_addr.addr[0], device_addr.addr[1],
                      device_addr.addr[2], device_addr.addr[3], device_addr.addr[4], device_addr.addr[5]);
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;To change this back to the Rigado MAC address, use &lt;em&gt;sd_ble_gap_addr_set()&lt;/em&gt; prior to advertising:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// By default the SoftDevice will set an address of type @ref BLE_GAP_ADDR_TYPE_RANDOM_STATIC upon being
// enabled. The address is a random number populated during the IC manufacturing process and remains unchanged
// for the lifetime of each IC.

SVCALL(SD_BLE_GAP_ADDR_SET, uint32_t, sd_ble_gap_addr_set(ble_gap_addr_t const *p_addr));

//ie with p_addr set to Rigado MAC in UICR:
  sd_ble_gap_addr_set((ble_gap_addr_t const *)p_addr);&lt;/pre&gt;-&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MAC address of peripheral from advertising packet</title><link>https://devzone.nordicsemi.com/thread/244263?ContentTypeID=1</link><pubDate>Sun, 12 Apr 2020 22:30:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b789863a-dcd8-4771-b5a0-58c4e3e94168</guid><dc:creator>jbmillard</dc:creator><description>&lt;p&gt;What I&amp;#39;m getting in peer address is F712931CF0EB. &amp;nbsp;Printed on the outside is AE509162. &amp;nbsp;There isn&amp;#39;t even a &amp;quot;6&amp;quot; in the peer address so reversing the bytes still doesn&amp;#39;t do it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MAC address of peripheral from advertising packet</title><link>https://devzone.nordicsemi.com/thread/244262?ContentTypeID=1</link><pubDate>Sun, 12 Apr 2020 22:21:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:852cbc1e-276a-49bb-8660-a737869a9d26</guid><dc:creator>Turbo J</dc:creator><description>[quote userid="85222" url="~/f/nordic-q-a/60115/mac-address-of-peripheral-from-advertising-packet"]What I get in the advertising report (ble_gap_evt_adv_report_t), member peer_addr, doesn&amp;#39;t match what is on the outside of the radio. &amp;nbsp;[/quote]
&lt;p&gt;The NRF softdevice uses MAC addresses in little endian, so try just reversing all bytes - this should yield the printed MAC address.&lt;/p&gt;
&lt;p&gt;Example: 11:22:33:44:55:6B becomes 6B:55.44:33:22:11&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>