<?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>Retrieve BLE MAC address in Zephyr environment</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76344/retrieve-ble-mac-address-in-zephyr-environment</link><description>When using the nRF5 SDK v17.x development environment, the BLE MAC address can be retrieved using: 
 
 This will return the assigned MAC address (eg. from the nRF52840 on a Laird Module). Does a similar call exist when using nRF Connect SDK (NCS) (I see</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 11 Jul 2024 06:03:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76344/retrieve-ble-mac-address-in-zephyr-environment" /><item><title>RE: Retrieve BLE MAC address in Zephyr environment</title><link>https://devzone.nordicsemi.com/thread/493276?ContentTypeID=1</link><pubDate>Thu, 11 Jul 2024 06:03:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0800765-5dda-4a41-86d4-7c50d49c85f7</guid><dc:creator>LongQi</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/eith"&gt;Einar Thorsrud&lt;/a&gt;&amp;nbsp;Could you help to update the link? It&amp;#39;s 404 now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Retrieve BLE MAC address in Zephyr environment</title><link>https://devzone.nordicsemi.com/thread/409778?ContentTypeID=1</link><pubDate>Tue, 14 Feb 2023 09:29:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:656d4768-cc1d-4886-80ad-81a224cd45a9</guid><dc:creator>EthanJia</dc:creator><description>&lt;p&gt;Yes, you are exactly right about this!&lt;/p&gt;
&lt;p&gt;After verification, this OR operator is necessary. Hope others would be aware of this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Retrieve BLE MAC address in Zephyr environment</title><link>https://devzone.nordicsemi.com/thread/398412?ContentTypeID=1</link><pubDate>Wed, 30 Nov 2022 20:24:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bcdc89f8-4499-42e1-babc-2acee3ec821d</guid><dc:creator>DataMate</dc:creator><description>&lt;p&gt;Line 7 should be mac_address[0] = part_1[1] | 0xC0;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;div&gt;&lt;span&gt;According to&amp;nbsp;the BLE spec on valid&amp;nbsp;MAC addresses, in&amp;nbsp;&lt;/span&gt;&lt;span&gt;Core Spec 5.3, Vol 6, Part B, Chapter 1.3.2.1, t&lt;/span&gt;&lt;span&gt;&lt;span&gt;he two most significant bits of the address&amp;nbsp;must be equal to 1 for a static device address.&amp;nbsp; If you don&amp;#39;t do this, it will not match what you get with the&amp;nbsp;&lt;/span&gt;&lt;/span&gt;bt_read_static_addr function.&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Core_5F00_v5.3-_2D00_-static-device-address.png" alt=" " /&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Retrieve BLE MAC address in Zephyr environment</title><link>https://devzone.nordicsemi.com/thread/315283?ContentTypeID=1</link><pubDate>Tue, 15 Jun 2021 07:40:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42dd154b-0885-449e-92e0-ce60e22c41ad</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can use&amp;nbsp;&lt;code&gt;bt_id_get()&lt;/code&gt; or&amp;nbsp;&lt;code&gt;bt_le_oob_get_local()&lt;/code&gt; as mentioned in the example code in &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/bluetooth/bluetooth-dev.html#developing-bluetooth-applications"&gt;Developing Bluetooth Applications&lt;/a&gt;&amp;nbsp;or get it from FICR as allready suggested provided the default random static address is used.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Retrieve BLE MAC address in Zephyr environment</title><link>https://devzone.nordicsemi.com/thread/315250?ContentTypeID=1</link><pubDate>Mon, 14 Jun 2021 23:11:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec945967-ad68-4e97-b45f-af706b75bb74</guid><dc:creator>smackenzie</dc:creator><description>&lt;p&gt;I was looking for this too. My solution was using the ficr.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void get_mac_address(uint8_t mac_address[6]) {
	unsigned int device_addr_0 = NRF_FICR-&amp;gt;DEVICEADDR[0];
	unsigned int device_addr_1 = NRF_FICR-&amp;gt;DEVICEADDR[1];
	const uint8_t* part_0 = reinterpret_cast&amp;lt;const uint8_t*&amp;gt;(&amp;amp;device_addr_0);
	const uint8_t* part_1 = reinterpret_cast&amp;lt;const uint8_t*&amp;gt;(&amp;amp;device_addr_1);
	mac_address[0] = part_1[1];
	mac_address[1] = part_1[0];
	mac_address[2] = part_0[3];
	mac_address[3] = part_0[2];
	mac_address[4] = part_0[1];
	mac_address[5] = part_0[0];
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>