<?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>Setting nRF5340 Public BLE Address</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/92583/setting-nrf5340-public-ble-address</link><description>Hi, 
 I have been trying to update the BLE mac address to public but unfortunately, I wasn&amp;#39;t able to achieve that 
 I have followed the multiple DevZone threads but wasn&amp;#39;t successful in updating the BLEaddress. 
 nRF5340-DK, ncs2.0.1, (primary application</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 31 Oct 2023 17:32:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/92583/setting-nrf5340-public-ble-address" /><item><title>RE: Setting nRF5340 Public BLE Address</title><link>https://devzone.nordicsemi.com/thread/453364?ContentTypeID=1</link><pubDate>Tue, 31 Oct 2023 17:32:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f31a60e-5374-420a-86db-208470668eef</guid><dc:creator>Tyler Grunenwald</dc:creator><description>&lt;p&gt;Yes, here is my main() code:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int main(void)
{
	int err;

	printk(&amp;quot;Starting Beacon Demo\n&amp;quot;);

	/* Initialize the Bluetooth Subsystem */
	err = bt_enable(NULL);
	if (err) {
		printk(&amp;quot;Bluetooth init failed (err %d)\n&amp;quot;, err);
		return err;
	}

	set_bd_addr();

	start_advertising();
	return 0;
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve also started a new ticket &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/105235/setting-public-ble-address-on-nrf5340---ncs-2-4"&gt;here &lt;/a&gt;for my specific issue. There is a sample project attached.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting nRF5340 Public BLE Address</title><link>https://devzone.nordicsemi.com/thread/453352?ContentTypeID=1</link><pubDate>Tue, 31 Oct 2023 16:05:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c3ea854-baaf-49dc-b873-8dcf859b9651</guid><dc:creator>Sigurd</dc:creator><description>[quote userid="123188" url="~/f/nordic-q-a/92583/setting-nrf5340-public-ble-address/453150"] It logs that the address was successfully updated, but still advertises with the original address (CE:35:AB:AC:91:C4).[/quote]
&lt;p&gt;Did you first change the address, and then started the advertising ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting nRF5340 Public BLE Address</title><link>https://devzone.nordicsemi.com/thread/453150?ContentTypeID=1</link><pubDate>Mon, 30 Oct 2023 21:33:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01dda690-f964-40ca-9037-8d603683a559</guid><dc:creator>Tyler Grunenwald</dc:creator><description>&lt;p&gt;I have tried adding this to the beacon sample in NCS 2.4 with an nRF5340.&lt;br /&gt;&lt;br /&gt;Unmodified beacon sample advertises with address&amp;nbsp;CE:35:AB:AC:91:C4 (random)&lt;br /&gt;&lt;br /&gt;When, I add these snippets. It logs that the address was successfully updated, but still advertises with the original address (CE:35:AB:AC:91:C4).&lt;br /&gt;&lt;br /&gt;My prj.conf:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_DEVICE_NAME=&amp;quot;Test beacon&amp;quot;

CONFIG_BT_HCI_VS=y
CONFIG_BT_HCI_VS_EXT=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Am I missing configs?&lt;br /&gt;Is there an updated way to change the address?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting nRF5340 Public BLE Address</title><link>https://devzone.nordicsemi.com/thread/389454?ContentTypeID=1</link><pubDate>Wed, 05 Oct 2022 14:28:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b56ad53-3728-4ef8-9b99-d96078cc6f6f</guid><dc:creator>tchag</dc:creator><description>&lt;p&gt;Thanks for the prompt response&lt;/p&gt;
&lt;p&gt;I have removed the &amp;quot;CONFIG_BT_LL_SW_SPLIT=y from prj.conf&amp;quot; but still no change in MAC address.&lt;br /&gt;but I have added the snippet to the one of the sample(ncs) and it worked right of the box.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I will check my application and&amp;nbsp;check why its not updating in my application and get back to you if I have any questions&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting nRF5340 Public BLE Address</title><link>https://devzone.nordicsemi.com/thread/389446?ContentTypeID=1</link><pubDate>Wed, 05 Oct 2022 14:08:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad551a5c-b1c3-47f2-842d-5b25e350d56e</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I tested using the SoftDevice Controller. Try&amp;nbsp;removing&amp;nbsp;CONFIG_BT_LL_SW_SPLIT=y from prj.conf&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting nRF5340 Public BLE Address</title><link>https://devzone.nordicsemi.com/thread/389443?ContentTypeID=1</link><pubDate>Wed, 05 Oct 2022 14:02:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ec82b9e-db47-4f1c-a570-cd5eada24d67</guid><dc:creator>tchag</dc:creator><description>&lt;p&gt;Thank you for sharing the snippet but I have tried by adding the above snippets but unsuccesful,&amp;nbsp;&lt;br /&gt;Do I need to enable any symbols in .conf file?&lt;br /&gt;&lt;br /&gt;Here is my code snippets and .conf file. Could you please confirm if anything I have missed adding&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/bluetooth/hci.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/hci_vs.h&amp;gt;
#include &amp;lt;sdc_hci_vs.h&amp;gt;

static int set_bd_addr(void)
{
	int err = 0;
	struct net_buf *buf;
	sdc_hci_cmd_vs_zephyr_write_bd_addr_t *cmd_params;

	buf = bt_hci_cmd_create(SDC_HCI_OPCODE_CMD_VS_ZEPHYR_WRITE_BD_ADDR ,
				sizeof(*cmd_params));
	if (!buf) {
		printk(&amp;quot;Could not allocate command buffer\n&amp;quot;);
		return -ENOMEM;
	}

	cmd_params = net_buf_add(buf, sizeof(*cmd_params));

	cmd_params-&amp;gt;bd_addr[0]= 0xCC;
	cmd_params-&amp;gt;bd_addr[1]= 0xCC;
	cmd_params-&amp;gt;bd_addr[2]= 0xCC;
	cmd_params-&amp;gt;bd_addr[3]= 0xCC;
	cmd_params-&amp;gt;bd_addr[4]= 0xCC;
	cmd_params-&amp;gt;bd_addr[5]= 0xCC;

    printk(&amp;quot;bt_hci_cmd_send_sync \n&amp;quot;);

	err = bt_hci_cmd_send_sync(SDC_HCI_OPCODE_CMD_VS_ZEPHYR_WRITE_BD_ADDR, buf, NULL);
	printk(&amp;quot;err: %d \n&amp;quot;,err);
	if (err) {
		printk(&amp;quot;err: %d \n&amp;quot;,err);
		return err;
	}

	printk(&amp;quot;Successfully set bd addr \n&amp;quot;);

	return 0;
}

void ble_init()
{
    int  err;
	
    err = bt_enable(NULL);
	if (err) {
		printk(&amp;quot;BLE enabling failed (err %d)\n&amp;quot;, err);
	}

	set_bd_addr();

	err = bt_ready(err);
	if (err) {
		printk(&amp;quot;BLE initialized failed (err %d)\n&amp;quot;, err);
	}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;prj.conf file&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_SERIAL=y     

# Config logger
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=n
CONFIG_LOG_BACKEND_RTT=n
CONFIG_LOG_BACKEND_UART=n

CONFIG_ASSERT=n
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_SMP=y
CONFIG_BT_DEVICE_NAME=&amp;quot;adv&amp;quot;
CONFIG_BT_MAX_CONN=2
CONFIG_BT_MAX_PAIRED=2
CONFIG_BT_DEVICE_APPEARANCE=833

CONFIG_BT_GATT_DM=y
CONFIG_BT_GATT_CLIENT=y

CONFIG_KERNEL_MEM_POOL=y
CONFIG_HEAP_MEM_POOL_SIZE=4096
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

CONFIG_DK_LIBRARY=y

# Power management
CONFIG_PM=n

CONFIG_BT_DATA_LEN_UPDATE=y


CONFIG_BT_USER_DATA_LEN_UPDATE=y
CONFIG_BT_USER_PHY_UPDATE=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_ATT_PREPARE_COUNT=2
CONFIG_BT_CONN_TX_MAX=10
CONFIG_BT_L2CAP_TX_BUF_COUNT=10
CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y

CONFIG_BT_THROUGHPUT=n

CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_TX_COUNT=10
CONFIG_BT_CONN_PARAM_UPDATE_TIMEOUT=300

CONFIG_BT_HCI_VS=y
CONFIG_BT_HCI_VS_EXT=y

CONFIG_BT_CTLR=n
CONFIG_BT_LL_SW_SPLIT=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;child_image/hci_rpmsg.conf&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT=y
CONFIG_BT_HCI_RAW=y
CONFIG_BT_MAX_CONN=10
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_HCI_RAW_RESERVE=1
CONFIG_BT_BUF_CMD_TX_COUNT=10


CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_MAX_CONN=2&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting nRF5340 Public BLE Address</title><link>https://devzone.nordicsemi.com/thread/389388?ContentTypeID=1</link><pubDate>Wed, 05 Oct 2022 11:40:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7db95cbc-dadc-418a-89a4-bdd0a2f014bd</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]Method&lt;span&gt;&amp;nbsp;2: using&amp;nbsp;bt_hci_cmd_create and bt_hci_cmd_send_sync but there were no build errors but when I flash the&amp;nbsp;&lt;/span&gt;application, MAC address doesn&amp;#39;t get updated.[/quote]
&lt;p&gt;I tested it here, and it works fine. Some code snippets:&lt;/p&gt;
&lt;p&gt;Snippet 1:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; #include &amp;lt;zephyr/bluetooth/hci.h&amp;gt;
#include &amp;lt;sdc_hci_vs.h&amp;gt;

static int set_bd_addr(void)
{
	int err = 0;
	struct net_buf *buf;
	sdc_hci_cmd_vs_zephyr_write_bd_addr_t *cmd_params;

	buf = bt_hci_cmd_create(SDC_HCI_OPCODE_CMD_VS_ZEPHYR_WRITE_BD_ADDR ,
				sizeof(*cmd_params));
	if (!buf) {
		printk(&amp;quot;Could not allocate command buffer\n&amp;quot;);
		return -ENOMEM;
	}

	cmd_params = net_buf_add(buf, sizeof(*cmd_params));

	cmd_params-&amp;gt;bd_addr[0]= 0xCC;
	cmd_params-&amp;gt;bd_addr[1]= 0xCC;
	cmd_params-&amp;gt;bd_addr[2]= 0xCC;
	cmd_params-&amp;gt;bd_addr[3]= 0xCC;
	cmd_params-&amp;gt;bd_addr[4]= 0xCC;
	cmd_params-&amp;gt;bd_addr[5]= 0xCC;



    printk(&amp;quot;bt_hci_cmd_send_sync \n&amp;quot;);

	err = bt_hci_cmd_send_sync(SDC_HCI_OPCODE_CMD_VS_ZEPHYR_WRITE_BD_ADDR, buf, NULL);
	printk(&amp;quot;err: %d \n&amp;quot;,err);
	if (err) {
		printk(&amp;quot;err: %d \n&amp;quot;,err);
		return err;
	}

	printk(&amp;quot;Successfully set bd addr \n&amp;quot;);

	return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Snippet 2:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
	err = bt_enable(NULL);
	if (err) {
		error();
	}

	LOG_INF(&amp;quot;Bluetooth initialized&amp;quot;);

	k_sem_give(&amp;amp;ble_init_ok);

	set_bd_addr();&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>