Skip to content

Commit 645fed5

Browse files
committed
STM32WB HCI driver: Add check for code size configuration
1 parent 2c5255f commit 645fed5

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

connectivity/drivers/ble/FEATURE_BLE/TARGET_STM32WB/HCIDriver.cpp

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "bstream.h"
2929
#include "hci_mbed_os_adaptation.h"
3030
#include "mbed_trace.h"
31+
#include "platform/mbed_error.h"
3132

3233
/* STM32WB include files */
3334
#include "stm32wbxx_ll_ipcc.h"
@@ -130,7 +131,8 @@ class HCIDriver : public CordioHCIDriver {
130131
HciResetCmd();
131132
}
132133

133-
static uint8_t convert_db_to_tx_power_index(int8_t level_db) {
134+
static uint8_t convert_db_to_tx_power_index(int8_t level_db)
135+
{
134136
const int8_t conversion[] = {
135137
-40, -21, -20, -19,
136138
-18, -16, -15, -14,
@@ -151,7 +153,8 @@ class HCIDriver : public CordioHCIDriver {
151153
return index;
152154
}
153155

154-
virtual ble_error_t set_tx_power(int8_t level_db) {
156+
virtual ble_error_t set_tx_power(int8_t level_db)
157+
{
155158

156159

157160
uint8_t buf[2];
@@ -480,10 +483,29 @@ class TransportDriver : public CordioHCITransportDriver {
480483
WirelessFwInfo_t wireless_info_instance;
481484
WirelessFwInfo_t *p_wireless_info = &wireless_info_instance;
482485
if (SHCI_GetWirelessFwInfo(p_wireless_info) != SHCI_Success) {
483-
tr_info("SHCI_GetWirelessFwInfo error");
486+
tr_error("SHCI_GetWirelessFwInfo error");
484487
} else {
488+
// https://github.com/STMicroelectronics/STM32CubeWB/tree/master/Projects/STM32WB_Copro_Wireless_Binaries
489+
// Be sure that you are using the latest BLE FW version
485490
tr_info("WIRELESS COPROCESSOR FW VERSION ID = %d.%d.%d", p_wireless_info->VersionMajor, p_wireless_info->VersionMinor, p_wireless_info->VersionSub);
486-
tr_info("WIRELESS COPROCESSOR FW STACK TYPE = %d", p_wireless_info->StackType);
491+
tr_info("WIRELESS COPROCESSOR FW STACK TYPE = %d (ROM size 0x%x)", p_wireless_info->StackType, MBED_ROM_SIZE);
492+
493+
#if STM32WB55xx
494+
switch (p_wireless_info->StackType) {
495+
case INFO_STACK_TYPE_BLE_FULL:
496+
if (MBED_ROM_SIZE > 0xCA000) {
497+
error("Wrong MBED_ROM_SIZE with BLE FW\n");
498+
}
499+
break;
500+
case INFO_STACK_TYPE_BLE_HCI:
501+
if (MBED_ROM_SIZE > 0xE0000) {
502+
error("Wrong MBED_ROM_SIZE with HCI FW\n");
503+
}
504+
break;
505+
default:
506+
tr_error("StackType %u not expected\n", p_wireless_info->StackType);
507+
}
508+
#endif
487509
}
488510
}
489511
}
@@ -532,7 +554,7 @@ class TransportDriver : public CordioHCITransportDriver {
532554
/* At this stage, we'll need to wait for ready event,
533555
* passed thru TL_SYS_EvtReceived */
534556
if (!sysevt_wait()) {
535-
tr_info("ERROR booting WB controler");
557+
error("ERROR booting WB controler\n");
536558
return;
537559
}
538560

0 commit comments

Comments
 (0)