I've been trying for days now to have my SF6W wake up on X1 after a deepsleep.
First of all let me explain my configuration.
the board (firmware v1.13) is "externally" powered via it's VUSB Pin, and controls a MMA5284Q (accelerometer) via I2C.
The MMA5284Q is configured to raise a interrupt on a tap, this will lower the INT pin (from 3v3 to 0v).
I read that the X1 wakeup can only work if you raise the pin, therefore I've added a PNP transistor that will reverse the process.
checking with multimeter shows that it works.
if I try to go to lightsleep everything works fine. the board goes to sleep, and is successfully woke up on the tap.
if I try to go to deepsleep the board never wakes up, although I can see the interruption (multimeter) being raised from the MMA5284Q.
I guess I'm doing something wrong, but I can't figure what I would be grateful if anyone can point me to the right solution
If you need more information, please ask.
here the test code:
Code: Select all
import time from pyb import Pin, ExtInt, LED, Switch import machine import MMA8452Q STOP=False ledR = LED(1) ledG = LED(2) # turn of red led as it was turned on in boot.py ledR.off() sw = Switch() def stop(): global STOP global sw print("in stop") STOP = True sw.callback(stop) def wokeUP(line): print("pin change", line) def loop(i2c): global STOP Accel = MMA8452Q.MMA8452Q(i2c) # configure the accel to raise interrupt on Z tap Accel.setupTap(0x80, 0x80, 0x08, True) ledG.on() while STOP is False: print("sleeping in 3") time.sleep(3) #machine.lightsleep() machine.deepsleep() #need to readTap to reset the interrupt print("tapState: " + str(Accel.readTap())) time.sleep(1) ledG.off() #ext = ExtInt(Pin('X1'), ExtInt.IRQ_RISING, Pin.PULL_UP, wokeUP) pinX1 = Pin("X1", Pin.IN, Pin.PULL_DOWN) pinX1.irq(trigger=Pin.IRQ_RISING, handler=wokeUP) i2c = machine.I2C('X') s = i2c.scan() if len(s) > 0: loop(i2c)