LED blink works with CFG_DEBUGGER enabled but not when disabled on STM32WB5MM-DK
I’m developing a custom BLE server on an STM32WB5MM-DK using STM32CubeWB HAL, the Sequencer (UTIL_SEQ), and the HW TimeServer (HW_TS) for periodic tasks. I implemented a repeated LED blink.
With CFG_DEBUGGER_SUPPORTED set to 1, the LED toggles on/off every ~5 s as expected.
With CFG_DEBUGGER_SUPPORTED set to 0, the LED never blinks, though BLE advertising and characteristic updates continue.
I’ve tuned low-power settings and task scheduling, but the OFF callback (and thus the blink sequence) never runs when CFG_DEBUGGER_SUPPORTED is off. I suspect there is something wrong between Stop mode and the Sequencer/timers, but can’t pinpoint the issue.
/* In Custom_APP_Init(): register tasks & create timers */
UTIL_SEQ_RegTask(1 << CFG_TASK_LEDON, UTIL_SEQ_RFU, LEDONTask);
UTIL_SEQ_RegTask(1 << CFG_TASK_LEDOFF, UTIL_SEQ_RFU, LEDOFFTask);
HW_TS_Create(CFG_TIM_LEDON_ISR, &Custom_App_Context.LEDON_TIMER_ID,
hw_ts_Repeated, LEDON_TIMER_ISR);
HW_TS_Create(CFG_TIM_LEDOFF_ISR, &Custom_App_Context.LEDOFF_TIMER_ID,
hw_ts_SingleShot, LEDOFF_TIMER_ISR);
/* Kick off the blink loop on init */
HW_TS_Start(Custom_App_Context.LEDON_TIMER_ID, LEDONTIMER_INTERVAL);
/* Timer ISRs: queue the corresponding tasks */
void LEDON_TIMER_ISR(void)
{
UTIL_SEQ_SetTask(1 << CFG_TASK_LEDON, CFG_SCH_PRIO_1);
}
void LEDOFF_TIMER_ISR(void)
{
HW_TS_Stop(Custom_App_Context.LEDOFF_TIMER_ID);
UTIL_SEQ_SetTask(1 << CFG_TASK_LEDOFF, CFG_SCH_PRIO_1);
}
/* LED on: disable Stop mode, set LED, schedule off */
void LEDONTask(void)
{
UTIL_LPM_SetStopMode(CFG_LPM_APP_BLE, UTIL_LPM_DISABLE);
APP_DBG_MSG("LEDONTask");
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
HW_TS_Start(Custom_App_Context.LEDOFF_TIMER_ID, LEDOFFTIMER_INTERVAL);
}
/* LED off: clear LED, re-enable Stop mode */
void LEDOFFTask(void)
{
APP_DBG_MSG("LEDOFFTask");
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);
UTIL_LPM_SetStopMode(CFG_LPM_APP_BLE, UTIL_LPM_ENABLE);
}
