How to use a public address for advertising (nRF54LM20A)?

nRF Connect SDK v3.2.0

Write code:

void bt_ctlr_set_public_addr(const uint8_t *addr)
{
	const sdc_hci_cmd_vs_zephyr_write_bd_addr_t *bd_addr = (void *)addr;

	uint8_t err = sdc_hci_cmd_vs_zephyr_write_bd_addr(bd_addr);
	LOG_WRN("bt_ctlr_set_public_addr(0x%02x): %02X %02X %02X %02X %02X %02X", err, addr[0], addr[1], addr[2],
		addr[3], addr[4], addr[5]);
}


uint8_t addr[6] = {0x06, 0x05, 0x04, 0x03, 0x02, 0x01};

bt_ctlr_set_public_addr(addr);

err = bt_enable(NULL);
if (err)
{
	LOG_WRN("Bluetooth init failed: err %d", err);
	return err;
}

Read code:

bt_addr_le_t public_addr = { 0 };
uint8_t ret = bt_id_read_public_addr(&public_addr);
memcpy(mac_addr, public_addr.a.val, sizeof(mac_addr));
LOG_INF("mac addr(ret %u): %s", ret, bt_addr_le_str(&public_addr));

Log:

[00:00:00.028,603] <wrn> bt_sdc_hci_driver: bt_ctlr_set_public_addr(0x00): 06 05 04 03 02 01
[00:00:02.695,606] <inf> bt_hci_core: No ID address. App must call settings_load()
[00:00:02.703,691] <dbg> bt_settings: set_setting: Name set to BS0-1234
[00:00:02.710,718] <dbg> bt_gatt: db_hash_set: Stored Hash:
						 d4 4c 4d d5 76 eb c7 17 9c bf 01 9b 41 0c a6 66 |.LM.v... ....A..f
[00:00:02.725,754] <dbg> bt_settings: set_setting: ID[0] F3:07:B8:98:72:96 (random)
[00:00:02.733,767] <err> settings: set-value failure. key: bt/irk error(-2)
[00:00:02.741,545] <dbg> bt_settings: commit_settings:
[00:00:02.747,091] <inf> bt_hci_core: HCI transport: SDC
[00:00:02.752,806] <inf> bt_hci_core: Identity: F3:07:B8:98:72:96 (random)
[00:00:02.852,866] <inf> blea: mac addr(ret 1): 01:02:03:04:05:06 (public)

The address seen on the phone is usually not "06 05 04 03 02 01", but sometimes it is "06 05 04 03 02 01", which is very strange.

  • The same project does not have this problem on the nRF52840.

  • Hi,

    I have tested this, using nRF Connect for Android, an nRF54LM20A DK v0.3.4 and nRF Connect SDK v3.2.1, with the peripheral_lbs sample with the following lines added to main.c:

    Among the includes:

    #include <zephyr/bluetooth/controller.h>

    Right before the call in main() to bt_enable:

    uint8_t addr[6] = {0x06, 0x05, 0x04, 0x03, 0x02, 0x01};
    bt_ctlr_set_public_addr(addr);

    I consistently see the device advertise with the address 01:02:03:04:05:06.

    I know there was issues with bt_ctlr_set_public_addr() in nRF Connect SDK v2.2.0, which was memory related, but that issue was fixed for v2.3.0, and as far as I can tell the nRF54LM20A didn't even exist back then.

    Regardless:

    What version are you using of the nRF54LM20A and DK?
    Are you able to reproduce the issue with the above additions to the otherwise unmodified peripheral LBS sample from nRF Connect SDK v3.2.1?

    Regards,
    Terje

  • Hi Terje,

    Thank you very much!

    It seems to be caused by CONFIG_BT_PRIVACY=y. Even though I later set it to n, the chip was not erased.

    Best Regards,

    Leo

Related