7 years, 1 month ago.

rt_suspend()/rt_resume() and deepsleep()

I'm trying to implement some code which does the following:

  1. Sets an RTC alarm,
  2. Suspends RTX with rt_suspend(),
  3. Calls deepsleep(),
  4. Resumes RTX with rt_resume() when the alarm wakes things up, telling it for how many RTX intervals it has been asleep.

(1) and (3) work fine, I can deep sleep and wake up on an RTC alarm, all is good. I can also do (4) (with a zero value for the sleep time) and that works. My problem is with (2), the rt_suspend() call.

As soon as I do (2) I never wake up from deep sleep. I can see nothing in deepsleep() that would call RTOS functions and nothing in rt_suspend() that would affect the HW state.

Can anyone suggest what I'm doing wrong?

I have a subsequent question (once this is working), which is how can I figure out the RTX-tick duration for the sleep is? I understand that rt_suspend() returns the next RTX timing event but I don't care about that (I'm gonna sleep anyway).

This is on an STM32F437 micro running on an Odin module with mbed as at commit 3a27568 (6 days ago).

Be the first to answer this question.