Static Random BD Address calculation issue
ID: LPCBARESDK-770
Status: Fixed
First reported: 6.0.14.1114
Fixed in: 6.0.20.1338
Description
For the DA14585/DA14586 device family, the default_app_generate_unique_static_random_addr()
does not generate a static random device address as unique as one would expect.
Potential address collisions might occur when the use application define the USER_CFG_ADDRESS_MODE
as APP_CFG_ADDR_STATIC
.
Workaround
The modification below will guarantee each unique device address is generated from a unique seed.
In the sdk/app_modules/src/app_default_hnd/app_default_handlers.c
, apply:
@@ -304,13 +304,8 @@ void default_app_generate_unique_static_random_addr(struct bd_addr *addr)
val1 = timestamp ^ position ^ adc_single;
val2 = tester ^ package ^ adc_diff;
#else
- timestamp = GetWord32(OTP_TIMESTAMP_ADDR); // Device time stamp
- siteID = GetWord8(OTP_SITE_ID_ADDR) & 0x7; // Get the Site ID (3-bits)
- timestamp ^= (siteID << 30); // Add test site to MSB
-
- trim = siteID >> 2; // MSb of Site ID
- trim |= (GetWord8(OTP_BANDGAP_ADDR) & 0x3F) << 1; // Bandgap trim (6-bits)
- trim |= (GetWord8(OTP_LNA_ADDR) & 0x7F) << 7; // LNA trim (7-bits)
+ timestamp = GetWord32(OTP_TIMESTAMP_ADDR); // Device time stamp (32-bits)^M
+ siteID = GetWord32(OTP_SITE_ID_ADDR); // Get the Site ID (32-bits)^M
val1 = timestamp;
val2 = trim;
This modification only applies when the address mode in the user_config.h
is configured as:
#define USER_CFG_ADDRESS_MODE APP_CFG_ADDR_STATIC