-
Notifications
You must be signed in to change notification settings - Fork 3k
STM32L152RE deepsleep state power too high #11853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@star297 One preliminary question: have you modified the board to get an HSE XTAL mounted ? |
Yes both Xtals fitted, 8Mhz and 32Khz and are starting. I use RTC alarm registers for wake up that is also working correctly, wakes up on HSE. Remember I'm using bare-bare metal OS rev.5.14.1 so in theory there should be no interference from RTOS or the Power Management API's, the other two targets in my mbed_app.json file are working correctly. Later I will test the rest of my ST boards. I did have an issue before a couple of years age and I used a workaround code as below to achieve 3uA deepsleep by configuring the GPIO's registers before defining the pins, as below. Since then I don't know if this was resolved in later Mbed libraries.
|
You say it works in other targets, so this may not be relevant, but Since 5.14, it's safer to use a higher-level RTOS-like call such as Bare metal or not To do a really low-level test bypassing everything and going strait to the HAL you can do
Note that a single For your example above, your |
There are some hints here: I don't remember seeing any github issue about it before this one, and I don't think this has been solved. Actually I'm not sure how to apply this default configuration without messing up with application GPIO settings. @star297 - I have verified that deep sleep is entered as expected as well on NUCLEO_L152RE, so could you check power consumption after calling void LowPowerConfiguration(void) ? |
I'll go through some tests tonight, but I'm surprised about the bare-metal, reading the very limited information I could find I got the impression that all RTOS thread type functions were not engaged. So not really sure. However the only reliable wake-up from deepsleep I can achieve is using interrupt from the RTC alarm registers to the extent of a L476 based application running for several months on battery power. This is using an earlier version of Mbed-2, and now with OS bare-metal its so far working reliably as well. I'll try those suggestions.... |
Calling void LowPowerConfiguration(void); as I have it shown above does actually work on OS(bare-metal build) just as it did before on Mbed-2. Unfortunately I think this is pretty academic. When configuring GPIO pins the sleep IDD goes up in sleep mode so you would need to call that LowPowerConfiguration(void); again which wipes out the GPIO settings. Unless these XDOT guys have missed a trick, it looks like it may be a pita. That's gonna take some clock cycles so short sleep functions would be pointless. In original example for the DISCO-L476; void LowPowerConfiguration(void); |
I'm not sure we can easily handle this in a generic way. I think that
The core drivers don't / can't know what GPIOs are being or will be used or not. |
Not really following the details of the low power configuration for this chip, but... Deep sleep as currently specified to the HAL is required to be transparent with respect to external GPIO - all GPIOs work as wake-up sources. A more specific suspend API could limit the wake-up sources, and that could include a chance for the HAL to reconfigure the pins based on which (if any) GPIOs were wake-ups. Beyond that, the HAL does which GPIOs have been configured ( That could be part of the toolkit to get your power down.
This is a new facility in 5.14 - largely motivated by the desire to make sleeping and waking easy and reliable in bare-metal. See #10104. |
It's not only about pins being used as GPIOs, we should not mess up with configuration of pins that have been configured as Alternate Peripheral Functions (I2C, UART, ..). Maintaining a dynamic list of those is not so straightforward. Maybe could we consider adding a generic API or configuration scheme to let application provide a list of unused pins that need to be configured appropriately by HAL ? |
My thought is that for pinmapping it wouldn't need to be a dynamic list, it could just be reading and restoring alternate functions registers around the suspend operation. (Extreme hand-waving and glossing over fine detail detected). |
I am not sure whether you'd want to change the state of peripheral pins. The low power mode is Analog with no pull, but few peripherals may want to use Pull Up or Pull Down and keep them as well in Low Power in order to not impact the peripheral behavior ... don't you think ? Also some peripherals can be located in Always-on domain (like LP UART) and can be kept running or have wake-up capability which require their configuration to be maintained ... those are just thoughts but this makes me reluctant to change most of GPIOs states when suspending .. |
In a real life application I have using the L476 on a production board, there are 23 pins connected to various external devices including i2c, SPI and AnalogIn. In deepsleep mode the power is 140uA, that includes the connected devices. What is important is on start up the pin states are initialized in low power mode. |
Sounds like a plan. Let's keep this issue open to track this down. |
@LMESTM It's not clear to me what should be the outcome of this issue- what should be done to have this fixed. Is this adding GPIO functionality to power down the pins - |
@0xc0170 What I think is achievable is to apply a default low power configuration very early during init before the peripheral drivers get initialized. (to be checked by @ARMmbed/team-st-mcd ) |
@star297 thank you for raising this issue.Please take a look at the following comments: Could you add some more detail to the description? A good description should be at least 25 words. NOTE: If there are fields which are not applicable then please just add 'n/a' or 'None'.This indicates to us that at least all the fields have been considered. |
I suppose we need to finalize this. |
@jeromecoutant could we consider implementing proposal from #11853 (comment) ?
|
@LMESTM @jeromecoutant please let us know how you wish to proceed so we can determine what to do with this issue. |
Hi |
Will it be necessary to re-define the GPIO pins on wake up using this patch? |
This patch only affects boot. |
@star297 it has been 5 days since the last reminder. Could you please update the issue header as previously requested? |
Its as good as can be expected with most of the earlier (and perhaps current?) STM targets. Probably no problem with bare metal build as the user can call always call this GPIO_Full_Init(); before sleep functions and re initialise the GPIO's on wake up. If this update does get merged, please, please, document this somewhere in the Mbed v6 docs otherwise no one has a clue that it exists. |
@star297 it has been 5 days since the last reminder. Could you please update the issue header as previously requested? |
@star297 it has been 5 days since the last reminder. Could you please update the issue header as previously requested? |
@star297 - are there examples of the deinit / reinit functionality? I am experiencing this issue on a STM32L0 target with an SX126X. Deep sleep current is approx 50uA and I know with other frameworks this board can achieve 2uA. The SX126X driver has a number of digital outputs and uses SPI. If I manually set these pins (e.g. MISO.MOSI, SCLK) to AnalogIn on radio sleep, this falls to 7uA. This is a bit of a hack, not sure if there are global MBED before_sleep, on_wakeup functions that can be hook in as part of the sleep manager. I am not sure then how to re-initialise the pins (SPI in particular) on wakeup. Also, shouldn't this be a built-in functionality of peripheral drivers e.g. SPI to configure GPIOs to a low power state on sleep - would think this functionality requirement would be common among many targets. |
Description of defect
Deepsleep not working, appears to be working in sleep mode (750uA) only. Deepsleep should be around 3uA normally.
Target(s) affected by this defect ?
STM32L152RE (Nucleo-L152RE)
Toolchain(s) (name and version) displaying this defect ?
ARM(On-Line)
What version of Mbed-os are you using (tag or sha) ?
5.14.1 bare-metal
What version(s) of tools are you using. List all that apply (E.g. mbed-cli)
On-Line compiler
How is this defect reproduced ?
Call 'sleep();' and measure on the MCU IDD
I'm using this in my mbed_app.json file. the other targets appear to working correctly.
{
"requires": ["bare-metal"],
}
The text was updated successfully, but these errors were encountered: