mDot wakeup by RTC and interrupt
- This topic has 2 replies, 2 voices, and was last updated 4 years, 9 months ago by
kkhylchuk.
-
AuthorPosts
-
June 15, 2020 at 8:11 am #30730
kkhylchuk
ParticipantHi everyone,
I have an issue with my mDot. I can’t wake it up from sleep.
The function I’m using is sleep_wake_rtc_or_interrupt from Dot-Examples/dot_util.
The issue pops up whenever I compile offline with GNU Arm Embedded Toolchain version other than 6 (6 2017-q2-update).I’ve made a few modifications to the function to accept variable sleep time:
void sleep_wake_rtc_or_interrupt(bool deepsleep, uint32_t time) { // in some frequency bands we need to wait until another channel is available before transmitting again // wait at least 10s between transmissions //uint32_t delay_s = dot->getNextTxMs() / 1000; uint32_t delay_s = time; /* if (delay_s < SLEEP_TIME ) { delay_s = SLEEP_TIME ; } */ if (deepsleep) { // for mDot, XBEE_DIO7 pin is the only pin that can wake the processor from deepsleep // it is automatically configured when INTERRUPT or RTC_ALARM_OR_INTERRUPT is the wakeup source and deepsleep is true in the mDot::sleep call } else { // configure XBEE_DIO7 pin as the pin that will wake the mDot from low power modes // other pins can be confgured instead: XBEE_DIO2-6, XBEE_DI8, XBEE_DIN dot->setWakePin(XBEE_DIO7); } logInfo("%ssleeping %lus or until interrupt on %s pin", deepsleep ? "deep" : "", delay_s, deepsleep ? "DIO7" : mDot::pinName2Str(dot->getWakePin()).c_str()); logInfo("application will %s after waking up", deepsleep ? "execute from beginning" : "resume"); // lowest current consumption in sleep mode can only be achieved by configuring IOs as analog inputs with no pull resistors // the library handles all internal IOs automatically, but the external IOs are the application's responsibility // certain IOs may require internal pullup or pulldown resistors because leaving them floating would cause extra current consumption // for xDot: UART_*, I2C_*, SPI_*, GPIO*, WAKE // for mDot: XBEE_*, USBTX, USBRX, PB_0, PB_1 // steps are: // * save IO configuration // * configure IOs to reduce current consumption // * sleep // * restore IO configuration if (! deepsleep) { logInfo("Save IO configuration\n\r\n\r"); wait_us(200000); // save the GPIO state. sleep_save_io(); // configure GPIOs for lowest current sleep_configure_io(); } // go to sleep/deepsleep and wake using the RTC alarm after delay_s seconds or rising edge of configured wake pin (only the WAKE pin in deepsleep) // whichever comes first will wake the xDot dot->sleep(delay_s, mDot::RTC_ALARM_OR_INTERRUPT, deepsleep); if (! deepsleep) { // restore the GPIO state. sleep_restore_io(); logInfo("Restore IO configuration"); } }
But unmodified function does not work for me either. As well as calling dot->sleep(300, mDot::RTC_ALARM_OR_INTERRUPT, false) directly.
mDot just goes to sleep and never wakes up.
Though sleep_wake_rtc_only (mDot::RTC_ALARM) works as expected.I tried setting the wakeup pin to 0 before going into sleep (as suggested in this thread), but it did not help.
Everything works as expected if compiled with the toolchain v6. But then I get the following warning:
Compiler version mismatch: Have 6.3.1; expected version >= 9.0.0 and < 10.0.0I’m using:
libmDot v3.3.5
mbed-os v5.15.1
mbed-cli v1.8.3
GNU Arm Embedded Toolchain v9 (9-2019-q4-major)What am I doing wrong?
Thanks
June 15, 2020 at 9:48 am #30737Jason Reiss
KeymasterThe library is built with GNU Tools ARM Embedded\6 2017-q2-update
I expect v9 is not compatible in some way.We will look to update the library to v9 in a future release, we have been testing with v9 during development.
June 15, 2020 at 10:26 am #30738kkhylchuk
ParticipantI see. Thanks for the reply.
Where can I find the information about what version of the toolchain to use with a specific version of the library? -
AuthorPosts
- You must be logged in to reply to this topic.