Waking XDot via UART

Home Forums mDot/xDot Waking XDot via UART

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18985
    Matt Briggs
    Participant

    I am interested in waking the UART from sleep (stop mode) and receiving characters then going back to sleep say after 10 seconds. I have tried setting the dot->setWakePin(UART1_RX) and this does indeed wake the uC up but also seems to make Serial.readable always true (and reads a NUL char) directly after exit from sleep even from other unrelated interrupts. This causes problems with the rest of my serial implementation.

    The work around I am currently pursuing is to make UART1_RX an InterruptIn which will trigger a flag in the main loop to configure the serial port then after the 10 second timeout the Serial class is destroyed and the InterruptIn irq re-enabled.

    Is there a better way of implementing this functionality?

    • This topic was modified 7 years, 6 months ago by Matt Briggs.
    #18987
    Mike Fiore
    Blocked

    Matt,
    When you call mDot::setWakePin() and go to sleep, the Dot library is internally creating an InterruptIn object on that GPIO. So your solution would look basically the same whether or not you used setWakePin().

    * delete your serial object
    * set the wake pin or create your InterruptIn
    * go to sleep
    * wake on serial
    * delete InterruptIn if you created it (Dot library handles this if setWakePin was called)
    * create serial object
    * RX serial data

    Hope this helps!

    Cheers,
    Mike

    #18989
    Matt Briggs
    Participant

    Thanks for the thoughts Mike.

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