How to wakeup from sleep on more than one input?

Hi everyone,

I am using the System.sleep(uint16_t wakeUpPin, uint16_t edgeTriggerMode) system call on the photon.
The code works as documented, but I would need to be able to wake up on either of two input signals, not just one.

I have read somewhere that the STM32 supports this, but Particle’s firmware does not. I was wondering if someone can share some pointers on how to work around this limitation and configure the photon to wake up on two pins instead of one.

Any help will be greatly appreciated!

Cheers,

2 diodes as OR logic?

Thanks for the suggestion. Yes, that would work. I was trying to avoid a hardware solution… :smile:

I have not tried it, but in the docs about attachInterrupt() you’ll find this note

So you could try one of the shared EXTI pins if you provide a suitable external pull-resistor on the pin that you did not state in the sleep call.
No idea if this works, but an easy try :wink:
If you use D0/A5 you might even be able to use the SETUP button for waking.


If this doesn’t work you could look in the open source repo to see how sleep() sets the pin up for waking and copy that.

1 Like

Hi ScruffR,

Nice suggestion. I am currently using D1 and D2. I would have to reroute my button to use A4 to try it. Interesting!

Thanks,

Javier

I have been wondering about this exact same thing. Can I wake from multiple pins?

Please do post your results about this.

I’ll discuss this with our firmware engineers internally - it’s something that’s come up once or twice.

I’m fairly sure it’s technically possible - the trickier part is determining how the API will look.

5 Likes

@mdma, just checking to see if anything has been discovered for this?

1 Like

I second this request. In a previous thread someone mentioned registering for interrupts on the pins and using normal sleep, which will wakeup from any interrupt, however I also need deep sleep for my application.

You can only wake from deep sleep with a rising edge on the WKP pin, so if you need multiple inputs, you should use an OR gate, or a couple of diodes as suggested by @CuriousTech.

Thanks!

Hi @mdma,

Wondering if any progress has been made on this or if you’ve determined if it is possible? Would like to accomplish this without having to use and OR gate or diodes.