[TriEmbed] some progress with sleep modes using Arduino M0 (ATSAMD21)
Alex Davis
alexd at matrixwide.com
Thu Feb 22 08:03:02 CST 2018
I finally got my Adafruit M0 Adalogger board to sleep without crashing, as well as to get a LIS3DH accelerometer to do both event interrupt triggering and continuous readout. It’s not a full success, however, as measuring current draw shows the M0 does not always go to actual low-power mode. The best I have achieved so far as about 2mA - that’s pretty poor. Worst case “sleep” was 18 mA.
I’m using the LowPower.h library. Yes, that is lazy and I should be setting the registers manually etc…
I think also there are some subtleties with the ATSAMD21 concerning the stack and vectors with interrupts and sleep. If I keep my sleep/wake within main(), it works fine, but if I try do it within a function as part of a switch-case state machine, it fails or appears to run the wrong code.
I would not recommend the ATSAMD21 for low-power projects when using Arduino. The Adafruit M0 products in particular do not have a JTAG interface, so you’re reduced to using LEDs to try to debug, since sleeping shuts down the USB serial interface. I think if you want to use the Feather stuff and want low-power, stick with the 32u4 models.
I put my working and non-working code here on my github: https://github.com/quarterturn/feather-m0-sleep-shake-project <https://github.com/quarterturn/feather-m0-sleep-shake-project>
I can probably accept a 2mA draw in sleep mode. I have a 110 mAh battery, and at 2 mA standby and the occasional 15 mA during recording it should last a whole night. I just have to figure out why the exact same sleep command behaves differently at times.
Alex
|\ | (¯ \/ |¯\ |V| |\ ¯|¯ |¯) | \/ | | | |¯\ (¯ /¯ /\ |V|
|-||_ (_ /\ |_/ @| | |-| | | \ | /\ |^| | |_/ (_ . \_ \/ | |
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20180222/5cf6ea1e/attachment.htm>
More information about the TriEmbed
mailing list