MDot Deep Sleep Mode Questions.
- This topic has 10 replies, 4 voices, and was last updated 8 years, 3 months ago by Boris Bozic.
-
AuthorPosts
-
July 28, 2016 at 11:48 am #14350Tom HillParticipant
I am looking for inputs regarding when the MDot goes into a deep sleep mode. As per the API documentation the application restarts right from the main method and all memory, register data is lost.
1) In a scenario where I need to read some sensor data every 10-15 minutes for example, depending on the type of sensor. So in the deep sleep mode I won’t be able to use the mbed rtos timer. What is the best way to mimic a timer event in the deep sleep mode? I just don’t want to re-invent the wheel if this has already been addressed in this forum.
2) In the deep sleep mode, should I be releasing all the resources/memory before going into the deep sleep mode or does it matter with all the memory and register info being lost?
Thanks,
YogeshJuly 28, 2016 at 12:16 pm #14351Mike FioreBlockedYogesh/Tom,
1) When the mDot is in deep sleep, the only options to wake it up are an external GPIO interrupt or using the RTC alarm. The MCU core is powered down at this point, so no code is executed until the device is woken up.
2) Since the device is restarting, you don’t need to worry about releasing resources or memory.
Cheers,
Mike
July 28, 2016 at 12:43 pm #14352Ajay KParticipantThanks Mike for your response!
Is there a way to set the system date/time or figure out the system date/time in the mdot, so I can figure out how much time elapsed so I can address the other scenario described above where I am trying to read a sensor every several minutes?
Thanks,
AjayJuly 28, 2016 at 1:27 pm #14353Mike FioreBlockedAjay,
If you want the mDot to sleep in between sensor reads, you’d use the mDot::sleep call.
Otherwise, you can use a mbed Timer for intervals less than 30 minutes. If you need longer intervals, you can get the time from the RTC. The mDot library initializes the RTC if it isn’t running, so you can just call time(NULL) in your application to get the current time in seconds. The RTC stays running across soft resets and sleeps.
Cheers,
Mike
July 28, 2016 at 2:18 pm #14355Ajay KParticipantThats the plan to sleep between sensor reads and its good to know we are able to get the current time. Thanks Mike for your prompt response.
August 2, 2016 at 9:25 am #14378Boris BozicParticipantDoes anybody have a working example code for deep sleep? Since the upgrade to the latest libraries it seems broken for me. Using below code…
uint32_t sleep_time = 30;
dot->sleep(sleep_time, mDot::RTC_ALARM);August 3, 2016 at 6:06 am #14383Boris BozicParticipantSo I tried the old libmDot-0.0.9-1 library with same code and it works there.
Something seems broken in the libmDot-1.0.8-1 libraries or I must be missing something?
The manual doesnt say that the sleep command has changed at all?August 3, 2016 at 7:16 am #14385Mike FioreBlockedBoris,
What version of the mbed and mbed-rtos libraries are you using?
Cheers,
Mike
August 3, 2016 at 8:23 am #14387Boris BozicParticipant#define MBED_LIBRARY_VERSION 116
Cant find the RTOS version easily? Any hints where to find it?
The issue is that it goes into deepsleep, but more like a deep coma as it never wakes up 🙁
August 3, 2016 at 8:37 am #14388Mike FioreBlockedBoris,
Are you building your application using the mbed online compiler? If so, you can click on the folder for each library in your app and you should see information about it, including the revision, on the right side of the screen. Please let me know what versions of mbed and mbed-rtos you’re using.
Otherwise if you’re building offline, open a shell, cd into mbed/, and type git describe.
Cheers,
Mike
August 3, 2016 at 9:00 am #14389Boris BozicParticipantmbed_lib_rev116-19-g1f34044
I tried cloning mbed again to the latest version, but all my environment is broken now.
I am totally missing my workspace_tools, which was there before.EDIT:
Wait I see workspace_tools is now tools. The manual should be updated!- This reply was modified 8 years, 3 months ago by Boris Bozic.
-
AuthorPosts
- You must be logged in to reply to this topic.