-
-
Notifications
You must be signed in to change notification settings - Fork 725
External interruption not being triggered with CHANGE, RISING or FALLING while on standby (sleep) mode. #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If you are not using an external pull-up resistor, the internal pull-up resistor must be enabled. This is for active low button. If your button is active low, interrupt edge detection should be FALLING Tested on an Arduino Zero and it is working fine. |
I am using an external pull-down resistor. My button is active high. My problem is not in triggering the interruption, that works fine. What I cannot do is triggering the interruption while on sleep mode. In the code above, that's the second time I press the button. |
There's something weird going on with the MKR1000. I connected an FTDI to the Serial pins on my Arduino Zero then loaded the following sketch via the programming port:
All is good, however the following does not work:
|
Maybe the Native USB issue is related to #103 |
Here's an updated sketch that works for me:
The 3 major additions are:
The RTCZero library setups the external 32 kHz clock (XOSC32K), and enables it during standby. This part was missing in the core for DFLL48M. We'll need to find a nicer way for handling this. I didn't spend too much time looking into why things work on the Zero programming port, but imagine the EDBG keeps the 48 MHz clock running or something. |
Sandeep, I went through this few weeks ago but didn't manage to run a physical test. As far I know, you do not need a clock source for asynchronous event (when only level trigger is required with no filtering). So, if LOW & HIGH is used in the attachInterrupt(), that should work. The RTC module only consumes about 5 uA and EIC is also about 5 uA when running which is well below the 50 uA maximum current provided by the built-in regulator in low power mode. My findings are more or less same with the report here. |
@rocketscream thanks for the link! I tried changing the EIC to use We'll need to figure out a plan to incorporate low power into the core ... |
I've been playing around with minimizing power in sleep mode. I have the RTC and the EIC both running off the XOSC32K. The EIC is running because I'm using falling-edge interrupts to wake. I found that leaving the pins set as nothing/analog inputs made a significant difference in current - my board went from 100uA during sleep to 40uA. It's not exactly apples to apples because I'm not using the Zero hardware anymore, but 60uA is 60uA. I commented out this line in wiring.c that sets all pins to digital inputs:
I then do my own configuration when I need to set up a pin as a digital input. |
@sandeepmistry |
casundra commented on Jun 1
Why is this in there anyways? I always get it out to get the power down. For the CHANGE, RISING or FALLING while on sleep mode problem, Gabriel Notman suggested using this code: #include <RTCZero.h>
RTCZero rtc;
void setup() {
pinMode(D3, INPUT_PULLDOWN);
attachInterrupt(D3, d3Callback, CHANGE);
EIC->CONFIG[1].bit.FILTEN1 = 1; // D3=eic9
EIC->WAKEUP.vec.WAKEUPEN = (1<<9);
rtc.begin();
rtc.setTime(0, 0, 0);
rtc.setDate(0, 0, 0);
rtc.attachInterrupt(rtcCallback)
rtc.setAlarmSeconds(0);
rtc.enableAlarm(MATCH_SS);
// The RTCZero library will setup generic clock 2 to XOSC32K/32
// and we'll use that for the EIC.
GCLK->CLKCTRL.reg = uint16_t(
GCLK_CLKCTRL_CLKEN |
GCLK_CLKCTRL_GEN_GCLK2 |
GCLK_CLKCTRL_ID( GCLK_CLKCTRL_ID_EIC_Val )
);
while (GCLK->STATUS.bit.SYNCBUSY) {}
} Original on the arduino forum. |
For compatibility with AVR core behaviour. On boards like the Uno, all pins default to input. |
GabrielNotman wrote: https://forum.arduino.cc/index.php?topic=337289.msg2360013#msg2360013 |
Sandeepmistry Has any effort been made to fix this in the core code base yet?? Thanks |
I just tripped up on this problem. + 1 for fixing it ASAP... |
+1 from me as well. |
Me too....
~~ _/) ~~~~ _/) ~~~~ _/) ~~~~ _/) ~~
Tom Lafleur
…On Mon, Jul 3, 2017 at 2:43 PM, tsaG1337 ***@***.***> wrote:
+1 from me as well.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#142 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEXCKyQItkNTwYz7Q59Yh7encELBQK45ks5sKWCYgaJpZM4IZJDE>
.
|
@casundra, Could you please elaborate on it? I'm using MKRFox1200 and "wiring.c" in installation directory of Arduino on my computer doesn't have such line of code. In deep sleep mode MKRFox1200 is using 440uA which is a lot compared to your numbers. I'm waking up this board on timely periods (every 15 minutes). A copy of my code is availble at |
+1 to implement a fix. |
I also had hard times getting this to work for a Seeduino XIAO. Found a solution at https://tinycircuits.com/blogs/learn/tinyscreen-external-interrupt-sleep-mode that is working for me. Minimal example below:
|
I want to be able to wake up the MKR1000 from an external interrupt. So far I've been trying different configurations and the only interrupt types that work are HIGH and LOW.
So CHANGE, RISING and FALLING are not triggering the external interruption while the board is in sleep mode. Here is my code:
The text was updated successfully, but these errors were encountered: