Hello, I'm trying to figure out how to get my code to awake from external interrupt while in a low power sleep standby state.
It appears that I can trigger interrupts using only a HIGH or LOW trigger mode when waking from sleep. (Does this sound right?)
If I am correct how do people use interrupts that are triggered by a 'HIGH' or 'LOW' state. It seems to me that what ever triggered the state would probably stay HIGH or LOW much longer than the interrupt routine, causing the routine to continually execute until the status changed.
Is it possible to simply call 'detachInterrupt(pin)' from within the Interrupt routine so that the routine can't continue to execute?
well there are many ways to trigger (HIGH only on the due)
LOW to trigger the interrupt whenever the pin is low,
CHANGE to trigger the interrupt whenever the pin changes value
RISING to trigger when the pin goes from low to high,
FALLING for when the pin goes from high to low.
if you use LOW interrupt mode, then indeed the interrupt repeatedly triggers as long as you are in the LOW state. Not that an interrupt at a given level can't be interrupted by an interrupt at the same level so you are sure your interrupt code will execute (unless a higher level interrupt occurs)
if you don't want this behavior, then trigger the interrupt only on RISING or FALLING or CHANGE.
J-M-L Ideally I'd be able to use RISING, FALLING or CHANGE to catch the interrupt. However, I can't seem to get them to work to get the tag to wake up from sleep. Unless I set a standby clock... However, using the standby clock seems to eliminate all of my power savings by going to sleep in the first place (I see about 1.3mA in sleep mode, 6mA with the clock enabled during sleep and 7mA fully powered.
also you are correct - other than in active mode the external interrupt pins can only detect a LOW level but not a rising or falling edge. This means that a interrupt is triggered whenever the signal is LOW, e. g. directly after the interrupt is detected and thus you need to
I think I'm starting to follow what your saying. The processor is the SAMD21 and from page 369 of the datasheet it say that " Each interrupt, except NMI, can be individually enabled by setting the corresponding bit in the Interrupt Enable Set register (INTENSET=1), and disabled by setting the corresponding bit in the Interrupt Enable Clear register (INTENCLR=1)."
I still have no idea how to set these registers from the Arduino environment, but I think I'm heading in the right direction
Thanks though, it definitely seems like you pointed me in the right direction. I might end up posting in the Arduino Zero forum here, as setting register values on the Zero seems a bit off topic from this post's title.