Skip to content

Commit f00e0af

Browse files
committed
Set a random bd address for the BLE device
In case the bd address cannot be computed from the flash then the otp is read to provide a bd address. Signed-off-by: Francois Ramu <francois.ramu@st.com>
1 parent 60d2609 commit f00e0af

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/utility/HCISharedMemTransport.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "HCISharedMemTransport.h"
2222
#include "STM32Cube_FW/hw.h"
23+
#include "otp.h"
2324

2425
/* Private variables ---------------------------------------------------------*/
2526
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static TL_CmdPacket_t BleCmdBuffer;
@@ -338,8 +339,14 @@ static bool get_bd_address(uint8_t *bd_addr)
338339

339340
bd_found = true;
340341
} else {
341-
bd_addr = NULL;
342-
bd_found = false;
342+
uint8_t *otp_addr = OTP_Read(0);
343+
if (otp_addr) {
344+
memcpy(bd_addr, otp_addr, CONFIG_DATA_PUBADDR_LEN);
345+
bd_found = true;
346+
} else {
347+
bd_addr = NULL;
348+
bd_found = false;
349+
}
343350
}
344351

345352
return bd_found;

0 commit comments

Comments
 (0)