2023-02-13 03:32 AM
Hi,
I'm trying to set a custom board with STM32WB5MMG into low power mode STOP2. For that, program calls PWR_ExitStopMode() function when a timer reaches 10 seconds and exits when EXTI0 interrupts by calling PWR_ExitStopMode().
The MCU goes into and exits STOP2 mode correctly but I need the board to be connectable even when MCU is in low power mode, however BLE stops advertising when board is in STOP2 mode.
If the connection has been stablished before the board goes into stop mode, then BLE works fine until a disconnection occurs, when I have the same problem.
I tryed too using Sleep Mode and got the same results.
Code:
if(count_10s>=1000)
{
printf("GO INTO STOP2 MODEr\n");
count_10s=0;
PWR_EnterStopMode();
}
__weak void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if(GPIO_Pin == BTN_Pin)
{
PWR_ExitStopMode();
//SystemClock_Config();
HAL_TIM_Base_Start_IT(&htim2);
printf("WAKE UP FROM EXTI\r\n");
}
}
What I'm missing?
Thanks in advance!
2023-02-17 03:00 AM
Hello,
You can look BLE_HeartRate example available in STM32CubeWB package which allow to perform stop2 low power mode. I recommend to you to use the low power manager provided in the package to manage low power mode.
Best Regards
2023-02-19 10:17 PM
Hi Remy,
Thanks for answering.
I'm not sure how, but problem was solved just by isolating the PWM_EnterStopMode() function. For some reason, my program was executing all code in the while loop before and after calling that function and never going into the stop mode.
switch(state)
{
case STOP:
PWR_EnterStopMode();
break;
case RUN:
//Rest of the code
break;
default:
break;
}
Regards!