2022-02-18 08:29 AM
Hello STM32-Community,
right before finishing work and everything working arguably fine, I was trying to measure the power consumption of my periphery, where I could see that the program stopped working. I've pinned down the problem to not reentering the program schedule after entering STOP2 if the program is not currently debugging.
Thats my currently test set up. It happily blinks while debugging, but restarting the microcontroller does not make it blink anymore. But it works with STOP1 mode. Any tips how to resolve this issue?
#define LORA_TIME 10
while(1)
{
HAL_GPIO_TogglePin(LED_1_GPIO_Port, LED_1_Pin);
HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, LORA_TIME*32000/32768);
RTC_WAKEUPCLOCK_CK_SPRE_16BITS); //
HAL_SuspendTick();
HAL_PWREx_EnterSTOP2Mode(PWR_SLEEPENTRY_WFI);
HAL_ResumeTick(); //not needed most likely
}
Kind regards and thank you in advance
crackl1ng
2022-02-24 02:59 AM
Hi @crackl1ng ,
It would be interesting if you can test one of the examples provided in STM32CubeL4 package.
I found for example STM32Cube_FW_L4\Projects\NUCLEO-L4R5ZI\Examples\PWR\PWR_STOP2_RTC\Src\main.c.
In this example, it is required to call the following functions after HAL_PWREx_EnterSTOP2Mode:
/* Re-configure the system clock to 120 MHz based on MSI, enable and select PLL as system clock source (PLL is disabled in STOP mode) */
SYSCLKConfig_STOP();
/* Re-configure and turn on LED1 */
BSP_LED_Init(LED1 );
BSP_LED_On(LED1 );
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.