8 years ago.

mDot: "deep sleep" mode

I have a few questions...

I've been using mDot_DS18B20 https://developer.mbed.org/teams/Thing-Innovations/code/mDot_DS18B20/ as a basis and making mods.

I'm trying to understand what the "sleep" mode is doing as called at the bottom of main.cpp.

I simplified the code (I have no temp sensor) and inserted in the message a simple int variable, count, and incremented it so that each time the mDot transmitted, it would send a different value. However, count is always =0.

So, it appears that the "sleep" mode being called forces the code to start from the beginning (reinitializing my count).
1) Is this true?

If so it appears the while() loop being used at the bottom of main.cpp is superfluous.
2)True?

Anyway...
3) Where is this sleep functionality described and
4) what do you recommend I do about it - can I declare my variables differently, etc.?

Thanks.

Mike

1 Answer

8 years ago.

Hi Mike,

The mdot library is currently configured to put the mDot into a standby mode which makes sure all the peripherals are shut down. Also, the mDot is reset and doesn't retain the processor state including the variables. You can use the deepsleep() function provided by mbed to turnoff the controller preserving the state of your variables. See if that works for you.

I appreciate the answer - however, I'm admittedly new to these parts, so where do I find the so-called "deepsleep" function? Do I need to include a different library to get it in my code? Where are the docs? (I have no idea what the prototype is)

I don't even think posting a "comment" is the right way to go here - but there's no "reply" sadly.

Thanks

posted by Mike G 08 Apr 2016

Further thoughts -

1) I read that "deepsleep" is deprecated so should i really be trying to use?

2) You said "the mDot is reset" - why? That seems silly. That means the unit might as well be unplugged since everything is cleared. Is there no way to use sleep yet keep some memory alive and NOT reset?

posted by Mike G 08 Apr 2016

I am new to this mDot too and like you even I'm trying to find my way through this. I feel going through the following links would be helpful:

\https://developer.mbed.org/questions/68494/mDot-in-sleep-STOP-mode/ https://developer.mbed.org/users/Sissors/code/WakeUp/

Also you might want go though the datasheet of stm32F103CBT6 which is the controller mDot is using. Basically the deep sleep function waits for an external interrupt to wake up the controller. By reset I mean the state of the controller is lost upon wakeup from the sleep mode.

posted by Abhimanyu Dhone 08 Apr 2016