[
https://issues.apache.org/jira/browse/MYNEWT-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15955814#comment-15955814
]
William San Filippo commented on MYNEWT-707:
--------------------------------------------
There are posts on the dev list that describe this in more detail but I think
the ticket has enough information for folks to use it. Just some additional
comments:
1) The syscfg variable is called BLE_PUBLIC_DEV_ADDR. You can override that in
your target or app if you want. As was mentioned, if this is non-zero, this is
the public address that will be used.
2) The only application that was modified was bleprph. The device address is
set before sysinit() in case the device has the public address programmed in
the UICR or overridden by the target.
3) As mentioned in the commit message the global device address array was not
yet hidden. I did not want to change any existing applications (aside from
bleprph).
> Add API to retrieve public and static random addresses from chip specific
> locations
> -----------------------------------------------------------------------------------
>
> Key: MYNEWT-707
> URL: https://issues.apache.org/jira/browse/MYNEWT-707
> Project: Mynewt
> Issue Type: New Feature
> Components: Nimble
> Affects Versions: v1_0_0_rel
> Reporter: William San Filippo
> Assignee: William San Filippo
> Fix For: v1_1_0_rel
>
>
> This ticket will add API to retrieve a public address and random static
> address from "chip specific" locations. Here are the API and how they will
> work for the nordic chips, which are currently the only supported BLE chips.
> This ticket does not address storing/retrieving these values from flash or
> configuration areas.
> 1) The ble_hw_get_public_addr function will do the following:
> * If the user has overridden the default public address (the syscfg variable)
> with a non-zero public address, that address will be returned by this
> function.
> * If the default public address in the syscfg is all zero, the code will read
> FICR and check if the device address type in the FICR is public. If so, it
> means the nordic chip was factory programmed with a public address and this
> will be used.
> * If both of the above checks fail, the code will read UICR[0] and UICR[1] to
> see if a public address has been programmed into the UICR. We are doing this
> to make it easy for folks to program their development kits with public
> addresses so they do not have to hardcode them. UICR[0] will contain the
> least significant 4 bytes of the device address. UICR[1] will contain the
> most significant two bytes. The upper 16 bits of this word should be set to
> 0. The API will presume that this is a valid public device address as long as
> the upper 16-bits of this 32-bit word are all zero. We will also check to see
> if this is a valid public address (see below). If both UICR[0] and UICR[1]
> are zero, this will not be considered a valid public address.
> 2) The ble_hw_get_static_addr() will do the following:
> * Read the FICR to see if there is a random address in the FICR. This is the
> default programming of the nrf51dk and nrf52dk. Unless you have them program
> a public device address in the FICR, it will have a random address.
> * If the chip does not have a random address the API returns -1.
> * If the chip has a random address the upper two bits will be set to 1 (which
> denotes random static address).
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)