adafruit / circuitpython

CircuitPython - a Python implementation for teaching coding with microcontrollers
https://circuitpython.org
Other
4.11k stars 1.22k forks source link

PinAlarm -- different behavior on different pins.... #3965

Closed jerryneedell closed 3 years ago

jerryneedell commented 3 years ago

I've been playing with pin_alarm on metro_esp32s2 -- When I use Pin IO5 it works as expected (grounding pin 5 wakes it) but with the same setup, if I use Pin IO11 it appears to be inverted. (I have to connect pin 11 to 3v to wake it). Here is the code I am using:

import alarm
import alarm.pin
import time
import neopixel
import board
import digitalio

if alarm.wake_alarm:
    #print("awake", alarm.wake_alarm, alarm.wake_alarm.pin)
    print("awake", alarm.wake_alarm)
    alarm.sleep_memory[0] += 1
else:
    print("no wake up alarm")
    alarm.sleep_memory[0] = 0

print("count:", alarm.sleep_memory[0])

#enable = digitalio.DigitalInOut(board.NEOPIXEL_POWER)
#enable.switch_to_output(False)
pixels = neopixel.NeoPixel(board.NEOPIXEL, 1)

pixels.fill(0x00000f)
pin_alarm = alarm.pin.PinAlarm(pin=board.IO5, value=False, pull=True)
#pin_alarm = alarm.pin.PinAlarm(pin=board.IO11, value=False, pull=True)

#board.DISPLAY.refresh()

print("about to deep_sleep")

# We don't turn off the neopixels explicitly.
# We expect code after the VM to do it.

alarm.exit_and_deep_sleep_until_alarms(pin_alarm)

any idea why IO11 behaves differently from IO5? also found that IO7 also behaves as expected (like IO5)

jerryneedell commented 3 years ago

hmmm --- never-mind -- I cannot reproduce this now -- it is working on IO11

jerryneedell commented 3 years ago

Actually, I can reproduce it -- when I plug in an rfm9x featherwing -- then IO11 behaves as above. I'll check for conflicts... yes -- IO11 is connected to a pin (IRQ) on the RFM9x Featherwing. Sorry for the False alarm.