Skip to content

Commit 870c91e

Browse files
committed
Set a new 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 valid one in a OTP_BT_t Signed-off-by: Francois Ramu <[email protected]>
1 parent 60d2609 commit 870c91e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: src/utility/HCISharedMemTransport.cpp

+8-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,13 @@ 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+
OTP_BT_t *p_otp = (OTP_BT_t *)OTP_Read(0);
343+
if (p_otp) {
344+
memcpy(bd_addr, p_otp->bd_address, CONFIG_DATA_PUBADDR_LEN);
345+
bd_found = true;
346+
} else {
347+
bd_found = false;
348+
}
343349
}
344350

345351
return bd_found;

0 commit comments

Comments
 (0)