AnsweredAssumed Answered

"Firstly" program firmware and then MCU entery stop mode problem

Question asked by Eugene Tsai on Jun 4, 2018
Latest reply on Jun 4, 2018 by Eugene Tsai

Hello, In my project I use stm32f405 and ST-LINK tool to program firmware.

My test code below:

int main(void)
{
    HAL_Init();
    SystemClock_Config();

    

    /* GPIO Ports Clock Enable */
    __HAL_RCC_GPIOE_CLK_ENABLE();
    __HAL_RCC_GPIOC_CLK_ENABLE();
    __HAL_RCC_GPIOH_CLK_ENABLE();
    __HAL_RCC_GPIOA_CLK_ENABLE();
    __HAL_RCC_GPIOB_CLK_ENABLE();
    __HAL_RCC_GPIOD_CLK_ENABLE();

    /*Configure GPIO pin : DOOR_Pin */

    GPIO_InitTypeDef GPIO_InitStruct;
    GPIO_InitStruct.Pin = DOOR_Pin;
    GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    HAL_GPIO_Init(DOOR_GPIO_Port, &GPIO_InitStruct);

    /* Initialize all configured peripherals */
    MX_UART5_Init();// debug print port

    

    /* Entery Stop Mode configured */

    printf(" HAL_PWR_EnterSTOPMode\r\n");
    HAL_PWREx_EnableFlashPowerDown();
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
    HAL_PWREx_DisableFlashPowerDown();
    SystemClock_Config();
    printf(" DOOR_Pin Wakeup\r\n");

    

    while(1);

}

 

Why is it always wakes up automatically when the first program is done?

But as long as the shutdown power once and then the entery stop mode is correct.(Does not automatically wake up must be triggered by the DOOR_Pin)

Outcomes