<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Thanks for the update, Alex. This is very interesting.</p>
    <p>-Pete<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 02/22/2018 09:03 AM, Alex Davis via
      TriEmbed wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:CBA3D080-E188-4195-AE0D-388979405DF8@matrixwide.com">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      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="" moz-do-not-send="true">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>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Triangle, NC Embedded Computing mailing list

To post message: <a class="moz-txt-link-abbreviated" href="mailto:TriEmbed@triembed.org">TriEmbed@triembed.org</a>
List info: <a class="moz-txt-link-freetext" href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a>
TriEmbed web site: <a class="moz-txt-link-freetext" href="http://TriEmbed.org">http://TriEmbed.org</a>
To unsubscribe, click link and send a blank message: <a class="moz-txt-link-freetext" href="mailto:unsubscribe-TriEmbed@bitser.net?subject=unsubscribe">mailto:unsubscribe-TriEmbed@bitser.net?subject=unsubscribe</a>

</pre>
    </blockquote>
    <br>
  </body>
</html>