Skip to content
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

STM32L4 - Update deepsleep implementation #2771

Merged
merged 1 commit into from
Sep 24, 2016

Conversation

svastm
Copy link
Contributor

@svastm svastm commented Sep 21, 2016

Description

During deepsleep enter, the STM32L4 devices were entering in stop mode 0 instead of stop mode 1 due to a PWR clock not initialized.

Status

READY

Migrations

NO

Steps to test or reproduce

#include "mbed.h"

int main() {
    printf("before deepsleep\n");
    deepsleep();
    printf("after deepsleep\n");
}

Flash this code on a STM32L4 and check the power consumption on IDD jumper. It should decrease from 110 uA to 9 uA with this PR

@svastm svastm mentioned this pull request Sep 21, 2016
@sg-
Copy link
Contributor

sg- commented Sep 22, 2016

/morph test

@sg- sg- added the needs: CI label Sep 22, 2016
@sg-
Copy link
Contributor

sg- commented Sep 22, 2016

@mbed-bot: TEST

HOST_OSES=ALL
BUILD_TOOLCHAINS=ALL
TARGETS=ALL

// Request to enter STOP mode with regulator in low power mode
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

if(__HAL_RCC_PWR_IS_CLK_ENABLED())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also a deepsleep wakeup delay problem, I believe it needs 0.3 secs instead of 10 usecs. Using the regular sleep there is no wakeup delay. Maybe this is related to this problem. Regards Helmut

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 913

Test Prep failed!

@svastm svastm force-pushed the fix_deepsleep_l4 branch 2 times, most recently from d111e3b to 94d3fb8 Compare September 22, 2016 08:06
@svastm
Copy link
Contributor Author

svastm commented Sep 22, 2016

I rebase to correct the code style. It might have broken the morph test ?

@svastm
Copy link
Contributor Author

svastm commented Sep 22, 2016

There is also a deepsleep wakeup delay problem, I believe it needs 0.3 secs instead of 10 usecs. Using the regular sleep there is no wakeup delay. Maybe this is related to this problem. Regards Helmut

Hello @helmut64, with the low power timer coming in this PR #2764 I measure on an oscilloscope 1.00116s for a 1 sec delay. Can you provide the code you use to detect 300ms of delay ?

@mbed-bot
Copy link

[Build 957]
SUCCESS: Building succeeded and tests were run! Be sure to check the test results

@bridadan
Copy link
Contributor

@svastm That's correct, the bot couldn't find the commit any more. I will restart the test.

/morph test

@helmut64
Copy link
Contributor

@svastm here is simple test program which works on the Nucleo64-STM32L4, you can see that the LED has a significant delay after clicking on the bottom:
https://developer.mbed.org/users/Helmut64/code/Nucleo_blink_led_deepsleep/
I measured this some time ago with a logic analyser in my solution.

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 925

All builds and test passed!


// After wake-up from STOP reconfigure the PLL
SetSysClock();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't introduce spaces on empty lines

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes fixed

@svastm
Copy link
Contributor Author

svastm commented Sep 23, 2016

Hello @helmut64, I tried your code and I found a 200ms delay on wake up. This is because the board try to use HSE clock on startup/wakeup and there isn't one connected to the pins. You can try to use MCO one by moving solder bridges. (6.7.1 in board user manual).
or set USE_PLL_HSE_EXTC in system_stm32l4xx.c to 0 and use only MSI/HSI.

@sg- sg- merged commit c4748e2 into ARMmbed:master Sep 24, 2016
@helmut64
Copy link
Contributor

@svastm regarding the wakeup delay, I belive you are talking about the MB50 which is open in the L4 case. The MCO clock is not an option because in a standalone operation with my board there is no STLink, however I like to use the out of the box mbed binary for developing my complete solution. Anything we can do within mbed to instruct the HAL to avoid this 200ms timeout.
Thank you Helmut.

@svastm
Copy link
Contributor Author

svastm commented Sep 27, 2016

@helmut64 Thanks for reporting, I see the point. Can you please open an issue where you describe the problem and the behavior you expect. It will avoid to lost the report with this merged pull request.

aisair pushed a commit to aisair/mbed that referenced this pull request Apr 30, 2024
Ports for Upcoming Targets

2669: Added u-blox C029 target ARMmbed/mbed-os#2669
2707: [EFM32] Add IAR support for remaining Silicon Labs targets ARMmbed/mbed-os#2707
2819: MultiTech xDot platform support - 09.26.2016 ARMmbed/mbed-os#2819
2827: include MultiTech xDot in mbed 5 releases ARMmbed/mbed-os#2827

Fixes and Changes

2522: Add CThunk for CM7 ARMmbed/mbed-os#2522
2518: Enable uvisor on Beetle ARMmbed/mbed-os#2518
2571: STM32F7 - Add asynchronous serial ARMmbed/mbed-os#2571
2616: STM32F3xx - Add Serial Flow Control pins + enable it ARMmbed/mbed-os#2616
2619: NUCLEO_L152RE - Add Serial Flow Control ARMmbed/mbed-os#2619
2620: NUCLEO_F429ZI - Add SERIAL_FC macro ARMmbed/mbed-os#2620
2666: [EFM32] Microsecond ticker optimization ARMmbed/mbed-os#2666
2681: STM32F0xx - Add support of ADC internal channels ARMmbed/mbed-os#2681
2687: [NRF5] Add fs_data symbol in data secton for gcc ARMmbed/mbed-os#2687
2696: Add device_has to all nrf51 devices ARMmbed/mbed-os#2696
2703: TARGET_NRF5: Changed 'serial_baud' implementation to support special baud rates. ARMmbed/mbed-os#2703
2704: DISCO_L476VG: add SPI nicknames ARMmbed/mbed-os#2704
2723: KSDK serial_api.c: Fix assertion error for ParityEven ARMmbed/mbed-os#2723
2463: [STM32L0] Add asynchronous serial ARMmbed/mbed-os#2463
2572: Fix STM32F407VG target name and LPC11U6X linker errors ARMmbed/mbed-os#2572
2698: DELTA_DFBM_NQ620 target ARMmbed/mbed-os#2698
2542: Dev spi asynch stm32f4 ARMmbed/mbed-os#2542
2650: STM32F3 - Add low power timer ARMmbed/mbed-os#2650
2415: [STM32F0] Add asynchronous serial ARMmbed/mbed-os#2415
2585: Added support for ADC only pins in LPC43xx ARMmbed/mbed-os#2585
2622: [STM32F4] Add asynchronous I2C ARMmbed/mbed-os#2622
2719: Updated ARM linker scripts for Kinetis platforms that use SDK 2.0 ARMmbed/mbed-os#2719
2728: Added ethernet and enabled IPV4 feature for the EVK-ODIN-W2/C029 target ARMmbed/mbed-os#2728
2747: [LPC11U68] Fix pin interrupt select offset ARMmbed/mbed-os#2747
2751: STM32L0xx - Add Serial Flow Control ARMmbed/mbed-os#2751
2753: [NUCLEO_F767ZI] Add CAN capability ARMmbed/mbed-os#2753
2759: STM32F0 - Add low power timer ARMmbed/mbed-os#2759
2763: STM32L1 - Add low power timer ARMmbed/mbed-os#2763
2764: STM32L4 - Add low power timer ARMmbed/mbed-os#2764
2771: STM32L4 - Update deepsleep implementation ARMmbed/mbed-os#2771
2775: Update KSDK SDHC driver for K64F & K66F ARMmbed/mbed-os#2775
2792: [NUCLEO_F303ZE] MBED-OS5 capability ARMmbed/mbed-os#2792
2762: STM32L0 - Add low power timer ARMmbed/mbed-os#2762
2761: STM32F7 - Add low power timer ARMmbed/mbed-os#2761
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants