Skip to main content
Paolo Andreuzza
Associate III
November 3, 2017
Solved

STM32L4xx: standby and run mode

  • November 3, 2017
  • 2 replies
  • 794 views
Posted on November 03, 2017 at 14:07

Hallo,

Since I think that the use of auto generated code using MXcube helps a lot, I have a question regarding the best workflow to use in the following case.

My board is powered by an external power source. In this state it works at full speed. When the external power source is disconnected, the MCU goes in standby to reduce the power consumtion because, in this state, it is powered by a coin cell. The only thing it has to do is wakeup (using the RTC) every 100 mS to check some gpio and then it has to go again in standby.

there is a gpio that inform the MCU if it is powered by the button battery or by the external supply.

In this case it seems to me that I need of two different MCU setup depending on wich power source is feeding the board.

It is not an easy situation for MXCube, is it?

Ideas?

Thank you in advance.

Paolo
    This topic has been closed for replies.
    Best answer by Vangelis Fortounas
    Posted on November 03, 2017 at 14:57

    Hello!

    In main function , just before call  HAL_Init(), write some code  (not using HAL) that enables GPIO pin and check the state. If met the proper condition, continue to initialize HAL or  LL  , else put it again to STBY. 

    A minimal piece of code with no extra clock configurations and no necessary peripherals initialization, helps to maintain  the battery's life.

    CubeMx produces a 'standard' type of initialization code and can't do this.

    regards

    vf

    2 replies

    Vangelis Fortounas
    Associate II
    November 3, 2017
    Posted on November 03, 2017 at 14:57

    Hello!

    In main function , just before call  HAL_Init(), write some code  (not using HAL) that enables GPIO pin and check the state. If met the proper condition, continue to initialize HAL or  LL  , else put it again to STBY. 

    A minimal piece of code with no extra clock configurations and no necessary peripherals initialization, helps to maintain  the battery's life.

    CubeMx produces a 'standard' type of initialization code and can't do this.

    regards

    vf

    Paolo Andreuzza
    Associate III
    November 3, 2017
    Posted on November 03, 2017 at 15:24

    It was even my thought, but i were not so sure...

    thank you very much