MDot Deep Sleep Mode Questions.

Home Forums mDot/xDot MDot Deep Sleep Mode Questions.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #14350
    Tom Hill
    Participant

    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,
    Yogesh

    #14351
    Mike Fiore
    Blocked

    Yogesh/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

    #14352
    Ajay K
    Participant

    Thanks 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,
    Ajay

    #14353
    Mike Fiore
    Blocked

    Ajay,

    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

    #14355
    Ajay K
    Participant

    Thats 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.

    #14378
    Boris Bozic
    Participant

    Does 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);

    #14383
    Boris Bozic
    Participant

    So 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?

    #14385
    Mike Fiore
    Blocked

    Boris,

    What version of the mbed and mbed-rtos libraries are you using?

    Cheers,

    Mike

    #14387
    Boris Bozic
    Participant

    #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 🙁

    #14388
    Mike Fiore
    Blocked

    Boris,

    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

    #14389
    Boris Bozic
    Participant

    mbed_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 7 years, 9 months ago by Boris Bozic.
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.