<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">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.<div class=""><div class=""><br class=""></div><div class="">I’m using the LowPower.h library. Yes, that is lazy and I should be setting the registers manually etc…</div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">I put my working and non-working code here on my github: <a href="https://github.com/quarterturn/feather-m0-sleep-shake-project" class="">https://github.com/quarterturn/feather-m0-sleep-shake-project</a></div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">Alex<br class=""><div class="">
<div style="color: rgb(0, 0, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">|\ |  (¯  \/ |¯\  |V| |\ ¯|¯ |¯) | \/ | | | |¯\ (¯   /¯  /\ |V|</div><div style="color: rgb(0, 0, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">|-||_ (_  /\ |_/ @| | |-| |  | \ | /\ |^| | |_/ (_ . \_  \/ | |</div><br style="color: rgb(0, 0, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br style="color: rgb(0, 0, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br style="color: rgb(0, 0, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br style="color: rgb(0, 0, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br style="color: rgb(0, 0, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br style="color: rgb(0, 0, 0); font-family: Monaco; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">
</div>
<br class=""></div></div></body></html>