Author Topic: MoteinoM0 Deep sleep example sketch attachinterrupt  (Read 188 times)

andymcl

  • Newbie
  • *
  • Posts: 7
  • Country: au
MoteinoM0 Deep sleep example sketch attachinterrupt
« on: October 06, 2019, 10:43:30 PM »
 attachInterrupt(pin, wakeupISR, LOW); //note: RISING and FALLING do not seem to work, use LOW or HIGH instead


In the deep sleep example sketch there is a comment by Felix that RISING/FALLING do not seem to work. CHANGE also does not work, well not for me anyway. Is the reason for RISING/FALLING not working known? A limitation of the compiler?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6005
  • Country: us
    • LowPowerLab
Re: MoteinoM0 Deep sleep example sketch attachinterrupt
« Reply #1 on: October 07, 2019, 12:38:50 PM »
Unfortunately I don't remember if there was a reason of it was just a realization.
I would not think this has to do with the compiler.

adam.g

  • Newbie
  • *
  • Posts: 17
Re: MoteinoM0 Deep sleep example sketch attachinterrupt
« Reply #2 on: October 12, 2019, 09:11:34 AM »
Hi Andy,

I recall encountering this same issue last year. From the Arduino forums I believe the issue was:

Quote
One thing you should note is that the edge event interrupts require a specific clock and that clock is disabled in deep sleep mode. For your wake interrupts you should use HIGH or LOW which will work correctly in deep sleep mode.

You can read more from the following threads:

https://forum.arduino.cc/index.php?topic=337289

https://forum.arduino.cc/index.php?topic=586243


Cheers,
Adam

andymcl

  • Newbie
  • *
  • Posts: 7
  • Country: au
Re: MoteinoM0 Deep sleep example sketch attachinterrupt
« Reply #3 on: October 18, 2019, 10:35:15 PM »
Thanks Adam. I found much the same thing on the Sodaq forum
From a Sodaq person replying to a question.......
"The RISING, FALLING and CHANGE modes do not normally work correctly in sleep mode. The reason for this is because those modes require a clock signal to detect. Ordinarily the source clock to the EIC is powered down. These modes can be enabled with some extra configuration of the specific GCLK in use. HIGH and LOW will work fine regardless."
The OP came up with a solution for his particular issue
http://forum.sodaq.com/t/sleep-and-wake-up-using-io-solved/578/2
but I'm struggling with it due to my skill level