Skip to content

Commit fee3fae

Browse files
LMESTM0xc0170
authored andcommitted
STM32WB: disable debug lines when not needed
When doing so, do not disbale GPIO clocks as they may be used by other drivers ! As a result, debug will be disabled by default, but can be enabled by either modifying code or selecting MBED debug profile.
1 parent c0bfcec commit fee3fae

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

features/FEATURE_BLE/targets/TARGET_STM/TARGET_NUCLEO_WB55RG/stm32wb_HCIDriver.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -810,8 +810,8 @@ void shci_register_io_bus(tSHciIO* fops) {
810810
*/
811811
static void init_debug( void ) {
812812
tr_debug("WB init_debug: ");
813-
#if (CFG_DEBUGGER_SUPPORTED == 1)
814-
tr_debug("ENABLED\r\n");
813+
/* In case of MBED debug profile, configure debugger support */
814+
#if (defined(MBED_DEBUG) || (CFG_DEBUGGER_SUPPORTED == 1))
815815
/**
816816
* Keep debugger enabled while in any low power mode
817817
*/
@@ -834,12 +834,10 @@ static void init_debug( void ) {
834834
gpio_config.Pin = GPIO_PIN_15 | GPIO_PIN_14 | GPIO_PIN_13;
835835
__HAL_RCC_GPIOA_CLK_ENABLE();
836836
HAL_GPIO_Init(GPIOA, &gpio_config);
837-
__HAL_RCC_GPIOA_CLK_DISABLE();
838837

839838
gpio_config.Pin = GPIO_PIN_4 | GPIO_PIN_3;
840839
__HAL_RCC_GPIOB_CLK_ENABLE();
841840
HAL_GPIO_Init(GPIOB, &gpio_config);
842-
__HAL_RCC_GPIOB_CLK_DISABLE();
843841

844842
HAL_DBGMCU_DisableDBGSleepMode();
845843
HAL_DBGMCU_DisableDBGStopMode();

targets/TARGET_STM/TARGET_STM32WB/device/app_conf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ typedef enum
324324
* keep debugger enabled while in any low power mode when set to 1
325325
* should be set to 0 in production
326326
*/
327-
#define CFG_DEBUGGER_SUPPORTED 1
327+
#define CFG_DEBUGGER_SUPPORTED 0
328328

329329
/**
330330
* When set to 1, the traces are enabled in the BLE services

0 commit comments

Comments
 (0)