Atmega3209 Power down mode

Go To Last Post
50 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello, 

 

i made a battery powered project that measures pulses on digital input and sends pulse count via uart every 60 min. The MCU should be in power down mode and wake up only when PIT(part of RTC peripheal) sends a pulse. At this point the PCB is working as it should, the only problem is that i can not get the MCU power consumption below 115 uA when in power down mode. 

At first i thought that the problem is my hardware design, but then i removed ALL the components from the PCB and only left the Atmega3209 on and power consumption still wont go below 115 uA, while according to datasheet it should be 15 uA MAX. I am running the core at 416.667 KHZ(internal 20MHz oscilaltor/48) and PIT gives me pulse every 1s.

Only thing connected on the MCU on my test PCB is 2x VDD, 1x AVDD, pull up on reset pin and UPDI interface(which i disconnect when measuring current).

 

#include <atmel_start.h>
#include <util/delay.h>
#include <funkcije.h>
#include <avr/sleep.h>
#include <avr/interrupt.h>

//F_CPU = 416.667 kHZ

uint32_t counter = 20;
uint32_t timer = 0;

ISR(RTC_PIT_vect)
{
	cli();
	timer++;
	if(timer>120){//2minute send out interval for faster testing
		usart_send_int(counter);
		counter=0;
	}
	RTC.PITINTFLAGS = RTC_PI_bm;
	sei();
}

int main(void)
{
	atmel_start_init();
	_delay_ms(1000);

	sei();
	while (1) {
			sleep_enable();
			sei();
			sleep_cpu();
			sleep_disable();
	}
}

 

P.S. Everything works as it should, only goal left is to get power consumption below 40 uA.

This topic has a solution.

Last Edited: Thu. Oct 17, 2019 - 11:10 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

could you please post the CLK settings for your program. I suppose after you do the sleep_cpu(); you should switch the from the ULP32 to main clock. however if you are sleeping the switching to ULP32 is done automatically..but it would be clear to see the main clock settings first...

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You think this will matter? PIT is already running from ULP32KHZ and according to datasheet, MAIN clock is off by default in power down mode.

 

Clock control register:

 

	ccp_write_io((void *)&(CLKCTRL.MCLKCTRLB),
	             CLKCTRL_PDIV_48X_gc /* 48 */
	                 | 1 << CLKCTRL_PEN_bp /* Prescaler enable: enabled */);

 

And clocks settings from atmel start utility:

 

Last Edited: Mon. Oct 14, 2019 - 08:41 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, so during wakeup you are running the CPU at 416 KHz, this could be quite slow and consumes more energy if you are also running USART +....maybe other peripherals. bottom point, during wakeup, try to make your operations more faster this means its better if you run the CPU at 6 or 5 MHz during wakeup, and during sleep you could activate the ULP32 in a sleep control function"if you are using START", it should be somthing like this:

int8_t SLPCTRL_init()
{

	SLPCTRL.CTRLA = 1 << SLPCTRL_SEN_bp /* Sleep enable: enabled */
					| SLPCTRL_SMODE_PDOWN_gc; /* Standby Mode */

	return 0;
}

and for the clkctrl, you should do something like this:

 

ccp_write_io((void *)&(CLKCTRL.OSC32KCTRLA), 1 << CLKCTRL_RUNSTDBY_bp );

give it a try and report back...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

small note:

 

you must wait for system oscillator change to finish, somthing like this at the end of your clock function would do the job:

 

while (CLKCTRL.MCLKSTATUS & CLKCTRL_SOSC_bm) {}

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for your suggestion, i used your tip and wakeup consumption is lower in total and also faster (i went with 5MHz), but that is negligent in my case since wake up will only happen once per hour in real application. My problem is that i need to lower my "power down" mode consumption. I dont use stanby mode and in power down mode, the internal oscilator is disabled anyway and only the OSCULP32K is running. At least this is what should happen accordign to datasheet of mega 0 series. You think that the 20MHz internal oscillator might still be running, even after i enter power down mode?  In datasheet it says the OSC20M  has 130uA consumption at 1 MHz speed, so mine runnign at 416.667 prescaler, might be the cause of high current. You think i should force the OSC20M to stop running?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Am not quite sure what you mean by 416 because I thought you are using now 5MHz and you said the power consumption is lower.

 

my point was...

 

During wakeup:

Dont use 416KHz as a clock, this makes the CPU slower and you will consumer more energy to run your HW peripherals and so on, for example; and maybe its not relevant here...to run ADC, you need to have atleast 4-5 MHz as the conversion and the whole process needs this, otherwise the peripheral may behave weird and you will have high power consumption and lower efficiency. so I would suppose the USART peripheral is also consuming higher power "I dont know how much?" at this "416 KHz".

 

During sleep mode:

 

and allow me to correct it up in my #4, the comment in the code is wrong but the function is enabling the power down mode

int8_t SLPCTRL_init()
{

	SLPCTRL.CTRLA = 1 << SLPCTRL_SEN_bp /* Sleep enable: enabled */
					| SLPCTRL_SMODE_PDOWN_gc; // PW down mode

	return 0;
}

the waking up from sleep, consumes also some power. you have to check this with the oscilloscope and how much time does it require, it would be nice if we can see your HW setup. thats why while loop is necessary to wait for changing clock sources:

 

while (CLKCTRL.MCLKSTATUS & CLKCTRL_SOSC_bm) {}

In every case, I see that 100uA is quite reasonable consumption as it also depends on you HW, PCB shielding...grounding and so on. for this I cant give you an answer as I havent seen your HW setup.

Last Edited: Mon. Oct 14, 2019 - 01:08 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When i change to 5MHz the total consumption is lower, by only by a fraction, since the MCU is in power down 99% of time. Yes i checked all peripheals demands that i use (only uart and rtc) and 416.667 KHz is more then enought. I would use 32KHz low power as my main clock, if UART would work with it, but sadly it wont :P 

 

Oh ok, i get it, i will add this to force the OSC20M to stop running. 

 

Below is my HW. HW

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

what is your configuration for unused pins ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Moe beat me to it, but any unused (floating) pin must have a defined state, either make them outputs, or enable the internal pull up on any unused pin.

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And also PCB design:

PCB

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1- Disable all peripherals, in AVR-0 and AVR-1 all peripherals are enabled after reset, that means its floting. every ununsed pin must be disabled.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok i will also set all unused pins to outputs. Will implement all corrections and post results tonight or tomorrow morning.

Last Edited: Mon. Oct 14, 2019 - 01:51 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:

Moe beat me to it, but any unused (floating) pin must have a defined state, either make them outputs, or enable the internal pull up on any unused pin.

 

Jim

 

 

Jim ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Setting them to Output has been the norm, however, in the datasheet of these new tinys its suggested to disable them with pull-up configured as Jim suggested, from what I've seen this is done like this:

 

void mcu_init(void)
{

	for (uint8_t i = 0; i < 8; i++) {
		*((uint8_t *)&PORTA + 0x10 + i) |= 1 << PORT_PULLUPEN_bp;
	}

	for (uint8_t i = 0; i < 8; i++) {
		*((uint8_t *)&PORTB + 0x10 + i) |= 1 << PORT_PULLUPEN_bp;
	}
} //this is for an ATtiny214, 14 pins

I would suppose the concept goes to Atmega3209, you just need to add the missing pins PORTC...if existed.

 

To say the truth, from my experience i didnt needed to enable the port pull-up, as I noticed it consumes a little bit more power...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I tried all unused pins as output, current draw was 124 uA, tried all as input 120 uA, with all inputs with pull up enabled was 230 uA, so i loaded my basic configuration with unconfigured pins and was back to 115 to 116 uA. Also check power down and clock settings, they are all just as Moe posted.  

 

#include <slpctrl.h>

/**
 * \brief Initialize Sleep Controller
 *
 * \return Initialization status.
 */
int8_t SLPCTRL_init()
{

	SLPCTRL.CTRLA = 1 << SLPCTRL_SEN_bp       /* Sleep enable: enabled */
	                | SLPCTRL_SMODE_PDOWN_gc; /* Power-down Mode */

	return 0;
}

 

Soooo, what else could it be? :D

Could it be that this is lowest consumption i can achieve on Atmegas3209?

 

Last Edited: Mon. Oct 14, 2019 - 02:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

d

Last Edited: Mon. Oct 14, 2019 - 02:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hummmm,....put the clear interrupt flag cli(); before you enable the sleep, something like this:

 

	cli();
	sleep_enable();
	sei();
	sleep_cpu();
	//switch to main clock
	................

so delete the cli() from your ISR

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You may need to contact MC support and ask the question, how they setup the MPU to get the data sheet values posted.

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your program flow should be something like this:

 


void switch_back_to_main_clock()
{
	ccp_write_io((void *)&(CLKCTRL.MCLKCTRLA), CLKCTRL_CLKSEL_OSC20M_gc | 1 << CLKCTRL_CLKOUT_bp );
	ccp_write_io((void *)&(CLKCTRL.MCLKCTRLB),
	CLKCTRL_PDIV_4X_gc //your prescaler...48..or whatever
	| 1 << CLKCTRL_PEN_bp ); //enable your prescaler
}




int main(void)
{
    common_init(); //here initialize all you GPIO's,CLKCTRL, RTC, SLPCTRL, USART
    while(1){
        //here what you want your program to do
        do_something();
        cli();
        sleep_enable();
        sei();
        sleep_cpu();
        switch_back_to_main_clock();
    }
}

try to follow this and adjust this program to your needs (Prescaler...etc), also could you post you RTC initiaization function

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Klemko wrote:

d

 

why you are deleting the information, it might help someone in the future...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Moe123 wrote:
why you are deleting the information, it might help someone in the future...
Moe123 wrote:

Klemko wrote:

d

 

why you are deleting the information, it might help someone in the future...

 

It was wrong information.

 

 

Ok, Moe, i will modify the program flow as you suggested and also contact MC about their posted consumption numbers. 

Below is RTC (PIT) initialization code:

int8_t RTC_0_init()
{

	while (RTC.STATUS > 0) { /* Wait for all register to be synchronized */
	}

	// RTC.CMP = 0x0; /* Compare: 0x0 */

	// RTC.CNT = 0x0; /* Counter: 0x0 */

	RTC.CTRLA = RTC_PRESCALER_DIV32_gc  /* 32 */
	            | 0 << RTC_RTCEN_bp     /* Enable: disabled */
	            | 0 << RTC_RUNSTDBY_bp; /* Run In Standby: disabled */

	// RTC.PER = 0xffff; /* Period: 0xffff */

	// RTC.CLKSEL = RTC_CLKSEL_INT32K_gc; /* 32KHz Internal Ultra Low Power Oscillator (OSCULP32K) */

	// RTC.DBGCTRL = 0 << RTC_DBGRUN_bp; /* Run in debug: disabled */

	// RTC.INTCTRL = 0 << RTC_CMP_bp /* Compare Match Interrupt enable: disabled */
	//		 | 0 << RTC_OVF_bp; /* Overflow Interrupt enable: disabled */

	while (RTC.PITSTATUS > 0) { /* Wait for all register to be synchronized */
	}

	RTC.PITCTRLA = RTC_PERIOD_CYC32768_gc /* RTC Clock Cycles 32768 */
	               | 1 << RTC_PITEN_bp;   /* Enable: enabled */

	// RTC.PITDBGCTRL = 0 << RTC_DBGRUN_bp; /* Run in debug: disabled */

	RTC.PITINTCTRL = 1 << RTC_PI_bp; /* Periodic Interrupt: enabled */

	return 0;
}

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Klemko wrote:

 

 

#include <atmel_start.h>
#include <util/delay.h>
#include <funkcije.h>
#include <avr/sleep.h>
#include <avr/interrupt.h>

//F_CPU = 416.667 kHZ

uint32_t counter = 20;
uint32_t timer = 0;

ISR(RTC_PIT_vect)
{
	cli();
	timer++;
	if(timer>120){//2minute send out interval for faster testing
		usart_send_int(counter);
		counter=0;
	}
	RTC.PITINTFLAGS = RTC_PI_bm;
	sei();
}

int main(void)
{
	atmel_start_init();
	_delay_ms(1000);

	sei();
	while (1) {
			sleep_enable();
			sei();
			sleep_cpu();
			sleep_disable();
	}
}

 

 

Re-order your ISR, take away the cli() and sei(). mostly important make the shared variables between ISR and main as volatile.

in your ISR, put first the:

RTC.PITINTFLAGS = RTC_PI_bm;

where are you defining the F_CPU ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In clock_config.h

 

/* Auto-generated config file clock_config.h */
#ifndef CLOCK_CONFIG_H
#define CLOCK_CONFIG_H

// <<< Use Configuration Wizard in Context Menu >>>

#ifndef F_CPU
#define F_CPU 5000000
#endif
// <h> USART Clock Settings
// <y> USART Clock source
// <CLK_MAIN"> Main Clock (CLK_MAIN)
// <i> This defines the clock source for the USART module
// <id> usart_clock_source
#define CONF_USART_SRC CLK_MAIN

// </h>

// <<< end of configuration section >>>

#endif // CLOCK_CONFIG_H

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Klemko wrote:

In clock_config.h

 

/* Auto-generated config file clock_config.h */
#ifndef CLOCK_CONFIG_H
#define CLOCK_CONFIG_H

// <<< Use Configuration Wizard in Context Menu >>>

#ifndef F_CPU
#define F_CPU 5000000
#endif
// <h> USART Clock Settings
// <y> USART Clock source
// <CLK_MAIN"> Main Clock (CLK_MAIN)
// <i> This defines the clock source for the USART module
// <id> usart_clock_source
#define CONF_USART_SRC CLK_MAIN

// </h>

// <<< end of configuration section >>>

#endif // CLOCK_CONFIG_H

 

 

Wrong!. #define F_CPU doesnt set the clock the MCU,its just a way to tell the chip what frequency you are running, so if you are running your chip at 416KHz then you should set according to this...if you are running it at 5 MHz then it should be 5 MHz.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am running at 5MHz since you commented about wake rutine being faster. I left project running over night and it did have 4% lower total power consumption then when running on 416 KHz. It may sound small change, but on long run it has an impact :D 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wrote to Microchip what is the lowest power consumption the atmega3209 i can achive in power down mode. Now lets hope for fast answer. I also ordered the Atmega4809 xplained board to also test power down current there, to see if there is any difference. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Klemko wrote:

I am running at 5MHz since you commented about wake rutine being faster. I left project running over night and it did have 4% lower total power consumption then when running on 416 KHz. It may sound small change, but on long run it has an impact :D 

 

but in your clock setting you are using a prescaler of 48 right ? then how come you are getting 5 MHz ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, the prescaler is at 4 now.

 

ccp_write_io((void *)&(CLKCTRL.MCLKCTRLB),
	             CLKCTRL_PDIV_4X_gc /* 4 */
	                 | 1 << CLKCTRL_PEN_bp /* Prescaler enable: enabled */);

 

Last Edited: Tue. Oct 15, 2019 - 07:39 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, so one question...sounds stupid....but how are you measuring your power consumption ? what is your setup to measure it ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With multimeter, Voltcraft VC850, at 000.0 uA resolution.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

well I would not measure it with a multimeter, I suppose you are also making the average calculation and so on, but this is not accurate. "best" way is to use an osci with a series resistor...10ohm/20 ohm, in that case you can also see exactly what is happening during power down and sleep mode and you can be sure if your chip is going to sleep or if there is a weird behaviour.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, i have some 10 Ohms SMD 0.1% shunt resistors from another project, will solder that one and check with scope and let you know results in half an hour or so. Actually ill solder 3 or 5 in series to get little better voltage response, so aroudn 30-50 Ohms.

Last Edited: Tue. Oct 15, 2019 - 07:57 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok measurements done, got pretty much same measurement via shunt with a scope, measured with 10, 30 and 50 Ohm shunt, 108,6/108,4/108,4 uA, so my multimeter is 10 uA off the real value. 

Below are couple of screens from scope:

-1s PIT timer

1s PIT timer

 

-Transition (10.2 Ohm shunt) from ACTIVE(26,8 mV) to power down mode(1,16 mV) :

active to PDN

 

Signal is a bit hairy since i removed all the bypass capacitors and ferite beads to avoid any parasitic current flow when measuring. Power source is 3.6V, 14500 mAh battery(ER34615M).

Last Edited: Tue. Oct 15, 2019 - 08:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Klemko wrote:

I wrote to Microchip what is the lowest power consumption the atmega3209 i can achive in power down mode. Now lets hope for fast answer. I also ordered the Atmega4809 xplained board to also test power down current there, to see if there is any difference. 

Aren't they simply going to send you back a copy of this that you already have??

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cliff, Could this make sense ?  3.6V@ 25 C the power consumption is less that 1uA ?!. how is this possible...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I had time to measure the current consumption.
My target device is mega3208 and below is the circuit.

The following code toggles loop and sleep approximately every 2 seconds with a PIT interrupt.

#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/sleep.h>
#include <avr/cpufunc.h>
#include <stdbool.h>

volatile bool flg;

////////////////////////////////////////////////////////////////
// FUSE
////////////////////////////////////////////////////////////////
FUSES = {
    .WDTCFG     = FUSE_WDTCFG_DEFAULT,
    .BODCFG     = FUSE_BODCFG_DEFAULT,
    .OSCCFG     = FUSE_OSCCFG_DEFAULT,
    .SYSCFG0    = FUSE_SYSCFG0_DEFAULT,
    .SYSCFG1    = FUSE_SYSCFG1_DEFAULT,
};


////////////////////////////////////////////////////////////////
// INTERRUPT
////////////////////////////////////////////////////////////////
ISR(RTC_PIT_vect){
    flg = !flg;
    RTC.PITINTFLAGS = RTC_PI_bm;
}

////////////////////////////////////////////////////////////////
// MAIN
////////////////////////////////////////////////////////////////
int main(void){
    // CLOCK
    _PROTECTED_WRITE(CLKCTRL.MCLKCTRLA,!CLKCTRL_CLKOUT_bm | CLKCTRL_CLKSEL_OSCULP32K_gc);
    _PROTECTED_WRITE(CLKCTRL.MCLKCTRLB, !CLKCTRL_PEN_bm);

    // PORT
    PORTA.PIN0CTRL = 
    PORTA.PIN1CTRL = 
    PORTA.PIN2CTRL = 
    PORTA.PIN4CTRL = 
    PORTA.PIN5CTRL = 
    PORTA.PIN6CTRL = 
    PORTA.PIN7CTRL = 
    PORTC.PIN0CTRL = 
    PORTC.PIN1CTRL = 
    PORTC.PIN2CTRL = 
    PORTC.PIN3CTRL = 
    PORTD.PIN0CTRL = 
    PORTD.PIN1CTRL = 
    PORTD.PIN2CTRL = 
    PORTD.PIN3CTRL = 
    PORTD.PIN4CTRL = 
    PORTD.PIN5CTRL = 
    PORTD.PIN6CTRL = 
    PORTD.PIN7CTRL = 
    PORTF.PIN0CTRL = 
    PORTF.PIN1CTRL = 
    PORTF.PIN2CTRL = 
    PORTF.PIN3CTRL = 
    PORTF.PIN4CTRL = 
    PORTF.PIN5CTRL = 
    PORTF.PIN6CTRL = PORT_ISC_INPUT_DISABLE_gc;

    // PIT
    RTC.CLKSEL = RTC_CLKSEL_INT1K_gc;
    RTC.PITINTCTRL = RTC_PI_bm;
    RTC.PITCTRLA = RTC_PERIOD_CYC2048_gc | RTC_PITEN_bm;
    
    // SLEEP MODE
    SLPCTRL.CTRLA = SLPCTRL_SMODE_PDOWN_gc;

    // LOOP
    sei();
    while(1){
        while (flg);
        cli();
        sleep_enable();
        sei();
        sleep_cpu();
        sleep_disable();
        _NOP();
    }
}

 

The following is the waveform.

 

About 3.2V was applied to PS, and after initializing, SW was turned off and the voltage across 47k(5%) was observed with an oscilloscope.

Here is the result:
Active loop: 488mV = 10.4uA (VCC = 2.712V)
Sleep: 130mV = 2.77uA (VCC = 3.07V)

The current values and calculation results extracted from the data sheet are as follows.
RTC = 1.2uA
OSCULP32K = 0.4
CPU_ACT = 9.0uA(32KHz 3V)
CPU_PDOWN = 0.1uA

 

Active loop: 1.2 + 0.4 + 9.0 = 10.6uA
Sleep: 1.2 + 0.4 + 0.1 = 1.7uA

 

The value at the time of sleep doesn't suit too much. Please forgive me because it is a sloppy measurement.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kaba thanks a loooot for your work. Now i see something must be wrong with my code. I will write my program again, but this time without atmel start configurator and i hope that fixes it.  Because i bough a DIP atmega4809, loaded same software on it then one on my project and got same 115 uA current dray at 3.3V. Soooo, only think left to ditch is atmel start. I will also load your code to my project to see if there is any difference.

 

Thanks again for all of your hard work :D 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you dont mind guys, I will link this to my thread about getting started with 0&1 series...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Remember to remove the debugger when measuring current consumption.
The current flowing into the UPDI VTG is not small.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, NOW i am completely lost. 10 min ago i received my 4809 Xplained Pro board and i am measuring current on the VCC-TARGET to VCC-MCU jumper and with my Software in sleep mode is 1.5 uA and when UART activates and starts, its aroudn 400 uA and then straight back to around 1.5 uA. Soooo now it looks like it has to be wiring error on my HW. 

I actually connected all my project periphery stuff to the Xplained board and system runs perfectly with under 2uA current in sleep mode

Last Edited: Thu. Oct 17, 2019 - 08:54 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kabasan wrote:

Remember to remove the debugger when measuring current consumption.
The current flowing into the UPDI VTG is not small.

+1

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes i noticed that instantly. When Atmel ICE is connected it draws around 100 uA. But now if same software on my PCB draws 115 uA in Power down mode and 2 uA on Xplained board, im 100% sure it is wiring issue. Only difference is i run Atmega3209 on my PCB and Xplained has 4809, which are same MCUS with different flash size. 

Last Edited: Thu. Oct 17, 2019 - 09:06 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok now i did same circuit i have on my PCB on breadboard and DIP Atmega4809 and it works perfectly with below 2uA current draw in Power down mode. Could it be that my Atmega3209s are defective? Or if they were damaged at PCB assembly process?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, I would start with analyzing your PCB circuit concept...look for your HW, start removing part by part parallel to testing it

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok i fixed it. I unsodlered Atmega3209 and sodlerend on another one from different order(there was like 1 week apart between orders) and consumption was same. Now i removed the second one and soldered on Atmega4809 and the consumption is 1.3-2uA in Power down mode!!!!!!!!!   Thanks a LOT to kabasan for showing me actual consumption i should be getting and to Moe who helped to improved my basic PCB design and software with other tips smiley  If you guys ever visit Ljubljana, drinks on me cheeky

 

I still dont know why the  megas 3209 have such high consumption, i just ordered 5 more and will solder them on tomorrow on same PCBs, just out of curiosity , to see if there is something wrong with the ones i have in stock or there is some other general fault. I will stick with 4809 for the project, since is only like 5 cent pricier. It does hurt throwing 2 days of work away because of this, but i am just happy im done with it smiley

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Very happy you fixed your problem, one last thing, maybe in the next design its better if you take a look at your PCB.

 

- Decoupling caps, are a little bit far from the mcu.

- Traces for V+make it a little bit bigger.

- I think you are using two layers PCB, so it would be nice if you added a GND top layer by adding via over the PCB "stitches"....its done easily in KiCAD and altium...

- Try to bring all the signal traces closer to each other...

- although its not critical in your application, but it would be nice if you inform yourself a little bit about EMC/EMI, noise and so on.

- for caps, you can use 0603 / X7R instead of 0805 (your caps looks like 0805 for me...dont know)

 

good luck with your project!

Moe

Last Edited: Thu. Oct 17, 2019 - 11:30 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 or there is some other general fault.

If it were me I'd open a support ticket with Microchip (they may read this thread but don't rely on it). You may have found a fundamental flaw in 3209 that is not evident in 4809.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

- Decoupling caps, are a little bit far from the mcu. - will move them closer.

- Traces for V+make it a little bit bigger.  -You mean wider, right? Will do.

- I think you are using two layers PCB, so it would be nice if you added a GND top layer by adding via over the PCB "stitches"....its done easily in KiCAD and altium... -You mean like GND copper pour in empty places?

- Try to bring all the signal traces closer to each other...      -Will do.

- although its not critical in your application, but it would be nice if you inform yourself a little bit about EMC/EMI, noise and so on.    -This is a BIIIIG subject, i have a lot of literature about this topic to go through. Last month i finished a project with wifi, 48MHz M0+, analog and had some problems passing EMI tests whe ncertifying final PCB, i just stuck a metal EMI case over whole PCb and taht was that :P  

- for caps, you can use 0603 / X7R instead of 0805 (your caps looks like 0805 for me...dont know) -they are all 0603.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

update: today i soldered on new atmegas3209 i just received aaaand they work just fine at below 2 uA. So i guess the ones i have in stock must have gotten damaged at one point in time from a ESD or something similar..