mDot wake – disabling pin wake during RTC wake
- This topic has 5 replies, 2 voices, and was last updated 8 years ago by
Mike Fiore.
-
AuthorPosts
-
April 19, 2017 at 11:04 pm #18407
Eric Tsai
ParticipantMy application needs to use the external wake pin in some conditions and use RTC wake in others, but not both at the same time. So the code looks like this:
if (mycondition) { logInfo("going to sleep - interrupt mode"); dot->sleep(0, mDot::INTERRUPT); } else logInfo("going to sleep - RTC clock"); dot->sleep(sleep_time, mDot::RTC_ALARM);
`
I notice that putting the mDot into sleep mode with the RTC_ALARM, the wake pin will STILL wake up the mDot. How do I disable the wake-up pin when I want RTC_ALARM? Is this the expected behavior is a bug?
April 20, 2017 at 8:22 am #18415Mike Fiore
BlockedWhen the mDot is in sleep mode, any interrupt will wake it. If the WAKE pin is configured as an InterruptIn, you need to delete it.
-Mike
April 20, 2017 at 12:36 pm #18435Eric Tsai
ParticipantMike,
I’m not setting any wake pins, so there’s nothing to delete. I think it’s being automactially set by the sleep call’s wake mode. In this application, I need to unset the wake pin dynamically.If I go by this documentation here:
#else 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); }
So whether the Wake Pin is configured as InterruptIn is set by the dot->sleep() call. Could the problem be that the moment you do a <mDot::INTERRUPT>, it sets the wake up pin. It never gets “unset” when I subsequently perform a sleep call that uses <mDot::RTC_ALARM> type wake mode. So the first time a program executes a <mDot::INTERRUPT>, the wake-up pin is set as interrupt forever.
There is a setWakePin() function, but there is no unsetWakePin() function.
April 20, 2017 at 1:09 pm #18436Mike Fiore
BlockedCorrect. We don’t have a way to unset the wake pin for waking on interrupt, so once it’s used, it will remain in effect.
You could try declaring a DigitalIn/DigitalOut/etc (something that doesn’t register an interrupt handler) on the pin that was previously the wake pin. That may prevent that pin from waking the processor from sleep.
-Mike
April 20, 2017 at 4:41 pm #18447Eric Tsai
ParticipantThanks for confirming.
I tried declaring the wake pin from DigitalIn to DigitalOut prior to executing the RTC sleep. But that did not prevent the wake pin from waking the mDot during RTC sleep.
DigitalOut pin_wake(PA_0); dot->sleep(sleep_time, mDot::RTC_ALARM);
April 21, 2017 at 7:41 am #18467Mike Fiore
BlockedAssuming PA_0 is the configured wake pin in the mDot library. Can you confirm?
-
AuthorPosts
- You must be logged in to reply to this topic.