ATMEGA4809 High consumption for Low Power mode

Mod edit:
Title changed so as to not suggest that the board is a Nano Every when it is actually a custom board made by the OP.

Hello everyone,

I'm trying to reduce the power consumption of the ATMEGA4809 (Nano Every) as much as possible, but all I've managed so far is 5mA, which is still too high. Does anyone have any suggestions on what I might be doing wrong? I thought about reducing the clock speed, of course, but the Atmel-ICE fuse only allows 16MHz, so I'm not sure how to proceed. If anyone knows what's going on, I'd appreciate it in advance.

/* 
This program should blink the LED 5 times and put the CPU to sleep.
When the wakeupButton is pressed, the CPU wakes up and makes the LED blink again 5 times.
The problem is that while the CPU sleeps, consumption is at 5 mA!
CPU ATMEGA4809
*/
#include <avr/sleep.h>
#include <avr/interrupt.h>

#define wakeupButton 10
#define statusLed 39

void setup() {
       pinMode(statusLed,OUTPUT);
       pinMode(wakeupButton,INPUT);
       attachInterrupt(digitalPinToInterrupt(wakeupButton), wakeUp, FALLING);
}

void loop() {
//      
      for (int i = 0; i < 5; i++) {                      
          digitalWrite (statusLed, HIGH);                             
          delay (250);                                           
          digitalWrite (statusLed, LOW);                              
          delay (250);
          }
//
        delay(1000);
//
        goToSleep();
}

void goToSleep() {
 sleep_enable();                                        // Enabling sleep mode
 set_sleep_mode(SLEEP_MODE_PWR_DOWN);        // Sets the lowest possible  (!?)
 sleep_cpu();                                           // Activating sleep mode
}

void wakeUp() {
 sleep_disable();
}


Please post your annotated schematic showing exactly what you built.

Thanks, gilshultz.
Actually, it's just an LED and a button. I don't have a schematic for it.
On the other hand, I'm a little concerned because it seems like the ATMEGA4809 doesn't allow operating frequencies beyond 16 and 20MHz. I'm not sure if I'm correct in this statement, because 5mA is too high a current for my purposes.

As this is an official Arduino board, it doesn't belong in the third party boards section. So I have moved it here.

How is the Nano Every being powered?

5 milli amps????
You need a better board


And they have released a board with 0.5uA (still to be tested)

If you're using the Nano Every board and not a plain ATmega4809, remember that there is also a SAMD11 processor on the board.
And an on-board power LED.

Only when using the internal clock as far as I know. With an external clock you can go lower.

Grumpy Mike I followed the forum's own recommendation for third party boards and standalone microcontrollers, because I'm using the ATMEGA4809 on a board I designed

It's a custom board. The power supply is 3.6V.

I believe it is possible to achieve significantly lower values, I just don't know how...

I'm not using a standard Nano Every board, but the microcontroller from that board (ATMEGA4809). I think I failed to realize that the internal clock only supports 16 or 20MHz. In reality, 8MHz would meet my specifications since there will be serial communication with a baud rate of 9600.

For now I need to make sure that I can only reduce the current consumption by using an external crystal.

You can run the 4809 at lower speeds by using the prescaler.

Thanks, Stitech.

Actually, I was thinking about the possibility of changing the internal clock from 20MHz to 32KHz before putting the CPU to sleep, and then switching back to the internal clock of 20MHz when the CPU wakes up. Is this possible in C, or should I use Assembly?

Is there an example of this?

Is your wakeupButton connected to Arduino pin 10 (PB1), pin 10 of 28-pin SSOP (PD4), pin 10 of 32-Pin VQFN/TQFP (PD0), pin 10 of 40-pin SSOP (PD1) or pin 10 of 48-Pin UQFN/TQFP (PC0)?

Based on your title it appeared you had a Nano Every, you stated so in the title and the description of your problem. I have removed Nano Every from your title and moved the topic back to 3rd party boards. Please be clear about what you have otherwise people are going to waste time offering incorrect advice. I suggest you post your schematic, PCB layout and photos of your board.

Thank you.

1 Like

In ATMEGA4809, 10 means D10/PB2, pin 6 for 48 pin TQFP package

I never found Arduino functions for changing clocks or clock speeds, so you’ll need direct register access.

To switch to 32kHz :

_PROTECTED_WRITE(CLKCTRL.MCLKCTRLA, CLKCTRL_CLKSEL_OSCULP32K_gc);

To switch to 8MHz:

_PROTECTED_WRITE(CLKCTRL.MCLKCTRLB, CLKCTRL_PDIV_2X_gc | CLKCTRL_ENABLE_bm);

OK. Sorry for the mistake.

1 Like

How much current does that LED draw, 5 mA is about 25% of its current rating and a reasonable amount of current to illuminate it.

Thanks Stitech
I will certainly try your suggestion.