public address and static random address clarification

Hi everyone,

I am working on building a broadcaster that requires a constant Bluetooth address throughout its lifespan.

As I see it, there are two possible ways to meet this requirement: using a public address or a static random address. I've encountered some issues with both approaches, which I'll detail below:

1. Public Address:
- I used the function `bt_ctlr_set_public_addr()` along with the option `BT_LE_ADV_NCONN_IDENTITY` to set a public address. It worked, and the public address was displayed.
- However, if I flash the program into another board, the exact same MAC address appears. I thought that a public address was programmed into the device by the manufacturer, and that there should be unique. Could you help clarify this for me?

2. Static Random Address:
- I tried another approach using a static random address by calling `bt_id_create(NULL, NULL);` after `bt_enable`. This saves it in the flash for later use, and it worked fine.
- The addresses are different between boards and remain the same after rebooting the board.
- However, I expected that if I erased and reprogrammed the flash, a new static random address would be generated. This was not the case. Even after erasing the board, the static address remained unchanged. Is this normal behavior?

I would appreciate any insights or assistance you can provide on these matters. Thank you!

  • Hello,

    If you are using a public address you need to purchase an address space from Bluetooth or IEEE (I don't remember). This way it will end up in a public register, so that anyone who scans the address can look it up and see that it belongs to your company.

    The random address is, as the name suggests, random. It doesn't require you to purchase anything, and it also isn't recognizable. While it is possible to specify an exact address when using random addresses, you shouldn't group them together if you are using random addresses.

    However, I expected that if I erased and reprogrammed the flash, a new static random address would be generated. This was not the case. Even after erasing the board, the static address remained unchanged. Is this normal behavior?

    I understand, but unlike the public address, which you are expected to generate on your own, the random address is actually the one that is pre-programmed from the factory. This is why it remains the same even though you erase your device and re-program it. It is part of the FICR data, which is programmed from the factory, and remains unchanged for the lifetime of the device.

    I hope this clear things up a bit. Let me know if it still doesn't make any sense, or if you have any follow-up questions.

    Best regards,

    Edvin

  • Hi Edwin,

    Jumping into this to confirm something.

    I was using  bt_addr_le_create_static. I had the impression that it created a random static address, which we then store and use in the future. Looking into the code a bit for that, it seems to call bt_rand which makes sense.

    However, you mentioned it is pre-programmed? Or maybe I was using the wrong function.

    Regards,

    Andrew

  • I may be mixing things up. There is a default address, so if you don't do anything with the address, it will use that pre-programmed address, which is based on the pre-programmed FICR address. 

    For some clarification, I can recommend the Bluetooth Low Energy course on DevAcademy. For this topic, Lesson 2 -> Bluetooth Address is particularly relevant. Also check out the exercises for this lesson, as it contains some hands on with code snippets. 

    Best regards,

    Edvin

Related