ATMEL ATTINY85 - How to switch clock to 128 kHz or less?

How to switch clock to 128 kHz or less? (target = minimum consumption).
I have Arduino IDE 1.8.2 + programmer with ATTINY44 + MPU TINY85.

http://www.ispshop.cz/index.php?main_page=product_info&cPath=78&products_id=647

I need to activate clock 128 kHz or less on ATTINY85 (or other mini ATMEL).
Is it possible to activate 128 kHz on this configuration?
Thank you for your help.
mpcz , 02.oct.2017

This would probably be a good way to start...

BJHenry: thanks, yes, that's beauty ...
In my IDE there is no choice board: ATTINY ....
Need more installation? How Please?
Thank you.
mpcz, 02.oct.2017

Unfortunately, my core still won't get him support for 128khz operation - I don't have any speeds lower than 1mhz in the list.

With some ISP programmers, there are issues with programming when the target chip is running at a very low speed, because the programmer needs to enter a low speed mode, and this mode isn't well exercised (due to very limited interest in low clock speeds) and doesn't work correctly on some programmers (and in some cases, it depends on the firmware version on the programmer - for example, in some versions of the USBAsp firmware, it needs to get told to use low speed mode by avrdude, in others it uses a jumper on the board, and in others it auto-detects it... I think, at least - I haven't played with low speed mode). It's a mess, and the use cases for such low speed operation are limited - usually you can get comparable power consumption with proper use of sleep mode and a higher clock speed.

This is already sounding like an XY problem.

What are you actually trying to achieve...like the end goal?

Support for IDE ATTINY85 / 128 kHz was successful.
Unfortunately, the delay () command does not work. Here the program is blocked.
Is command "delay()" in 128kHz mode operational?
Thanks, mpcz, 02.oct.2017

p.s. (target = minimum consumption, no current peaks over 300 microA).

mpcz:
Support for IDE ATTINY85 / 128 kHz was successful.
Unfortunately, the delay () command does not work. Here the program is blocked.
Is command "delay()" in 128kHz mode operational?
Thanks, mpcz, 02.oct.2017

p.s. (target = minimum consumption, no current peaks over 300 microA).

What core are you using?

DrAzzy:
Unfortunately, my core still won't get him support for 128khz operation - I don't have any speeds lower than 1mhz in the list.

With some ISP programmers, there are issues with programming when the target chip is running at a very low speed, because the programmer needs to enter a low speed mode, and this mode isn't well exercised (due to very limited interest in low clock speeds) and doesn't work correctly on some programmers (and in some cases, it depends on the firmware version on the programmer - for example, in some versions of the USBAsp firmware, it needs to get told to use low speed mode by avrdude, in others it uses a jumper on the board, and in others it auto-detects it... I think, at least - I haven't played with low speed mode). It's a mess, and the use cases for such low speed operation are limited - usually you can get comparable power consumption with proper use of sleep mode and a higher clock speed.

Your core is the only one I have installed and is what I used for hat screenshot- or do you mean that the frequency isn't well supported even though it is on the list?

Note that often you get more power savings by fast clock and using sleep as much as possible.

Hello,
I have a question:
what consumption in microA has ATMEL TINY85 or similar running at 16 kHz, 3 or 5V?
All unneeded off. Important, NO sleep mode!
Please, only verified data.
Thanks, mpcz, 07.10.2017

mpcz:
what consumption in microA has ATMEL TINY85 or similar running at 16 kHz, 3 or 5V?

16kHz?
Do you really mean 16 Kilohertz? Or do you mean 16MHz (Megahertz)?
Let' assume it is 16MHz.

The question is not to answer easily.
There are two types of ATtiny85. The "normal" ATtiny85 and ATtiny85V
See the working range (form the datasheet):

ATtiny85V: 0 – 4 MHz @ 1.8 - 5.5V, 0 - 10 MHz @ 2.7 - 5.5V
ATtiny85: 0 – 10 MHz @ 2.7 - 5.5V, 0 - 20 MHz @ 4.5 - 5.5V

You may notice: it may not work with 16MHz at 3 Volts.

And even if it does not really make sense, I made some measurements with ATtiny85 and ATtiny85V lying around. Just to get an idea of the consumption.
With an empty sketch like this:

void setup() { }
void loop() { }

And nothing connected but a decoupling cap (100nF).

Here are the results:
ATtiny85
1MHz* @ 3V: 1.0mA
1MHz @ 5V: 3.6mA
8MHz @ 3V: 3.7mA
8MHz @ 5V: 8.1mA

ATtiny85V
1MHz @ 3V: 0.9mA
1MHz @ 5V: 2.7mA
8MHz @ 3V: 3.6mA
8MHz @ 5V: 7.5mA

Maybe not exactly the answer you asked for, but...


*) all clock speeds are internal clock

Thank you for your response.
I have TINY85, internal 128kHz (kilohertz), divided clock at 16 kHz, about 300 microA.
I have the same, very short code on PIC 16FXXXX. Consumption of 25 microA (not sleep!).
Does anyone have a setup procedure for ATTINYxxx for similar consumption? (minimal clock, off all unnecessary, minimal frequency accuracy requirements).
Thanks.
mpcz, 08.10.2017

ATTiny should have <200uA current consumption with internal 128kHz without prescaler even at 5V. Are you sure everything (including BOD, ADC etc.) is properly disabled? If using Arduino core a timer is probably running to keep millis. Also make sure all pins are either Vcc or GND (or digital buffering is disabled via DIDR0).
Also try to make something timed (blink a LED) to confirm you are not running from the 8MHz oscillator. If you have prescaler 8 (to get 16kHz from 128kHz) it would mean 1MHz running from main oscillator. Typical power consumption @1.8V@1MHz is 300uA.
But all of that are Datasheet values, I don't have Tiny85 except for Digispark board. And there are the LDO and USB voltage translator increasing current drain.

As mentioned already: You need a "special" programmer to program the ATtiny with low speeds (like 128 kHz). Not every programmer can do this. I have 3 different ISP programmers and none of them can work with 128 kHz. But cases for low speed operation are pretty limited.

See also answer #4

And: Gammon Forum : Electronics : Microprocessors : Power saving techniques for microprocessors

Hello,
upload to TINY85:

avrdude -B250 -c usbasp -p t85 -U lfuse:w:0x04:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m ....

The base frequency is reduced. 8x division does not work.
Where is the error?
Thanks, mpcz, 16.oct.2017

Maybe you chande main clock prescaler in your code?

Yes, the change in code "clock/8" works OK.
I need a change of "frequency and divider" via FUSE.
mpcz, 16.oct.2017

The fuse sets prescaler to divide by 8. If you change it via code later the value from fuse is overwritten. I.e. if it is set by fuse to 8 and you set it to 8 too you get total prescaling 8 (~16kHz), not 64 (~2kHz). Isn't this your problem?

Sorry, I do not understand.
I set fuses:
avrdude -B250 -c usbasp -p t85 -U lfuse:w:0x04:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
The code is empty. Frequency is 128k, not 16kHz.
What is wrong?
Thank, mpcz, 16.oct.2017