-
Notifications
You must be signed in to change notification settings - Fork 58
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
Making Low Power great again #51
Comments
Nice work mamama1. I found your comment interesting:
I think the reason that you have to do this after the interrupt has been attached is See issue #30. I recommend patching my suggested fix in issue #30 if you're going to use |
I recommend forking this project. It's been like 3 years since your issue @denisbaylor and still it's not merged. Deep sleep is one the THE MOST IMPORTANT aspect of MCU's since IoT is comming and comming fast, yet one of the less supported. If any of you guys are willing to fork this library or make a sleep library from scratch for SAMD21 let me know, I would love to work with you guys! |
@mamama1 I would love to see your entire code base. I have a small project going on where I could use your example. |
seems like SAMD21 development is kind of dead. I haven't touched anything since 1,5 years ago and I can hardly remember anything. I'm sorry, but I think I've given away everything in my first post. I won't get better from there. |
From your first post I don't know who is |
Any idea why is SAMD21 dead? |
After days of work (I am a noob), I have finally achieved the following:
The issues:
So, what I have done to achieve my goals (actually not too complex):
In Setup(), first thing to do for me was to attach OCSULP32K to GCLK2:
Then setup your pins according to your needs, I had some buttons connected:
Set the UART RX pins to INPUT_PULLUP as well
Attach my interrupt with an ISR on falling edge:
attachInterrupt(this->ButtonPin, myISR, FALLING);
Now comes the fat part, I wrote a sleep function which 1) saves all the pin configs 2) sets all pins which currently are INPUTs to INPUT_PULLUPs 3) sets MISO to INPUT_PULLUP (there might be more pins for which this should be done) and which puts the MCU to sleep and then after wakeup restores all the registers so the user program isn't affected by misconfigured GPIO pins.
Most probably, to reach library quality and broad compatibility with all the possible configurations and SAMD21 boards, this needs to be refined very much but as I said: I am a noob and this took me days to find out and to do.
I would be very happy to see the fixes refined and implemented into the LowPower library because in the current state, with floating pins, only level detection external interrupts and so on, in my humble opinion this is a little bit useless for real low power applications.
I mean, the SAMD21 is a way more powerful MCU than the AVR (328p for example) and still it can achieve way lower standby power consumption and I think that it is a pity that this potential is kind of wasted.
Thank you for your attention.
The text was updated successfully, but these errors were encountered: