ATtiny1624: 140uA in SLEEP_MODE_PWR_DOWN #502
Replies: 17 comments 12 replies
-
#include <avr/power.h> and all macros in it which you call all have no effect on any modern AVR. If you work your way through power.h, you'll see that everything in the body of hte macros is all #ifdef''ed out. I haven't explored sleep on these parts yet, too many higher priorities but take a look through the spec'ed expectatioins for current consumption. specifically the peripherals. ADC sucks 260uA at 1MHz, and megaTinyCore clocks it at around 2.5x that, so it's not the ADC, it'd be over half a mA if it was that! The oscillator is right about in the right ballpark, except it definitely sholdn't be on in power down sleep mode.... OH!! Did you program it over UPDI? Try giving it a full cold powercycle (like, disconnect suppply, and then short vcc and ground together. then reconnect power (after removing the short obviously - that step is because sometimes capacitors retain just enough charge to prevent a clean restart on what seems like you'd be powercycling something. If UPDI doesn't properly get disabled after programming it won't let the oscillator shut off. I didn't look at that here because I assumed that was handled correctly by Microchips PyMCUProg code that we started from. |
Beta Was this translation helpful? Give feedback.
-
I found the problem. |
Beta Was this translation helpful? Give feedback.
-
I tried this, it appears to run as a simple blink, no idea how to measure draw in the microamps range. Do I need one of these, or is there a better option?
|
Beta Was this translation helpful? Give feedback.
-
If you compile both versions and compare the .lst files (mine is at C:\Users\w10\AppData\Local\Temp\arduino_build_393584/test.ino.lst) The setup/loop .lst file has a bunch of extra code (from wiring.c?), where it looks like ADC, interrupts and timers are being configured? This code is missing from the main() .lst file.
|
Beta Was this translation helpful? Give feedback.
-
Look at this: #143 (comment) try adding
|
Beta Was this translation helpful? Give feedback.
-
@MagSem Can you try adding this to your setup/loop version to disable all the things being enabled, and measure the current?
|
Beta Was this translation helpful? Give feedback.
-
As expected, this is a new ADC. Thanks for not making me look for this in the manual, @mechatroniks ) @SpenceKonde, оf course, you, as the author, are free to make the kernel as you see fit (performance optimization, clarity and convenience for Arduino users, etc.), I just wanted to figure out if I could use this chip for my projects. Regards, |
Beta Was this translation helpful? Give feedback.
-
Bey specifically it's the low lat mode
…____________
Spence Konde
Azzy’S Electronics
New products! Check them out at tindie.com/stores/DrAzzy
GitHub: github.com/SpenceKonde
ATTinyCore: Arduino support for almost every ATTiny microcontroller
Contact: ***@***.***
On Mon, Aug 23, 2021, 12:58 Mechatroniks ***@***.***> wrote:
Thanks for looking into this @MagSem <https://github.com/MagSem>, good to
know the ADC is the culprit and a quick fix.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#502 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTXEW6UO52KS2JWQCOH4F3T6J42ZANCNFSM5CJEM4FQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
.
|
Beta Was this translation helpful? Give feedback.
-
Some study like this will be highly appreciated on this page using information on methods from new ATTINYs to shed some more light. |
Beta Was this translation helpful? Give feedback.
-
Any study of sleep modes and power consumption goes under the purview of
#158, which I don't see happening for a few months; I need to get a patch
for some super critical issues out for DxCore so that I can get to work
ASAP getting ATTinyCore 2.0.0 out because a paying client needs that one
for during the upcoming school year. (words cannot describe how badly I
want to be able to declare ATTinyCore "maintenance only" so I can focus on
the new stuff. But like 90% of the work over there is done. Only once
that's done can I puit serious time into understanding the sleep and power
consumption behavior of tje modern AVR parts.(I recognize that
there's massive demand for it, but there's a critical bug on DxCore and a
paying client who needs the tiny26 support on ATTinyCore which is mostly
done but in the infrastructure iof 2.0.0 which currently doesn't have a a
boards.txt file (I think the only way to make that core viable (and really
all these cores, moving forward) is to stop with the hand edited boards.txt
- that is a huge loser and has caused more bugs than any other single area
of the dcore. and so is completely unusable and untestable. I mean hell,
One of the things I need to fix in this week's panic 2.4.1 release
isthat while playing with something else, I realized I'd botched a clock
speed menu entry. Have you ever looked at boards.txt? It is a nightmare
format. I don't think I could design a format more difficult to hand edit
without introducing bugs than the boards.txt format is if I tried to do so.
…On Tue, Aug 24, 2021 at 4:12 AM Saurabh Datta ***@***.***> wrote:
Some study like this <http://www.gammon.com.au/power> will be highly
appreciated on this page
<https://github.com/SpenceKonde/megaTinyCore/blob/master/megaavr/extras/PowerSave.md>
using information on methods from new ATTINYs to shed some more light.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#502 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTXEW2GVCTSV35Z7EUHL4DT6NH7LANCNFSM5CJEM4FQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
.
--
____________
Spence Konde
Azzy’S Electronics
New products! Check them out at tindie.com/stores/DrAzzy
GitHub: github.com/SpenceKonde
ATTinyCore <https://github.com/SpenceKonde/ATTinyCore>: Arduino support for
all pre-2016 tinyAVR with >2k flash!
megaTinyCore <https://github.com/SpenceKonde/megaTinyCore>: Arduino support
for all post-2016 tinyAVR parts!
DxCore <https://github.com/SpenceKonde/DxCore>: Arduino support for the AVR
Dx-series parts, the latest and greatest from Microchip!
Contact: ***@***.***
|
Beta Was this translation helpful? Give feedback.
-
Oh good lord I don;'t want the Arduino team to do anything about this! Please! Those guys have a reverse midas touch! |
Beta Was this translation helpful? Give feedback.
-
I have more information than my last reply,. On the 2-series parts, the ADC
should be turned off before entering powerdown sleep (because we have to
keep lowlat mode on to work around serious errata) this costs just about
130 uA (similar to how classic AVR ADC burned 200uA at all times including
sleep if not disabled.
Disable the ADC. In 1.5.12, you can do that with analogPowerOptions(), but
that's not implemented in 1.5.11, the current released version, 1.5.12 is
almost released though
I think SerialUPDI automatically disables UPDI when it closes the
connection.
…On Tue, Jul 26, 2022 at 5:01 PM Mechatroniks ***@***.***> wrote:
Did you program it over UPDI? Try giving it a full cold powercycle (like,
disconnect suppply, and then short vcc and ground together. then reconnect
power (after removing the short obviously - that step is because sometimes
capacitors retain just enough charge to prevent a clean restart on what
seems like you'd be powercycling something. If UPDI doesn't properly get
disabled after programming it won't let the oscillator shut off. I didn't
look at that here because I assumed that was handled correctly by
Microchips PyMCUProg code that we started from.
Is there a UPDI command we can send to disable, or do I write a 1 to the
UPDIDIS bit on UPDI.CTRLB on bootup?
Any programming or debugging session that does not require any specific operation from the UPDI after
disconnecting the programmer has to be terminated by writing the UPDI Disable (UPDIDIS) bit in the Control B
(UPDI.CTRLB) register, upon which the UPDI will issue a System Reset and disable itself. The Reset will restore the
CPU to the Run state, independent of the previous state. It will also lower the UPDI clock request to the system and
reset any UPDI KEYs and settings.
If the disable operation is not performed, the UPDI and the oscillator’s request will remain enabled. This causes
increased power consumption for the application.
Bit 2 – UPDIDIS UPDI Disable
Writing a ‘1’ to this bit disables the UPDI PHY interface. The clock request from the UPDI is lowered, and the UPDI is
reset. All the UPDI PHY configurations and keys will be reset when the UPDI is disabled.
—
Reply to this email directly, view it on GitHub
<#502 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTXEWZILUTIWTXA6IXAOODVWBG2DANCNFSM5CJEM4FQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
--
____________
Spence Konde
Azzy’S Electronics
New products! Check them out at tindie.com/stores/DrAzzy
GitHub: github.com/SpenceKonde
ATTinyCore <https://github.com/SpenceKonde/ATTinyCore>: Arduino support for
all pre-2016 tinyAVR with >2k flash!
megaTinyCore <https://github.com/SpenceKonde/megaTinyCore>: Arduino support
for all post-2016 tinyAVR parts!
DxCore <https://github.com/SpenceKonde/DxCore>: Arduino support for the AVR
Dx-series parts, the latest and greatest from Microchip!
Contact: ***@***.***
|
Beta Was this translation helpful? Give feedback.
-
Not sure if this is a bug in the comparator library or if this should be noted in the docs or if I just missed anything. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I'm calling I did a late-night firmware update without pulling the battery & shorting caps with a few boards, each board's battery died in about 10 days on all of them. I recharged, they have been holding at 100% battery for past 5 days. So I'm pretty sure it's the UPDI not disabling the oscillator. I'll try disabling with the register and report back. |
Beta Was this translation helpful? Give feedback.
-
The /avr/power.h library should not be used on modern AVRs it has not been updated. Alll of the macros amount to dd nothings, because none of the registers they test for exist on moden AVR. Don't use that library. Axtually I think iI can make it warn if power.h ia included... This adds some required features to he sleep and power fo sho (autooff+restore?) |
Beta Was this translation helpful? Give feedback.
-
Back to UPDIDIS - I was looking to test power draw, but not sure how to write this bit from my code. They are only readable from the UPDI programming interface. No mention on how to set it or if it's possible. Any tips on how to set this bit from my code? 31.5 Register Description
_It ain't my thing nor the authors' of pymcuprog either. I'd test if that's the issue by power off, short the caps, and power back up without UPDIing and see fi there's a difference_ |
Beta Was this translation helpful? Give feedback.
-
Just ran a test, my board draws 5uA in sleep after UPDI. Same if I power down and short the caps. The 5uA is leakage from the other circuits, which for my use is not an issue, the battery will self-discharge faster than 5uA drawdown will. |
Beta Was this translation helpful? Give feedback.
-
Hi.
I have read all issues, both open and closed.
I took a new chip ATtiny1624 (only a capacitor for power supply) and flashed a simple program.
#include <avr/sleep.h>
#include <avr/power.h>
void PORT_Init(void)
{
pinMode(PIN_PA0, INPUT_PULLUP);
pinMode(PIN_PA1, INPUT_PULLUP);
pinMode(PIN_PA2, INPUT_PULLUP);
pinMode(PIN_PA3, INPUT_PULLUP);
pinMode(PIN_PA4, INPUT_PULLUP);
pinMode(PIN_PA5, INPUT_PULLUP);
pinMode(PIN_PA6, INPUT_PULLUP);
pinMode(PIN_PA7, INPUT_PULLUP);
pinMode(PIN_PB0, INPUT_PULLUP);
pinMode(PIN_PB1, INPUT_PULLUP);
pinMode(PIN_PB2, INPUT_PULLUP);
pinMode(PIN_PB3, INPUT_PULLUP);
}
void setup()
{
PORT_Init();
power_all_disable();
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
}
void loop()
{
sleep_cpu();
}
The current consumption (1 MHz, 3 V, all off) was 140 μA.
I read that on chips of the first series, some people managed to achieve 100 nA, but in ATtiny1624 I could not get such a value.
Are there people who have reached 100 nA on chips of the second series?
Maybe the new ADC won't turn off?
Regards,
MagSem
Beta Was this translation helpful? Give feedback.
All reactions