Hello:

First off, a bit of background regarding addresses in BLE. A BLE device must 
have a device address. This address can be either a public device address or a 
random device address. It may have both but must have at least one.

Currently, the nimble controller gets its public device address by the 
application setting a global variable. This is obviously less than ideal; the 
address should come from some non-volatile memory. One of the main reasons that 
we “punted” on this was that we really didnt know how customers would program 
these devices and I didnt think the address would go into our config area. 
Well, I guess it could come from the config package assuming that the config 
came from some area in the hw…

Anyway, what I am considering doing is adding an API in the nimble device 
driver to read the device address. For the nordic chips, they have both a FICR 
and UICR (factory config and user config). The code will attempt to read the 
FICR first, and if there is a valid device address in the FICR the device 
address will be populated from it. If not, the code will look in the UICR (in 
customer addresses 0 and 1) and will populate the address from there.

If no address is found the stack simply wont have an address and will have to 
get its address from the host via the call to the set random address command. 
The device will not be able to do things with a public address in this case 
(obviously) and will not be able to do anything until it gets the random 
address from the host.

What I am not quite sure about is the following: in the FICR there is a bit 
that is used to denote whether or not the device address in the FICR is public 
or random. Given that the device can have two addresses, it could be that the 
FICR contains a random address and the UICR contains a public address (or vice 
versa).

So here are some questions:
1) What happens if there is a random address programmed in one of these places? 
I presume that the nimble stack should use it.
2) What happens if there is a random address in one of these locations but the 
host sends the set random address command? I presume the nimble stack should 
use the host provided random address.

The more I think about this, I am thinking that the code should always look in 
both locations and populate any addresses it finds. Hopefully folks wont 
program two public device addresses or two random addresses. If they do, the 
one in the UICR will take precedence.

Comments or suggestions appreciated!

Reply via email to