7 years ago.

Wake-Up from sleep mode with RTC interrupt strange problem

Hi to all,

I'm working on NUCLEO-F411 board, using mbed-os; I'm facing with a very strange problem: I'd like to send the mcu in sleep mode and wake-up every "tot" seconds with an RTC interrupt, so I'm using a low power ticker that works perfectly. I use the:

  1. define SLEEP_TIME_MS (uint32_t) 9000
  2. define SLEEP_TIME_US (uint32_t) (SLEEP_TIME_MS * 1000)

uint32_t time2wait_interrupt = SLEEP_TIME_US + lp_ticker_read(); lp_ticker_set_interrupt(time2wait_interrupt )

function to set a specific time ('time2wait_interrupt' must be expressed in useconds) interrupt and after that, I use:

hal_deepsleep()

to send the mcu in sleep mode. In this mode, the sleep mode lasts SLEEP_TIME_MS mseconds and after the mcu wakes-up. All works perfectly if SLEEP_TIME_MS is under 4 seconds, but if i set SLEEP_TIME_MS to 4 seconds, the micro does not go in sleep mode but go after the hal_deepsleep function. In my simple code there is only the main thread with a thread::wait di 1 second, in which the mcu should go periodically in sleep mode. I attempt to solve my problem looking for in this mbed forum, and, after, with google, but I could not solve it. Please, could anyone suggest me any possible solution ? Regards

Davide Urbano

Be the first to answer this question.