combined touch and ext0 wakes get "ValueError: no resources" ?

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
kindmartin
Posts: 20
Joined: Sun Apr 26, 2020 7:30 am

combined touch and ext0 wakes get "ValueError: no resources" ?

Post by kindmartin » Thu Jun 03, 2021 6:46 am

Hi all, Im getting some rare messages when I try to set to both, I mean if or ext0 (@ Pin 15 for instance) wakeup or touch ( Pin(32) for instance).
I ve read some references that with rev 0 and rev1 we cannot set both at the same time to wake if happened one or the other reason.
https://docs.espressif.com/projects/esp ... ep%20modes
....
In revisions 0 and 1 of the ESP32, this wakeup source is incompatible with ULP and touch wakeup sources.
....

I ve set code like:

MicroPython v1.14-119-g6e5aea08a-dirty on 2021-04-15; ESP32 @2021 (spiram) with ESP32-8MB
Type "help()" for more information.
>>> import lib_full as lib
>>> sensor1 = lib.machine.Pin(15, lib.machine.Pin.IN, lib.machine.Pin.PULL_UP) # sensor INT1
>>>
>>> wake = lib.machine.Pin(32, mode = lib.machine.Pin.IN)
>>> touch = lib.machine.TouchPad(wake)
>>> touch.config(500)
>>> lib.esp32.wake_on_ext0( lib.machine.Pin(15), level = lib.esp32.WAKEUP_ANY_HIGH)
>>> lib.esp32.wake_on_touch(True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: no resources
>>>

test module is a wrover-e, rev3 flashed compiled with spiram enabled
can anyone confirm if with rev 3 and Mpy 1.15 or similar I could set to wakeup combining those wakes touch and ext0 (or ext1) ?

thanks in advance.

M

kindmartin
Posts: 20
Joined: Sun Apr 26, 2020 7:30 am

Re: combined touch and ext0 wakes get "ValueError: no resources" ?

Post by kindmartin » Thu Jun 03, 2021 7:04 am

some other reference suggesting use ext1 as a workaround but it doesn't work either/

>>> import lib_full as lib
>>> sensor2 = lib.machine.Pin(2, lib.machine.Pin.IN, lib.machine.Pin.PULL_UP) # sensor INT2
>>> wake = lib.machine.Pin(32, mode = lib.machine.Pin.IN)
>>> touch = lib.machine.TouchPad(wake)
>>> lib.esp32.wake_on_ext1(( lib.machine.Pin(34), lib.machine.Pin(2)), level = lib.esp32.WAKEUP_ANY_HIGH)
>>> lib.esp32.wake_on_touch(True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: no resources
Last edited by kindmartin on Thu Jun 03, 2021 8:39 pm, edited 1 time in total.

marcidy
Posts: 133
Joined: Sat Dec 12, 2020 11:07 pm

Re: combined touch and ext0 wakes get "ValueError: no resources" ?

Post by marcidy » Thu Jun 03, 2021 6:40 pm

ext0 is explicitly incompatible with wake on touch in micropython. Just reading the code, i don't see anything preventing use with ext1 (I have no idea if it will work from a hardware perspective)

You might want to try a hard reset (e.g. rst pin or full power off) when experimenting with ext1. I don't see anything which should trigger the error when using ext1, however, a soft reset doesn't reset all registers etc, so if you have not hard reset after setting ext0 config, you'll still see the error.

So if you are running something on reboot (ie main.py, etc) that configured ext0, you'll never be able to experiment with ext1 since ext0 always gets configured.

I haven't tried this, just reading the code and having faced similar issues with registers on soft reboot leads me to think this may be the case.

Post Reply