Solved: U8G2 causes high power consumption while powerdown - Atmega 1284P

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

After hours of trying i figured out what the cause of the high power consumption is. But i dont have a glue how i can fix this.

 

When i put my power down routine after "u8g2.begin();" the current in power down mode is 100uA. But when i put this before, then it is down to 3uA.

 


	while(1){
		if(powerChangeRequest){
			makeTone(4400, 1000);
			delay(1000);
		}

		ADCSRA = 0;
		// close file BEFORE turning of mosfet!
		if(writeToSDCardEnable){
			file.write("EOF");
			file.close();

			Fat16::remove(ERROR_FILENAME); // remove error indicating file, if it was not already on the card, and thus writeToSdcardEnable was true.
		}

		DDRA = 0;
		DDRB = 0;
		DDRC = 0;
		DDRD = 0;

		PORTA = 0;
		PORTB = 0;
		PORTC = 0;
		//PORTD = 0;	//This disables pullups for button!!

		// wait for the butto to be released, or we might just power up after power down if it was held long, and then pressed shortly in sleep mode!
		while(BUTTON_2_IS_PRESSED);
		delay(10);
		powerChangeRequest = false;

		set_sleep_mode(SLEEP_MODE_PWR_DOWN);
		sleep_enable();

		// wait to get a least amount of millis since the last interrupt of button 2 (it might has been triggered just right before this method),
		// so it wont exit prematurely because of a too short time in between ( remember, millis() does not count while sleeping!)
		delay(100);

		cli();
		MCUCR = (1 << BODS) | (1 << BODSE); // turn on brown-out enable select
		MCUCR = (1 << BODS);        		// Disable Brown-out: this must be done within 4 clock cycles of above
		sei();  							// IMPORTANT: Interrupts must be enabled in order to wake up the Microcontrolller via interrupt!

		sleep_cpu();
		sleep_disable();  	// continues here after sleep ( interrupts are executed right away)

		// wait for bouncing interrupt button
		delay(5);
		while(BUTTON_2_IS_PRESSED){
			if(millis() - lastButton2Changed > 1000){
				powerChangeRequest = true;
				break;
			}
		}

		if(powerChangeRequest){
			// After power down, enable wachtdog and wait for it to reset device
			wdt_enable(0);
			while(1);
		}
	}

 

Yes i use Google, but there is no search enginge within Google to search through those many useless results...

Last Edited: Mon. Feb 11, 2019 - 11:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What display are you using? Maybe it is the display consuming the extra power.you might need to put the display into power down before sleeping.

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

I tried to put it to sleep but that doesnt work. I cut off the display Vcc anyway.

 

Omg i just found out that it really consumes power... but only if u8g2 has been initialized. There must be some inputs set for the display that cause this.

Yes i use Google, but there is no search enginge within Google to search through those many useless results...

Last Edited: Sun. Feb 10, 2019 - 03:55 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You must NOT cut off VCC.

 

How can an electronic chip go into 3-state or power-down if it does not have a power supply?

It will draw power from GPIO pins which is dangerous.

 

LCD and OLED consume very little current.

You can send a SLEEP command to most LCD, OLED, TFT controllers.

You can send a SLEEP command to AVR.

 

LED backlights on LCD or TFT consume BIG currents.

You can switch the backlight on or off on some display modules.

 

David.

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

Found the cause:

 

Some output pins were high.

Yes i use Google, but there is no search enginge within Google to search through those many useless results...