2026-04-22 5:51 AM
Hey. I currenlty have a wba55 baord and use it as a ble p2p server. The main idea is to put put the board to stop0/1 mode when disconnected so that it consumes some μ amps and turn it back on when receiving a specific interrupt (eg button, timer etc).
I tried a minimal bare-metal example, where i turned on every peripheral (uart, i2c etc) i would use on my actual project to monitor power consumption and before sleep mode i de-inited each and every one of them and all interrupt sources other than the specific EXTI line. The thing is that the device seemed like unable to even enter stop mode. I turned off the rf module through mx and it worked perfectly.
So from what i understood, the rf module and be in general produces a ton of interrupts which doesn't let the device to stay in stop mode. Is there any way to disable the rf module/ ble during runtime and re enable it once the device wakes up from the intended interrupt source ?
2026-04-27 6:22 AM
Unfortunatelly i can't update to the latest fw version since that i cannot update my cubeIDE version. I've tried to edit my .ioc and threadx_app.c file according to your (ST) threadx_low_power example.
I copied and pasted the following function, replacing their __weak declaration.
void App_ThreadX_LowPower_Enter(void)
{
/* USER CODE BEGIN App_ThreadX_LowPower_Enter */
/* USER CODE BEGIN App_ThreadX_LowPower_Enter */
/* Deactivate Debug of Stop mode */
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_SET);
HAL_DBGMCU_DisableDBGStopMode();
__disable_interrupts();
/* Deactivate Debug of Standby mode */
HAL_DBGMCU_DisableDBGStandbyMode();
/* Enter to the stop mode */
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
go_to_sleep = 0;
/* USER CODE END App_ThreadX_LowPower_Enter */
}
/**
* @brief App_ThreadX_LowPower_Exit
* @PAram None
* @retval None
*/
void App_ThreadX_LowPower_Exit(void)
{
/* USER CODE BEGIN App_ThreadX_LowPower_Exit */
__enable_interrupts();
SystemClock_Config();
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET);
/* USER CODE END App_ThreadX_LowPower_Exit */
}I've also set a flag to 1 during the disconnection event on the ble_app fsm and added this statement into every thread loop to block them and enter the idle entry.
static void app_main_thread_entry(ULONG thread_input) {
app_main_setup();
while (1) {
if(go_to_sleep)
tx_thread_sleep(TX_WAIT_FOREVER);
app_main_loop();
}
}Am i at the right direction? I will try to stop the various peripherals next but, what am i missing here ?