cancel
Showing results for 
Search instead for 
Did you mean: 

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

Eugene Tsai
Associate
Posted on June 04, 2018 at 10:12

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)

2 REPLIES 2
Nesrine M_O
Lead II
Posted on June 04, 2018 at 10:24

Hi

,

Try to disable the

Systick interrupt

/* Enter Stop Mode */HAL_SuspendTick();HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);HAL_ResumeTick();

-Nesrine-

Eugene Tsai
Associate
Posted on June 04, 2018 at 11:07

Hi Nesrine,

Thank you for your reply. And I tried your suggestion but the problem was not solved.