openMV RT1062 deep sleep wakeup

Hi! Thank you once again for a great product!

I want to achieve the following on the openMV RT1062.

  1. Enter deepsleep
  2. Wakeup from deepsleep using external Rising Edge interrupt.
  3. Repurpose the wakeup pin for reading and writing when the script has woken up from Deep Sleep.

I managed to put the RT1062 in deep sleep, but not managed to wake it up using the Pin.irq on pin 0:

import machine
# test deep sleep on pin high
from machine import Pin
import time

print("Start deep sleep test")

def callback(p):
    print("callback triggered")

pin = Pin("P0", Pin.IN, Pin.PULL_UP)
pin.irq(trigger=Pin.IRQ_FALLING, handler=callback)

# enter deep sleep
while True:
    print("loop after deep sleep")

I observed that in openmv/ports/

I can wake it up from deepsleep using the wake pin (P11) without any configuration, but only by pulling it low, not rising edge/high as desired. And the machine.reset_cause() do not inform me that the reset cause was interupt from deepsleep.

To summarize:
In first hand I want to use any GPIO pin to wake the openMV RT1062 up from deep sleep using interrupts when high, when in the interupt I want to temporary disable that specific interrupt, start using the same GPIO pin to read and send 0’s and 1’s.

If this doesn’t work I want to use the external interrupt pin but trigger when high instead of low without using any external inverters. I also want to use this pin to output/input 0’s and 1’s.

Thank you in advance!

Best, Casper

Found that it already is rising egde: src/micropython/ports/mimxrt/modmachine.c

    #elif defined pin_WAKEUP
    GPC_EnableIRQ(GPC, GPIO5_Combined_0_15_IRQn);

Also found that I can read and write to the same pin, and that I will not be able to change it.

I have not figured out how to get the correct reset_cause.

cause = machine.reset_cause()
while True:
    print("Cause of reset: ", cause)

Hi, deepsleep automatically enables the wakeup event on P11.

You cannot use P0. In deepsleep all parts of the chip are turned off except for a rising edge on P11. That’s how it gets down to 30uA. Literally everything but a very small part of silicon is off.

As for the reset cause… there’s not logic in the chip to really tell you that except: micropython/ports/mimxrt/modmachine.c at 99baee47ded6c52b2ff1881cb278def56fe8dd0d · openmv/micropython (

There’s nothing to tell you if it was the pin specifically.