Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions connectivity/FEATURE_BLE/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@
"target_overrides": {
"MCU_NRF52840": {
"ble-gap-host-based-private-address-resolution": false
},
"NUCLEO_WB55RG": {
"ble-gap-host-based-private-address-resolution": false
}
}
}
16 changes: 14 additions & 2 deletions connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,18 +364,30 @@ class PalGap final : public ble::PalGap {

static GapConnectionCompleteEvent convert(const hciLeConnCmplEvt_t *conn_evt)
{
const bdAddr_t *peer_rpa = &conn_evt->peerRpa;
const bdAddr_t *peer_address = &conn_evt->peerAddr;

#if defined(TARGET_MCU_STM32WB55xx)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a bug in the WB55 event controller, you should correct it instead of adding some dirty workaround in this cordio file ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback @jeromecoutant . The bug is inside the BLE firmware which as far as I know is only proposed as binary. The workaround is not in the cordio sources but on top of it, in Mbed OS interfaces with the Cordio stack. The workaround does not affect devices producing correct enhanced connection events. It doesn't require modification if it is fixed in a new firmware by ST.

I truly believe it is the best place to put the workaround today as users doesn't always update to the latest version of the firmware.Even if ST was releasing a new firmware today, I'd keep the workaround in place to avoid issues with old firmwares.

const bdAddr_t invalidAddress = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
if (conn_evt->addrType == DM_ADDR_RANDOM &&
memcmp(peer_address, invalidAddress, sizeof(invalidAddress)) == 0 &&
memcmp(peer_rpa, invalidAddress, sizeof(invalidAddress) != 0)
) {
std::swap(peer_rpa, peer_address);
}
#endif
return GapConnectionCompleteEvent(
conn_evt->status,
// note the usage of the stack handle, not the HCI handle
conn_evt->hdr.param,
(connection_role_t::type) conn_evt->role,
(peer_address_type_t::type) conn_evt->addrType,
conn_evt->peerAddr,
*peer_address,
conn_evt->connInterval,
conn_evt->connLatency,
conn_evt->supTimeout,
conn_evt->localRpa,
conn_evt->peerRpa
*peer_rpa
);
}
};
Expand Down