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

EFM32: Sleep function does not cause the MCU to go to a sleep mode #4082

Closed
seppestas opened this issue Mar 30, 2017 · 8 comments
Closed

EFM32: Sleep function does not cause the MCU to go to a sleep mode #4082

seppestas opened this issue Mar 30, 2017 · 8 comments

Comments

@seppestas
Copy link
Contributor

In mbed-os 5 and later versions of the mbed 2 SDK (aka mbed-dev), the sleep() function does not cause EFM32 MCUs to sleep properly, even when no sleep levels have been blocked.

When testing on the EFM32 Happy Gecko 322 using the EFM32HG_STK3400 target the MCU still consumes 3.49mA at 3v3 when calling sleep in a loop. I was able to reproduce this in:

  • mbed-os 5 at f4864dc
  • the pre-compiled mbed lib at 093f2bd7b9eb
  • mbed-dev revision d5399cc887bb

I tested both on the STK3400 devkit and a custom breakout board for the EFM32HG322 MCU.

Using mbed-dev at revision d6373279a6f1 using a custom build script and the mbed online compiler I did not have this issue yet. I am still trying to build this revision using the mbed tools.

I still plan to test on other EFM32 MCU's, but since a lot of code is shared I'm guessing the results will be similar.


Bug

Target
EFM32

Toolchain:
GCC_ARM

Toolchain version:
4.9.3

mbed-cli version:
1.0.0

@chrissnow
Copy link
Contributor

I had a similar problem with the PG, it's to do with sleep being disabled in debug builds.

#ifdef NDEBUG
#if DEVICE_SLEEP
    hal_sleep();
#endif /* DEVICE_SLEEP */
#endif /* NDEBUG */

if you define NDEBUG it should sleep correctly.

@chrissnow
Copy link
Contributor

Also you may need to power cycle the processor to get it out of debug mode after programming or it still wont sleep.

@seppestas
Copy link
Contributor Author

seppestas commented Mar 31, 2017

Thanks @chrissnow, this seemed to be the problem indeed! I did not know about the hal_sleep functionality. IIRC this was not there in mbed 2 yet.

It would be nice to have this sort of stuff documented on e.g the Power-Management cookbook. Notice the example won't work in the Debug build (which seems to be the default).

Edit: I checked: the sleep_api.h file only contained the sleep and deepsleep function in the version of mbed I used before.

@bulislaw
Copy link
Member

Actually I think we need to update that, and made the board not go to sleep only in the debug profile, as opposed to the default developand the release. I'll try to cook something up later today. And update the build profile docs.

@seppestas
Copy link
Contributor Author

@bulislaw great, thanks.

Let me know if I can be of help, I'm currently looking into the power consumption of leuart on the EFM32 Happy Gecko and I'm building up some interesting scope images.

@bulislaw
Copy link
Member

#4097 changes to sleep

@ciarmcom
Copy link
Member

ciarmcom commented Jun 1, 2018

ARM Internal Ref: MBOTRIAGE-360

@cmonr
Copy link
Contributor

cmonr commented Jun 15, 2018

Closing as issue appear to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants