Skip to content

Commit

Permalink
Set a new bd address for the BLE device
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
FRASTM committed Feb 4, 2021
1 parent 60d2609 commit 870c91e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/utility/HCISharedMemTransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 870c91e

Please sign in to comment.