Skip to content

Commit

Permalink
STM32WB HCI driver: Add check for code size configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromecoutant committed May 25, 2021
1 parent 2c5255f commit 645fed5
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions connectivity/drivers/ble/FEATURE_BLE/TARGET_STM32WB/HCIDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "bstream.h"
#include "hci_mbed_os_adaptation.h"
#include "mbed_trace.h"
#include "platform/mbed_error.h"

/* STM32WB include files */
#include "stm32wbxx_ll_ipcc.h"
Expand Down Expand Up @@ -130,7 +131,8 @@ class HCIDriver : public CordioHCIDriver {
HciResetCmd();
}

static uint8_t convert_db_to_tx_power_index(int8_t level_db) {
static uint8_t convert_db_to_tx_power_index(int8_t level_db)
{
const int8_t conversion[] = {
-40, -21, -20, -19,
-18, -16, -15, -14,
Expand All @@ -151,7 +153,8 @@ class HCIDriver : public CordioHCIDriver {
return index;
}

virtual ble_error_t set_tx_power(int8_t level_db) {
virtual ble_error_t set_tx_power(int8_t level_db)
{


uint8_t buf[2];
Expand Down Expand Up @@ -480,10 +483,29 @@ class TransportDriver : public CordioHCITransportDriver {
WirelessFwInfo_t wireless_info_instance;
WirelessFwInfo_t *p_wireless_info = &wireless_info_instance;
if (SHCI_GetWirelessFwInfo(p_wireless_info) != SHCI_Success) {
tr_info("SHCI_GetWirelessFwInfo error");
tr_error("SHCI_GetWirelessFwInfo error");
} else {
// https://github.com/STMicroelectronics/STM32CubeWB/tree/master/Projects/STM32WB_Copro_Wireless_Binaries
// Be sure that you are using the latest BLE FW version
tr_info("WIRELESS COPROCESSOR FW VERSION ID = %d.%d.%d", p_wireless_info->VersionMajor, p_wireless_info->VersionMinor, p_wireless_info->VersionSub);
tr_info("WIRELESS COPROCESSOR FW STACK TYPE = %d", p_wireless_info->StackType);
tr_info("WIRELESS COPROCESSOR FW STACK TYPE = %d (ROM size 0x%x)", p_wireless_info->StackType, MBED_ROM_SIZE);

#if STM32WB55xx
switch (p_wireless_info->StackType) {
case INFO_STACK_TYPE_BLE_FULL:
if (MBED_ROM_SIZE > 0xCA000) {
error("Wrong MBED_ROM_SIZE with BLE FW\n");
}
break;
case INFO_STACK_TYPE_BLE_HCI:
if (MBED_ROM_SIZE > 0xE0000) {
error("Wrong MBED_ROM_SIZE with HCI FW\n");
}
break;
default:
tr_error("StackType %u not expected\n", p_wireless_info->StackType);
}
#endif
}
}
}
Expand Down Expand Up @@ -532,7 +554,7 @@ class TransportDriver : public CordioHCITransportDriver {
/* At this stage, we'll need to wait for ready event,
* passed thru TL_SYS_EvtReceived */
if (!sysevt_wait()) {
tr_info("ERROR booting WB controler");
error("ERROR booting WB controler\n");
return;
}

Expand Down

1 comment on commit 645fed5

@JeanMarcR
Copy link
Contributor

Choose a reason for hiding this comment

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

No problem for me.

Please sign in to comment.