Re: STM32WB55 BLE address

Rob Weber
 

Hello,

On Tue, Aug 06, 2019 at 11:26:59AM -0300, Marcio Montenegro wrote:
I am evaluating STM32WB55 board HCI driver.
During my test I found that BLE public address is 02:80:e1:00:00:00
But this microcontroller has an internal flash register to store BLE
address and device id.
I would like to know the best way to change the address BLE in this case.
Best regards,
Marcio

BLE Stack initialization:

[00:00:00.015,000] <dbg> bt_settings.bt_settings_init:
Bluetooth initialized
Configuration mode: waiting connections...
[00:00:00.187,000] <inf> bt_hci_core: Identity: 02:80:e1:00:00:00 (public)
[00:00:00.187,000] <inf> bt_hci_core: HCI: version 5.0 (0x09) revision
0x0026, manufacturer 0x0030
[00:00:00.187,000] <inf> bt_hci_core: LMP: version 5.0 (0x09) subver 0x2126

Get correct BLE address:

udn = LL_FLASH_GetUDN();
if(udn != 0xFFFFFFFF)
{
company_id = LL_FLASH_GetSTCompanyID();
device_id = LL_FLASH_GetDeviceID();

bd_addr_udn[0] = (uint8_t)(udn & 0x000000FF);
bd_addr_udn[1] = (uint8_t)( (udn & 0x0000FF00) >> 8 );
bd_addr_udn[2] = (uint8_t)( (udn & 0x00FF0000) >> 16 );
bd_addr_udn[3] = (uint8_t)device_id;
bd_addr_udn[4] = (uint8_t)(company_id & 0x000000FF);;
bd_addr_udn[5] = (uint8_t)( (company_id & 0x0000FF00) >> 8 );
bd_addr = (const uint8_t *)bd_addr_udn;

}
I have not yet worked with any of the bluetooth APIs, but this thread
peaked my interest because I am also evaluating the STM32WB55 for an
upcoming project.

I did a quick search through the bluetooth API and found the function
bt_ctlr_set_public_addr [1]. I started digging into its implementation,
but I was not able to figure out how this function relates to the rest
of the bluetooth system, or how it relates to the STM32WB55 LL/HAL.

I would recommend trying this function to see if it meets your needs.
Please let me know if it works! I'm definitely curious to know how this
might work with the STM32WB55.

Cheers,
Rob Weber

[1] https://docs.zephyrproject.org/latest/reference/bluetooth/controller.html#_CPPv323bt_ctlr_set_public_addrPK4u8_t

Join devel@lists.zephyrproject.org to automatically receive all group messages.