Hello,
Hello,
I assume you're working on NCS v2.x.x here and one of the Zephyr Bluetooth sample projects, is that correct?
bt_le_oob_get_local() allows to get local information that are useful for Out of Band pairing or connection creation. If the CONFIG_BT_PRIVACY config is enabled in your project, this function will result in generating a new resolvable private address (RPA) that is valid for CONFIG_BT_RPA_TIMEOUT seconds, and the application will use this address for advertising and connecting. If not, the local ID will usually be BT_ID_DEFAULT.
bt_id_get() returns an array of the currently configured addresses, so it makes sense that it returns the same Mac address if bt_le_oob_get_local() is called first.
You can set your own MAC address either by disabling CONFIG_BT_PRIVACY and writing BT_ID_DEFAULT to an ID you'd like, or you can wait until the CONFIG_BT_RPA_TIMEOUT to trig and change the RPA.
Best regards,
Simon
Hi Simonr, thanks for the reply! Yes, I am working with SDK v2.3.0 and I am using Zephyr.
The goal is to obtain a unique identifier for the device, and I don't need to use privacy and RPA, or randomize at runtime for this project. Is it possible to access the static random addr that the device contains preprogrammed? I ask that because the address I got (see previous post) does not look like a preprogrammed static address; it looks more like one that I flashed on there (and I don't know how I did that). It does not look like I have CONFIG_BT_PRIVACY set up.
Thanks,
Hi Joe
The nRF52 won't come with a "preprogrammed" MAC address, and you need to flash it onto the board if you don't want to use CONFIG_BT_PRIVACY to generate the address for you. Since it's not set, you can write BT_ID_DEFAULT to be whatever you'd like and it should be set up. I'm sorry, if I'm misunderstanding, but I don't really see the problem here.
Best regards,
Simon
Hi Simon,
Okay that makes sense now. Having a unique static address that's readable from the get-go is valuable to me because it's a really easy way to allow the app-side to identify the device. I can randomize BT_ID_DEFAULT and store it in NVS.
Thanks!
EDIT: Sorry, could you please clarify, is this a nRF52 DK behaviour, or a nRF52832 in general behaviour?