cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve BlueNRGs MAC Address

amankumbhani
Associate III

Hi,

I am trying to read the MAC address from a BlueNRG device (345) after setting it via the RF Flasher Tool. However, the corresponding changes are not visible in the advertising parameters. I have used aci_hal_read_config_data() but still no output.

The code is  ret = aci_hal_read_config_data(CONFIG_DATA_STORED_STATIC_RANDOM_ADDRESS, (uint8_t*)6, readAddr);

I have set the mac address 0x000000000 currently using the tool at a flash address: Base address + flash image + a little offset.

Any help would be appreciated!

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @amankumbhani​ ,

MAC address are 6 bytes and format is defined by BT SIG. Please refer to bluetooth.org for more details. It can be either public , private or random mac address.

This MAC address is stored in a dedicated place in NVM section managed by BLE stack. You do not directly program MAC address. Using RF Flasher, you can program each of your device based on a specific pool of MAC address you previously bought or defined. Anyway, you are programming it at a specific flash address, but this is not the one used by BLE stack. As mentioned upper, your FW will read MAC adrerss at this specific flash @ and apply it to device - BLE stack will then store it in NVM.

Now, if you don't need public MAC address and want to use random address. You don't need to program any MAC address using RF flasher.

You can use static random address. The static random address is generated and programmed at every first boot of the device on the dedicated Flash are and never erased (except if you perform mass erase)

More details on MAC addresses are available in PM0269 ( BLE Stack Programming manual) section 3.1.1.

Regards,

Sebastien. 

View solution in original post

6 REPLIES 6
Sebastien DENOUAL
ST Employee

Hi @amankumbhani​ ,

Which kind of BLE adress are you using ? Public, Random or Private ?

May you elaborate on how you are setting mac address ?

More details on MAC addresses are available in PM0269 ( BLE Stack Programming manual) section 3.1.1.

Regards,

Sebastien.

amankumbhani
Associate III

Hi @Sebastien DENOUAL ,

Please find the below images for setup. I am setting the public address.

The below is how I am setting it using RF Flasher Utility.

So I first read the address stored in the NVM, and then I write it using the aci_hal_write_config API call.

Thanks!

0693W00000NpDS7QAN.png0693W00000NpDRxQAN.png 

Sebastien DENOUAL
ST Employee

Hi @amankumbhani​ ,

Ok : Let me also point this document : UM2406 : UserManual of the RF_Flasher section 6.

This tool is used to flash MAC address at a specific flash address as you did.

Anyway, in your application code, you must program it:

1- Read MAC adress at the flash address you flashed it.

2- Set this MAC adress using aci_hal_write_config_data(...)

Then a third step, of course you can perform a aci_hal_read_config_data() to confirm is has been well programmed.

Regards,

Sebastien.

amankumbhani
Associate III

Hi @Sebastien DENOUAL​ ,

Thanks for your help! I am able to set the MAC ID and read it too correctly. However, is there a fixed format or a predefined standard to set the MAC ID? I am trying to set it to something random, but the change is not reflecting in the flash memory contents. Only setting it to the MAC ID provided in the example codes in the Bluenrg LP DK is working, others are not.

Any reason why this might be happening?

Thanks again!

Hi @amankumbhani​ ,

MAC address are 6 bytes and format is defined by BT SIG. Please refer to bluetooth.org for more details. It can be either public , private or random mac address.

This MAC address is stored in a dedicated place in NVM section managed by BLE stack. You do not directly program MAC address. Using RF Flasher, you can program each of your device based on a specific pool of MAC address you previously bought or defined. Anyway, you are programming it at a specific flash address, but this is not the one used by BLE stack. As mentioned upper, your FW will read MAC adrerss at this specific flash @ and apply it to device - BLE stack will then store it in NVM.

Now, if you don't need public MAC address and want to use random address. You don't need to program any MAC address using RF flasher.

You can use static random address. The static random address is generated and programmed at every first boot of the device on the dedicated Flash are and never erased (except if you perform mass erase)

More details on MAC addresses are available in PM0269 ( BLE Stack Programming manual) section 3.1.1.

Regards,

Sebastien. 

amankumbhani
Associate III

Hi Sebastien,

Thank you for your prompt response! It has helped a lot.

I am using a static random MAC ID as of now but will soon be using a unique MAD identifier during manufacturing and will be using the RF tool for the same.

Thanks again!

Best,

Aman