Issue with starting when power is disconnected from STM32L0
Hello,
I am using STM32L0 microcontroller in my device. I put my device in deep sleep and wakeup using the same button by sorting SYS_WAKEUP2 pin and nearby PC14 is used as an Input pin (pulled-up).
The issue is when I disconnect & reconnect USB power to the my device, it does not start at all. Below I have attached my code and circuit.
SYS_WAKEUP2 pin:

BOOT0 & NRST connection:

System wakeup pin and connection with button:


Here is my code to go into deep sleep which used for "long press ON":
if(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_14)== GPIO_PIN_SET)
{
// Start the equipment
HAL_GPIO_WritePin(PERIPHERAL_EN_GPIO_Port, PERIPHERAL_EN_Pin, SET);
HAL_Delay(20);
lcd_init();
ClearLCD();
StartTick = HAL_GetTick();
char strr[20];
while(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_14)== GPIO_PIN_SET)
{
FinalTick = HAL_GetTick();
TickCount = FinalTick-StartTick;
if((TickCount % 1000) == 0)
{
init_columnset(3, 20);
sprintf(strr,"Wakeup in %u ",PowerOn);
GLCD_Bold_String(3, &strr);
PowerOn++;
}
if(PowerOn>=5) break;
} // end of while loop
if(PowerOn<5)
{
init_columnset(3, 15);
GLCD_Bold_String(3, "Shutting Down... ");
HAL_Delay(1000);
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN2);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
HAL_SuspendTick();
HAL_PWR_EnterSTANDBYMode();
}
} // end of If condition
else
{
//shutdown
init_columnset(3, 15);
GLCD_Bold_String(3, "Shutting Down... ");
HAL_Delay(1000);
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN2);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
HAL_SuspendTick();
HAL_PWR_EnterSTANDBYMode();
}
Please help me to solve this issue, Thank you so much for the help.
