From 870c91ee0b5836b324809e2b93fd289558149f35 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Thu, 4 Feb 2021 10:38:12 +0100 Subject: [PATCH] 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 --- src/utility/HCISharedMemTransport.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/utility/HCISharedMemTransport.cpp b/src/utility/HCISharedMemTransport.cpp index c798fe74..02bba7c7 100644 --- a/src/utility/HCISharedMemTransport.cpp +++ b/src/utility/HCISharedMemTransport.cpp @@ -20,6 +20,7 @@ #include "HCISharedMemTransport.h" #include "STM32Cube_FW/hw.h" +#include "otp.h" /* Private variables ---------------------------------------------------------*/ 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) bd_found = true; } else { - bd_addr = NULL; - bd_found = false; + OTP_BT_t *p_otp = (OTP_BT_t *)OTP_Read(0); + if (p_otp) { + memcpy(bd_addr, p_otp->bd_address, CONFIG_DATA_PUBADDR_LEN); + bd_found = true; + } else { + bd_found = false; + } } return bd_found;