Skip to main content
MVill.6
Associate II
Jul 13, 2022 1:45 PM UTC
Question

STM32 STOP mode with LCD

In an aplication using STM32L0 I need to enter the STOP mode when I realize the AC mains disappears and the uC must be powered by a battery.

So before entering the STOP I obvioulsy deinit all the peripherals used till then and put the pins in analog mode as suggested. Doing so I have about 4.8uA.

Too much for my applications. So I investigated further and discovered with my great surprise that if I skip:

__HAL_RCC_LCD_CLK_DISABLE();

in HAL_LCD_MspDeInit() things go better I can falls to 2.6uA.

I don't understand why disabling the clock of LCD should take much current!!!

This is what I do;

....

HAL_LCD_Clear(&hlcd);

HAL_LCD_UpdateDisplayRequest(&hlcd);

HAL_TIM_Base_Stop_IT(&htim6);

HAL_I2C_MspDeInit(&hi2c1);

HAL_ADC_DeInit(&hadc);

HAL_TIM_Base_DeInit(&htim6);

HAL_TIM_Base_DeInit(&htim7);

HAL_LCD_DeInit(&hlcd);

GPIO_DeInit (); // Set all the GPIO pins as Analog

HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);

HAL_SuspendTick();

__disable_irq();

HAL_PWREx_EnableUltraLowPower();

HAL_PWREx_EnableFastWakeUp(); // don't change much

__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON,PWR_STOPENTRY_WFI);

....

Maybe someone can explain this weird behavoiur?

Thanks

This topic has been closed for replies.

4 replies

Andrew Neil
Super User
Jul 13, 2022 2:49 PM UTC

"I don't understand why disabling the clock of LCD should take much current"

Is the current being consumed by the STM32 itself, or something external?

0693W000008xsqBQAQ.png

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
MVill.6
MVill.6Author
Associate II
Jul 13, 2022 2:52 PM UTC

The decrease from 4.8uA to 2.6uA was only due to the fimware modification.

Bye

Andrew Neil
Super User
Jul 13, 2022 4:15 PM UTC

yes, but what is actually drawing that current?

Is the current being consumed by the STM32 itself, or something external - eg, the LCD?

Is the LCD still powered-up?

maybe you've left microcontroller pins in an "unfortunate" state which causes leakage to other parts of the system ...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
MVill.6
MVill.6Author
Associate II
Jul 14, 2022 8:12 AM UTC

The step-up LCD controller has been turned off and all the LCD dedicated pins are configured as analog.

The key point is that function: skipping that function and letting the LCD clock ON consumes

decrease unexplainabl by more than 50%.