Re: Get BT MAC addr in zephyr

Johan Hedberg

Hi Tommy,

On 25 Mar 2019, at 6.10, Tommy Lin (林志聰) <Tommy.Lin@...> wrote:
We use Nordic 51824 with Zephyr 1.13 version.
By default, the Nordic BLE address is derived from the NRF_FICR->DEVICEADDR[] register.
We use “bluetoothctl show” and can get a random mac address.
1.I don’t know if the random mac address is from NRF_FICR->DEVICEADDR[] register ?
2.Every time , the mac address will be different value , if I delete /var/lib/Bluetooth/static-xx:xx:xx:xx:xx:xx folder and then reboot device.
I expect the random mac address from NRF_FICR->DEVICEADDR[] register should be fixed , am I right ?
It’s always the responsibility of the host to set the random address. When you do a combined build of Zephyr (both controller and host) the FICR address will be used. However, if you’re running BlueZ as the host, it’s the responsibility of BlueZ to set the random address. There’s no standard HCI command to read the FICR value from the controller. Zephyr does have HCI vendor commands for that, but if I remember right BlueZ does not support those yet. If you don’t care about the FICR address specifically, but just want a fixed static random address, then any recent bluetoothd version (>= 5.44) will generate this for you automatically (that’s the /var/lib/bluetooth/static- file that you referred to).


Join to automatically receive all group messages.