Go Down

Topic: Reducing power consumption (Read 9875 times) previous topic - next topic

dlabun

I tried removing the pin initialization and no success... I even tried without the Arudino bootloader being loaded on the board and as soon as the Arduino core starts to execute current draw jumps up to atleast 13mA. I can leave the Sparkfun bootloader running all day at ~8mA.

trampas

I have done a custom board design using the SAMD21.  In the design I use the RTC to wake the processor every minute, and then put back to sleep.

In sleep I am consuming ~50uA with the RTC running.

There quite a few things I had to do get down this low, for example make sure all GPIOs are not floating and turning off the peripherals and clocks not used.  The code was for a contract I did so I can not share but will try to get an example posted if it would help.

Trampas
misfittech.net

IlPinguino

Any chance you have the example code for reducing power consumption?

aldamig

Resurrecting the post from the dead because it is one of the first results when you search for M0 and power consumption.
It is indeed possible to reduce the power consumption of the microcontroller down to microamp levels.
The lowest I have achieved is ~3μA @ 3.3V, measured with a keysight B2900A precision source. This is for the microcontroller only, on a board where everything else is removed.
Unfortunately to do so easily, you need to use Atmel Studio and a programmer to flash the device without the arduino bootloader. (It would be possible to do it with the bootloader, but that would require reconfiguring everything and probably breaking most peripheral libraries in the process)
Then, as trampas mentioned, point all unused peripherals to dead clocks like so:
Code: [Select]
GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID_USB | GCLK_CLKCTRL_GEN_GCLK4;
GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID_EVSYS_0 | GCLK_CLKCTRL_GEN_GCLK4;
...
..

In this case GCLK4 is unused and not connected to any oscillator.

And make sure that the clock system is optimally configured for low power consumption. To do so, have only one Generic clock generator active on standby, connected to the 32kHz ultra low power internal oscillator (OSCULP32K), and then connect only the RTC to that clock generator. Don't forget to enable Run in standby for that generator.
If that is the only thing powered on in standby, and no other peripherals are pointed to that generator, you can go down to few microamps.

I have attached an overview of the clock configuration on Atmel START

scswift

Why does this technique require the removal of the bootloader? Doesn't the bootloader run only once when the board is initially powered up, and from then on it's never executed again unless you press reset or the PC attempts to initiate a serial connection?

(I assume the code that performs that check is part of your sketch, not the bootloader itself.)

aldamig

Why does this technique require the removal of the bootloader? Doesn't the bootloader run only once when the board is initially powered up, and from then on it's never executed again unless you press reset or the PC attempts to initiate a serial connection?

(I assume the code that performs that check is part of your sketch, not the bootloader itself.)
As I mentioned, it is not strictly required but hell of a lot easier without the bootloader.
That's because the bootloader configures a lot of peripherals and clocks that might be unnecessary, and you would have to undo all these settings. It is easier to start with a microcontroller on the default configuration and just enable what's needed.
It is true that the bootloader runs only once, so if you configure everything at setup it should be fine.

The reason I initially removed the bootloader was different; some kind of weird bug caused my serial communication to delete the first few pages of my program, rendering it useless and stuck in bootloader mode. Something probably triggered the programming function of the bootloader, overwriting the instructions with zeroes. I chose the easy road of removing it all together!

MartinL

Quote
Then, as trampas mentioned, point all unused peripherals to dead clocks like so:
Surely re-pointing all the generic clocks isn't necessary, as all clock sources: XOSC, XOSC32K, OSC32K, OSCULP32K, OSC8M and DFLL48M, that don't have their RUNSTDBY bit set are automatically switched off in standby mode anyway.

aldamig

#22
Jan 18, 2019, 11:43 am Last Edit: Jan 18, 2019, 11:44 am by aldamig
Surely re-pointing all the generic clocks isn't necessary, as all clock sources: XOSC, XOSC32K, OSC32K, OSCULP32K, OSC8M and DFLL48M, that don't have their RUNSTDBY bit set are automatically switched off in standby mode anyway.
I agree that the sources are switched off, but I was unsure if any peripheral was pointing to my "run in standby" clock generators, which would increase power consumption even if said peripheral was switched off.
Plus, it is recommended on the "Atmel AT06549: Ultra Low Power Techniques" application note chapter 7 (:

MartinL

Quote
Plus, it is recommended on the "Atmel AT06549: Ultra Low Power Techniques" application note chapter 7 (:
But that's only relevant if the generic clock is being driven by a clock source that's active during standby.

aldamig

But that's only relevant if the generic clock is being driven by a clock source that's active during standby.
For example in one application I used GCLK2 as run on standby, which is the GCLK used by the WDT on reset. Pointing it to another GCLK ensures that there is no unnecessary clock propagation.

Another example where this would be needed is if you have additional peripherals connected to the GCLK that runs on standby. Of course if you're running the CPU at high speeds, you might as well use another GCLK for them.

I'm not saying it is strictly required in every single application, but you have to verify that, and act accordingly.

Go Up