mDot wake – disabling pin wake during RTC wake

Home Forums mDot/xDot mDot wake – disabling pin wake during RTC wake

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #18407
    Eric Tsai
    Participant

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

    #18415
    Mike Fiore
    Blocked

    When 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

    #18435
    Eric Tsai
    Participant

    Mike,
    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.

    #18436
    Mike Fiore
    Blocked

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

    #18447
    Eric Tsai
    Participant

    Thanks 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);
    #18467
    Mike Fiore
    Blocked

    Assuming PA_0 is the configured wake pin in the mDot library. Can you confirm?

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.