cancel
Showing results for 
Search instead for 
Did you mean: 

Why there is an Increased current consumption after 3 minutes during Stop mode with RTC with HAL driver?

carole jacquinot
Associate II
Posted on December 06, 2017 at 10:13

Hello,

I used the STM32L073RZ and I used Stop mode for saving current.

And my problem is when I measured the current consumption of this MCU, I found arround 3uA during only 3 minutes after starting the Stop mode and then arround 15uA until my system wake-up, as you can see on the next chart the Current consumption measure with X-NUCLEO-LPM01A at the

increase of current 

:0690X000006094kQAA.png

I already check the same result with an amperemeter.

It is like some internal power supply just turn on, but my system is always in stop mode.

I put the MCU in stop mode with the HAL driver function like that:

/* Enable Power Control clock */

__HAL_RCC_PWR_CLK_ENABLE();

/* Enable Ultra low power mode */

HAL_PWREx_EnableUltraLowPower();

/* Enable the fast wake up from Ultra low power mode */

HAL_PWREx_EnableFastWakeUp();

HAL_SuspendTick();

//Request to enter STOP mode with regulator in low power mode

HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

HAL_ResumeTick();

//After wake-up from STOP reconfigure the PLL

SystemClock_Config();

Where : 

void SystemClock_Config(void)

{

RCC_OscInitTypeDef RCC_OscInitStruct;

RCC_ClkInitTypeDef RCC_ClkInitStruct;

RCC_PeriphCLKInitTypeDef PeriphClkInit;

/* Enable Power Control clock */

__HAL_RCC_PWR_CLK_ENABLE();

/* The voltage scaling allows optimizing the power consumption when the device is

clocked below the maximum system frequency, to update the voltage scaling value

regarding system frequency refer to product datasheet. */

__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);

/* Disable Power Control clock */

__HAL_RCC_PWR_CLK_DISABLE();

/**Initializes the CPU, AHB and APB busses clocks

*/

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSI;

RCC_OscInitStruct.HSIState = RCC_HSI_ON;

RCC_OscInitStruct.HSICalibrationValue = 16;

RCC_OscInitStruct.LSIState = RCC_LSI_ON;

RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;

RCC_OscInitStruct.PLL.PLLMUL = RCC_PLLMUL_4;

RCC_OscInitStruct.PLL.PLLDIV = RCC_PLLDIV_4;

if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)

{

Error_Handler();

}

/**Initializes the CPU, AHB and APB busses clocks

*/

RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK

|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;

RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;

RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV2;

RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;

RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)

{

Error_Handler();

}

PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART2|RCC_PERIPHCLK_LPUART1

|RCC_PERIPHCLK_I2C1|RCC_PERIPHCLK_I2C3

|RCC_PERIPHCLK_RTC;

PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1;

PeriphClkInit.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_PCLK1;

PeriphClkInit.I2c1ClockSelection = RCC_I2C1CLKSOURCE_PCLK1;

PeriphClkInit.I2c3ClockSelection = RCC_I2C3CLKSOURCE_PCLK1;

PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;

if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)

{

Error_Handler();

}

//Configure the Systick interrupt time

HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);

//Configure the Systick

HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

//SysTick_IRQn interrupt configuration

HAL_NVIC_SetPriority(SysTick_IRQn, 3, 0);

}

And just before Put the system in stop mode, I cut all interfaces that I don't need except one UART and 6 IO.

I don't that the problem come from the interface that I let awake because as I said, the

increase of current

is during the stop mode.

According to you, where could this increase of current come from during the stop mode?

#stm32-l0 #stop-mode #hal-pwr
6 REPLIES 6
stm322399
Senior
Posted on December 07, 2017 at 20:49

I can't believe that such an oscillation (very nice capture!) may come from anywhere else than the external environment of the MCU.

Concerning the consumption, I bet that the MCU is somehow activated (from the outside) but is internally configured not to wake on that event. I/O configuration is likely to be the clue of this issue. How is it done ? Can you close all I/O and see how behaves the current ?

Posted on December 08, 2017 at 13:47

Oh, thank you,

I never thought that the MCU could be have this behaviour (activated by something not configure for)

I will try it.

Posted on December 08, 2017 at 14:58

Well I cut each IO of the MCU and I have always the problem.

Also, I try the same test with an other board with the same components and I don't have the problem.

So perhaps I damaged my MCU by soldering or with static electricity.

In all cases, the 

X-NUCLEO-LPM01A is really great to current measurement.

Posted on December 08, 2017 at 17:59

Floating inputs can make current consumption to vary randomly. Does the current change if you move your hand close above the board. Floating inputs can do that too.

Posted on February 01, 2018 at 13:46

Normally, I initialized all non used pinout as analog. Perhaps I missed some of them.

See also  https://community.st.com/t5/stm32-mcu-products/why-does-sleep-current-increase-significantly-after-3-minutes/td-p/81285

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..