Arduino Zero vs Moteino M0 Definitions?

Hi there,

I have an Adafruit Feather RadioFruit M0 board, and when I run some RTCZero sleep/wakeup code by selecting and uploading to "Arduino/Genuino Zero" as the board, it draws around 540uA. However, if I upload to "Moteino M0" instead, it draws only 115uA. My question is, what are the main differences between the two board package definitions that cause such a huge power consumption difference in standby mode?

Note: This question is NOT about the specifics of the code itself (and hence I don't need to attach it here), but more on the board package differences.

Thanks!

Hi,

I'd also be interested in knowing the answer to this question. I have a couple Moteino M0 currently being shipped to me and I'm very keen on low power operation. Have you thought about posting on the https://lowpowerlab.com/forum/moteino-m0/ forums to ask Felix about this? He'd be likely the one to give you the most definitive answer about how the Moteino M0 register definitions differ from those of official Arduino Zero.

Out of curiousity, what kind of current draw do you get with Adafruit Feather M0 board selected?

Cheers,
Adam

Hi there!

With just the Adafruit RadioFruit M0 RFM95 board in standby mode with the RTCZero library and compiling/uploading with the Moteino M0 board selected, I get down to 102uA when powered by a LiPo battery. Pretty good! However, if I select Arduino Zero the current is ~500uA with the exact same sketch.

Diff says the cores are identical except that the moteino doesn't initialize the digital pins as inputs:

[tt]pwd
/Applications/Arduino-1.8.5.app/Contents/Java/portable/packages/Moteino/hardware/samd/1.2.0/cores/arduino
WWHackintosh<4984> diff . /Applications/Arduino-1.8.5.app/Contents/Java/portable/packages/arduino/hardware/samd/1.6.19/cores/arduino/
Common subdirectories: ./USB and /Applications/Arduino-1.8.5.app/Contents/Java/portable/packages/arduino/hardware/samd/1.6.19/cores/arduino/USB
Common subdirectories: ./avr and /Applications/Arduino-1.8.5.app/Contents/Java/portable/packages/arduino/hardware/samd/1.6.19/cores/arduino/avr
diff ./wiring.c /Applications/Arduino-1.8.5.app/Contents/Java/portable/packages/arduino/hardware/samd/1.6.19/cores/arduino/wiring.c
84,87c84,87
<   //for (uint32_t ul = 0 ; ul < NUM_DIGITAL_PINS ; ul++ )
<   //{
<   //  pinMode( ul, INPUT ) ;
<   //}
---
>   for (uint32_t ul = 0 ; ul < NUM_DIGITAL_PINS ; ul++ )
>   {
>     pinMode( ul, INPUT ) ;
>   }

[/tt]

Interesting. And why would that make such a difference though? So they're basically left in high Z state? I don't see how initializing them as input could draw so much more current.

In my experience with ARM processors, an unconfigured pin is literally an 'un-connected' state, not 'high impedance'. This is much lower power than configuring it as an input and leaving it floating.

I don't recall if configuring as an OUTPUT (assuming it is truly unused) is similar low power to an unconnected pin. However, I am sure that unconnected is the absolute lowest power.

Tom

Interesting!

"floating" input pins are a famous source of unexpected power use; stray electrical fields will cause random voltages to appear on the pins, and if the voltage happens to be between logic thresholds, it can bias the transistors of the gate in ways that cause the pin to use much more current than it would if it were configured as an output, or as an input with something valid connected.

~400uA doesn't really seem high enough for this to be the explanation - it could just be that the GPIO ports consume "some" power when configured. But it's standard practice in low-power design to make sure that none of your IO pins are left configured as inputs with nothing connected to them. (and it's a bit sad that this is so often ignored in Arduino programs.)

TomWS:
In my experience with ARM processors, an unconfigured pin is literally an 'un-connected' state, not 'high impedance'. This is much lower power than configuring it as an input and leaving it floating.

I don't recall if configuring as an OUTPUT (assuming it is truly unused) is similar low power to an unconnected pin. However, I am sure that unconnected is the absolute lowest power.

Tom

Hi guys,

@Tom, I also came across this in the SAMD21 manual, which states: "39.6 Unused or Unconnected Pins
For unused pins the default state of the pins for the will give the lowest current leakage. There is thus no
need to do any configuration of the unused pins in order to lower the power consumption."

@androidfanboy I also used the Moteino M0 board with my Adafruit Feather Adalogger M0 and was able to get down from ~360 uA to 80 uA! Not bad! I also posted on Felix's forums and he said that the difference is basically his definition lacks some input initializations.

The reduced quiescent draw is great, but are there any disadvantages to using the Moteino M0 board definitions with Adafruit Feather boards?

Cheers,
Adam

I guess that answers the question then! That's really good to know.

So far I haven't had any issues uploading with the Moteino M0 board selected. SPI, I2C, etc. work just fine.

@androidfanboy

Felix provided an update that some of Adafruit's pin definitions may not match up with those of the Moteino M0, but I've also found mostly everything works just fine. One issue I did run into was the Feather Adalogger M0's resistor divider pin used to measure the battery voltage (A7) didn't work with the Moteino M0 board selected. I believe this is what Felix was referring to.

Cheers,
Adam