View previous topic :: View next topic |
Author |
Message |
hg7kaz
Joined: 15 Aug 2007 Posts: 9
|
Posted: Fri Feb 06, 2015 11:49 am Post subject: High current in powerdown mode. Why? |
|
|
Hello!
I built a simple circuit. The processor is an Atmega328P, internal 8MHz oscillator divided by 8. An CR2032 Li battery gives the supply voltage.
I want to try the power reduction and the powerdown mode with a battery.
The code is:
Code: |
$regfile = "m328pdef.dat"
$crystal = 1000000
$hwstack = 32
$swstack = 16
$framesize = 24
wait 3 ' I = 3,08mA
' -----------------------------------
' Switch OFF the Analog Comparator
set acsr.acd
set didr1.ain1d
set didr1.ain0d
' Switch OFF the Voltage Reference
reset admux.refs1
reset admux.refs0
' Switch OFF the ADC
reset adcsra.aden
' Switch OFF all blocks
PRR = &B111101111
' -----------------------------------
wait 3 ' I = 2,88mA -> it's too high!
' -----------------------------------
Config Powermode = powerdown
' I = 2,33mA
'much smaller current uptake was written at this in the data sheet (((
End
|
When the processor is in the powerdown mode, the current for much smaller one should be at it what I measured.
Is something missing from the program?
Thank you for the help!
(BASCOM-AVR version : 2.0.7.8 ) |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Fri Feb 06, 2015 1:29 pm Post subject: |
|
|
The code is ok, it does what it should.
Power consumption for powerdown is too high, which is likely a hardware issue. How the current is measured, with or without connected ISP?
A schema would help.
One soft-issue is thinkable, in case the WDTON-fuse is programmed. Then the watchdog-reset repeatedly calls the µC from sleep.
This can be fixed by un-programming the WDTON fuse. |
|
Back to top |
|
|
hg7kaz
Joined: 15 Aug 2007 Posts: 9
|
Posted: Fri Feb 06, 2015 2:06 pm Post subject: |
|
|
MWS wrote: | The code is ok, it does what it should.
Power consumption for powerdown is too high, which is likely a hardware issue. How the current is measured, with or without connected ISP?
A schema would help.
One soft-issue is thinkable, in case the WDTON-fuse is programmed. Then the watchdog-reset repeatedly calls the µC from sleep.
This can be fixed by un-programming the WDTON fuse. |
I want to use the watchdog later.
I disconnect the ISP always after programming the code.
The circuit is very-very simple: 2x3 pin header for the ISP, two decoupling capacitor (100n on the reset and VCC pins), the battery holder, the 328p, and an unused led with resistor for test. The +3V connected the VCC, and AVCC+AREF pins and the reset pin via pull-up resistor (4,7k).
The meters:
- digital Uni-T UT71C,
- analog Tesla BM-518.
I tried out an other electronic circuit meanwhile, the one in which there is an Atxmega256A3U, but I measured high value there again in powerdown mode (~500uA).
I checked both instruments, they are properly. |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Fri Feb 06, 2015 2:52 pm Post subject: |
|
|
hg7kaz wrote: | I want to use the watchdog later. |
That's fine, but does this actually say, that the watchdog fuse is un-programmed = 1 by now?
Quote: | an unused led with resistor for test. |
You do not enable any ports or pullups, so this is no issue.
I would enable the led, blink for 1 second and disable it then, this shows you cyclic resets.
Quote: | The +3V connected the VCC, and AVCC+AREF pins and the reset pin via pull-up resistor (4,7k). |
How about brown out?
Show pictures of your circuit and a screen shot of the fuses, as said, the code is ok, |
|
Back to top |
|
|
hg7kaz
Joined: 15 Aug 2007 Posts: 9
|
Posted: Fri Feb 06, 2015 3:10 pm Post subject: |
|
|
MWS wrote: | the code is ok, |
Quiet strange, that works rewriting the program perfectly on a M1284P, which is just like this in a simple circuit, yes. The current was 130nA! The DMM can't measure it, only the Tesla laboratory meter.
It occurred already early that there was a mistake in a Bascom version, something similar happened now possibly.
I revise the pcb thoroughly whatever, something escaped my attention maybe. |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Fri Feb 06, 2015 3:21 pm Post subject: |
|
|
hg7kaz wrote: | It occurred already early that there was a mistake in a Bascom version, something similar happened now possibly. |
I've checked the created code on ASM level, it shows to be ok. |
|
Back to top |
|
|
hg7kaz
Joined: 15 Aug 2007 Posts: 9
|
Posted: Fri Feb 06, 2015 3:30 pm Post subject: |
|
|
MWS wrote: | hg7kaz wrote: | It occurred already early that there was a mistake in a Bascom version, something similar happened now possibly. |
I've checked the created code on ASM level, it shows to be ok. |
Thank You!
The error will be on the panel then. I hope. |
|
Back to top |
|
|
Evert :-)
Joined: 18 Feb 2005 Posts: 2156
|
Posted: Thu Feb 12, 2015 8:29 pm Post subject: |
|
|
Disable the BOD fuse, is drains much power.
Some more tips;
Code: |
'=== Setup for low power mode ===
Config Portb = Input 'to Reduce Power , Setup All Pins As Inputs With No Pullups
Config Portd = Input
Config Portc = Input
Adcsra.aden = 0 'Disable a/d convertor
Acsr.acd = 1 'Disabel analog comperator
Didr0 = &H3F 'Disable digital input buffers on all ADC0-ADC5 pins
Didr1.ain0d = 1 'Disable digital input buffer on AIN1/0
Didr1.ain1d = 1
Config Adc = Single , Prescaler = Auto , Reference = Internal_1.1
Stop Adc
Prr.pradc = 1 'Power adc disable
Prr.prspi = 0 'Power spi disable
Prr.prtim0 = 1 'Power timer0 disable
Prr.prtim1 = 1 'Power timer1 disable
Prr.prtwi = 0 'Power twi
Prr.prusart0 = 0 'Power Usart0
|
Nice tutorial https://www.sparkfun.com/tutorials/309
You don't have a main loop, try this:
Code: |
do
Config Powermode = powerdown
loop
End
|
_________________ www.evertdekker.com Bascom code vault
Last edited by Evert :-) on Fri Feb 13, 2015 12:03 am; edited 2 times in total |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Thu Feb 12, 2015 9:00 pm Post subject: |
|
|
Evert wrote: | Disable the BOD fuse, is drains much power. |
According data sheet at 3V/25° the brownout takes 18µA. You consider that as "much power"?
The TO's issue is much different:
Considered that, 18µA is in the range of measurement uncertainty. |
|
Back to top |
|
|
Evert :-)
Joined: 18 Feb 2005 Posts: 2156
|
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Thu Feb 12, 2015 10:42 pm Post subject: |
|
|
Evert wrote: | if you want the poweruse back to 1,5µA then 18µA is MUCH. |
The TO looks for a whooping 2330µA and if BOD should be "much" in this context, I simply would expect a bit more than these few µA's.
In other words: what sense does it make to suggest the use of better streamlined wipers, if the car has to pull against an activated hand brake? |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Fri Feb 13, 2015 12:40 am Post subject: |
|
|
I have had 100nF bypass caps go leaky and pass several mA, also very temperature dependent.
Suggest try removing them and measure the current.
Better is to take a fresh board, install everything EXCEPT the processor and measure the current. Then install the processor and see the change. That way you know the board itself is not the problem. _________________ Adrian Jansen
Computer language is a framework for creativity |
|
Back to top |
|
|
|