<?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>Zigbee MAC vs IEEE.EUI64 - what is the difference and is the BLE mac the same?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87279/zigbee-mac-vs-ieee-eui64---what-is-the-difference-and-is-the-ble-mac-the-same</link><description>I have my code working correctly and for site testing of the first 20 units the customer wants to know the 
 MAC address so that any glitches can be identified to a particular device by its MAC address. 
 I have read, and been told, conflicting information</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 25 Apr 2022 12:26:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87279/zigbee-mac-vs-ieee-eui64---what-is-the-difference-and-is-the-ble-mac-the-same" /><item><title>RE: Zigbee MAC vs IEEE.EUI64 - what is the difference and is the BLE mac the same?</title><link>https://devzone.nordicsemi.com/thread/364717?ContentTypeID=1</link><pubDate>Mon, 25 Apr 2022 12:26:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84d61eb3-bd99-4b7c-98b5-8feecaec0ef3</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Just for clarification:&lt;/p&gt;
&lt;p&gt;There isn&amp;#39;t really something called BLE MAC addresses. MAC is not mentioned in the BLE specification. We usually call it the BLE address.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;An nRF&amp;#39;s default BLE address is generated from the &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/ficr.html?cp=4_0_0_3_3_0_6#register.DEVICEADDR-0-1"&gt;NRF_FICR-&amp;gt;DEVICEADDR[n]&lt;/a&gt;, n = &amp;lt;0..1&amp;gt;.&lt;/p&gt;
&lt;p&gt;These two registers make up 8 bytes, but only 6 of these are used. In addition, the 2 most significant bits depends on the address type, and are overruled by the device type, where the most common (in our samples) is a random static address, meaning the most significant bits of this 6 byte address will be &amp;#39;1&amp;#39; (0b11)&lt;/p&gt;
&lt;p&gt;To use my DK as an example, if I read out 0x100000A4 (DEVICEADDR[0]) it is 0x945FFEA5, and 0x100000A8 (DEVICEADDR[1] is EA9829C7:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1650887219673v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;When I read out the address actually being used by the bluetooth stack, I can use:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    bt_addr_le_t my_addr;
    size_t count;

    bt_id_get(&amp;amp;my_addr, &amp;amp;count);

    LOG_INF(&amp;quot;my addr %02x:%02x:%02x:%02x:%02x:%02x&amp;quot;, my_addr.a.val[0],
                                                    my_addr.a.val[1],
                                                    my_addr.a.val[2],
                                                    my_addr.a.val[3],
                                                    my_addr.a.val[4],
                                                    my_addr.a.val[5]);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And it prints:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:00.012,908] &amp;lt;inf&amp;gt; app: my addr a5:fe:5f:94:c7:e9
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So you can see that addr[0] matches the last byte in DEVICEADDR[0], the next byte is the second&amp;nbsp; last byte, etc. Then the 5th byte is the last line on DEVICEADDR[1], and the last byte, myaddr.a.val[5] is the second last byte, 0x29, but the two most significant bits are &amp;#39;11&amp;#39;, so 0x29 becomes 0xE9 (0b 0010 1001 -&amp;gt; 0b 1110 1001).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;When it comes to the Zigbee address:&lt;/p&gt;
&lt;p&gt;I used this snippet to print the address:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    zb_64bit_addr_t my_addr;
    zb_get_long_address(my_addr);

    LOG_INF(&amp;quot;my_addr(1): %02x:%02x:%02x:%02x&amp;quot;, my_addr[0],
                                                my_addr[1],
                                                my_addr[2],
                                                my_addr[3]);
    LOG_INF(&amp;quot;my_addr(2): %02x:%02x:%02x:%02x&amp;quot;, my_addr[4],
                                                my_addr[5],
                                                my_addr[6],
                                                my_addr[7]);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And it printed:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;I: my_addr(1): c6:4c:de:48
I: my_addr(2): 24:36:ce:f4&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;(just splitting it in two because LOG_INF() takes maxiumum 6 input parameters)&lt;/p&gt;
&lt;p&gt;If you look at the &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/ficr.html?cp=4_0_0_3_3_0_2#register.DEVICEID-0-1"&gt;NRF_FICR-&amp;gt;DEVICEID[n]&lt;/a&gt;, n=&amp;lt;0..1&amp;gt; registers, in my case they are:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1650889241759v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The last 3 bytes of my_addr(2) are standard to nordic devices (corresponds to MAC addr). The remaining 55 bytes are from the DEVICEID[n] registers, as you can see.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I see now that it is probably easier to compare both the Zigbee and BLE addresses if I printed them in the opposite order (5 -&amp;gt; 0 and 7 -&amp;gt; 0 instead of 0 -&amp;gt;5 and 0 -&amp;gt; 7). You can do that when looking at your addresses.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>