Skip to main content
ANoen.1
Visitor II
Dec 13, 2019 3:28 PM UTC
Question

STM32F407 not transitioning into STOP mode

Hi everyone,

I am trying to run some tests to cahnge our board into the low power "STOP" mode. Currently the entire board draws an average of ~9 mA when in our current low power mode. Though we need to add additional functionality and would like to use STOP mode. Current tests show that when in STOP the board draws ~19 mA on average. I would expect the difference between these two modes to be much smaller.

Here is my test hook:

HAL_PWREx_EnableFlashPowerDown();

/* Disable all interupts */

LL_EXTI_DisableIT_0_31(LL_EXTI_LINE_ALL_0_31);

//Turn off periferals

HAL_GPIO_WritePin((GPIO_TypeDef*)GPIOA, (uint16_t)0, GPIO_PIN_RESET);

HAL_GPIO_WritePin((GPIO_TypeDef*)GPIOA, (uint16_t)1, GPIO_PIN_RESET);

//Turn off extra clocks

__HAL_RCC_GPIOA_CLK_DISABLE();

__HAL_RCC_GPIOB_CLK_DISABLE();

__HAL_RCC_GPIOC_CLK_DISABLE();

__HAL_RCC_GPIOD_CLK_DISABLE();

__HAL_RCC_GPIOE_CLK_DISABLE();

__HAL_RCC_GPIOF_CLK_DISABLE();

__HAL_RCC_GPIOG_CLK_DISABLE();

__HAL_RCC_GPIOH_CLK_DISABLE();

__HAL_RCC_I2C2_CLK_DISABLE();

__HAL_RCC_DMA1_CLK_DISABLE();

__HAL_RCC_DMA2_CLK_DISABLE();

__HAL_RCC_USART1_CLK_DISABLE();

__HAL_RCC_USART2_CLK_DISABLE();

__HAL_RCC_USART3_CLK_DISABLE();

__HAL_RCC_UART4_CLK_DISABLE();

__HAL_RCC_UART5_CLK_DISABLE();

__HAL_RCC_USART6_CLK_DISABLE();

__HAL_RCC_ADC1_CLK_DISABLE();

__HAL_RCC_SPI2_CLK_DISABLE();

EXTI->PR = 0xFFFFFFFF;

HAL_SuspendTick();

HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFE);

I would like to know if there is something I am missing here to get the mcu into STOP.

As well I'm curious if there is a way to confirm if the mcu is in STOP mode. The debugger gets lost when thos hook is called, so I can't confirm what it is doing.

This topic has been closed for replies.