Question
STM32L051 sometime do not exit from stop mode.
Post edited by ST moderator for the code.
Hi,
I have a pre-production batch of about 80 STM32L051 custom boards.
Under certain circumstances, the microcontroller goes into sleep mode and waits for an IRQ to restart.
Of these 80 boards, about 10 randomly, after going into sleep mode, don't restart (until a reset).
This is the code I use:
__HAL_GPIO_EXTI_CLEAR_IT( VIB_SENS_MAIN_Pin);
__HAL_GPIO_EXTI_CLEAR_IT( VIB_SENS_BACKUP_Pin);
NVIC_EnableIRQ( EXTI4_15_IRQn);
HAL_COMP_Stop_IT( &hcomp1);
HAL_COMP_Stop_IT( &hcomp2);
__disable_irq();
__HAL_PWR_CLEAR_FLAG( PWR_FLAG_WU);
__HAL_GPIO_EXTI_CLEAR_IT( VIB_SENS_MAIN_Pin);
__HAL_GPIO_EXTI_CLEAR_IT( VIB_SENS_BACKUP_Pin);
__HAL_COMP_COMP1_EXTI_CLEAR_FLAG();
__HAL_COMP_COMP2_EXTI_CLEAR_FLAG();
delay_us( 5);
HAL_SuspendTick();
HAL_PWR_EnterSTOPMode( PWR_LOWPOWERREGULATOR_ON, PWR_SLEEPENTRY_WFI);
HAL_NVIC_SystemReset();What did I do wrong?
Thanks for the suggestion.
