Skip to content

Commit 7e368a9

Browse files
committed
nimble/phy/nrf: Add support for reading Ublox BMD-345 public address
The BMD-345 modules are preprogrammed from the factory with a unique public Bluetooth device address stored in the CUSTOMER[0] and CUSTOMER[1] registers of the User Information Configuration Registers (UICR).
1 parent f83627a commit 7e368a9

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

nimble/drivers/nrf52/src/ble_hw.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,22 @@ ble_hw_get_public_addr(ble_addr_t *addr)
6969
uint32_t addr_high;
7070
uint32_t addr_low;
7171

72+
#if MYNEWT_VAL(BLE_PHY_UBLOX_BMD345_PUBLIC_ADDR)
73+
/*
74+
* The BMD-345 modules are preprogrammed from the factory with a unique public
75+
* The Bluetooth device address stored in the CUSTOMER[0] and CUSTOMER[1]
76+
* registers of the User Information Configuration Registers (UICR).
77+
* The Bluetooth device address consists of the IEEE Organizationally Unique
78+
* Identifier (OUI) combined with the hexadecimal digits that are printed on
79+
* a 2D barcode and in human-readable text on the module label.The Bluetooth
80+
* device address is stored in little endian format. The most significant
81+
* bytes of the CUSTOMER[1] register are 0xFF to complete the 32-bit register.
82+
*/
83+
84+
/* Copy into device address. We can do this because we know platform */
85+
addr_low = NRF_UICR->CUSTOMER[0];
86+
addr_high = NRF_UICR->CUSTOMER[1];
87+
#else
7288
/* Does FICR have a public address */
7389
if ((NRF_FICR->DEVICEADDRTYPE & 1) != 0) {
7490
return -1;
@@ -77,6 +93,8 @@ ble_hw_get_public_addr(ble_addr_t *addr)
7793
/* Copy into device address. We can do this because we know platform */
7894
addr_low = NRF_FICR->DEVICEADDR[0];
7995
addr_high = NRF_FICR->DEVICEADDR[1];
96+
#endif
97+
8098
memcpy(addr->val, &addr_low, 4);
8199
memcpy(&addr->val[4], &addr_high, 2);
82100
addr->type = BLE_ADDR_PUBLIC;

nimble/drivers/nrf52/syscfg.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,10 @@ syscfg.defs:
6363
- nRF52840 Engineering C
6464
- nRF52840 Rev 1 (final silicon)
6565
value: 1
66+
67+
BLE_PHY_UBLOX_BMD345_PUBLIC_ADDR:
68+
description: >
69+
Ublox BMD-345 modules come with public address preprogrammed
70+
in UICR register. If enabled public address will be read from
71+
custom UICR instead of FICR register.
72+
value: 0

0 commit comments

Comments
 (0)