How to burn fuses on Attiny85?

Hello,

I am using Uno as a programmer to program my Attiny85. I am trying to burn fuses with this command below but it fails with the message that avrdude can not find programmer "arduinoisp". If I try "arduino" instead, I get avrdude: stk500_getsync(): not in sync: resp=0x00 error. I found different advice on internet from using "arduino" to using "arduinoisp" or "avrisp". Which programmer in fact shall I use for avrdude version 5.11?

avrdude -p attiny85 -P com3 -c arduinoisp -b 19200 -B 250 -u -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m

Thank you for any advice.

(deleted)

Yes, I have loaded the arduinoISP sketch. I wired according to the instructions here . I have been programming with it quite a lot. It works just fine. But I now need to burn fuses and I've never done it before. :confused:

You can just use "Burn Bootloader"

Select Board -> Attiny85@8MHZ
select Programmer -> Arduino as ISP
Select ->Burn bootloader

This wil not burn a bootloader to your chip, it is only used to set the fuses to another clock-speed.

What if I need to activate WDTON, not just set 8MHz?

If you enable verbose output in the IDE you can see which parameters are used.
On my PC it is:

avrdude -pattiny85 -cstk500v1 -PCOM4 -b19200 -e -Uefuse:w:0xFF:m -Uhfuse:w:0xD7:m -Ulfuse:w:0xE2:m

Thanks, it works now when I use -cstk500v1. Was confused by advice on other sites to use arduinoisp, etc.

Can I use this fuse setting method multiple times on the same chip? I understand if I change External Reset disable fuse (RSTDISBL), I have to use high voltage programmer to set it back. Is it the same with other fuses?

gv445:
Thanks, it works now when I use -cstk500v1. Was confused by advice on other sites to use arduinoisp, etc.

Can I use this fuse setting method multiple times on the same chip? I understand if I change External Reset disable fuse (RSTDISBL), I have to use high voltage programmer to set it back. Is it the same with other fuses?

No, the other fuses can be changed back freely. The ones you cant' change back easily are SPIEN (enable serial programming via SPI/ISP - if you change this one, it will disable ISP programming) and RSTDISBL (which breaks ISP programming because that needs the reset pin to put the chip into reset)

Great. Thanks a lot! :slight_smile:

Hi!

I am also using Arduino as ISP and was able to upload the code on tiny, but I cannot get to program the "fuses" on tiny too! However, do I get the right output ?

This is my verbose output

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:01:35
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2014 Joerg Wunsch

        System wide configuration file is "/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf"
        User configuration file is "/Users/imac27/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : /dev/cu.usbmodem1421
        Using Programmer              : stk500v1
        Overriding Baud Rate          : 19200
        AVR Part                      : ATtiny85
        Chip Erase delay              : 400000 us
        PAGEL                         : P00
        BS2                           : P00
        RESET disposition             : possible i/o
        RETRY pulse                   : SCK
        serial program mode           : yes
        parallel program mode         : yes
        Timeout                       : 200
        StabDelay                     : 100
        CmdexeDelay                   : 25
        SyncLoops                     : 32
        ByteDelay                     : 0
        PollIndex                     : 3
        PollValue                     : 0x53
        Memory Detail                 :

                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          eeprom        65    12     4    0 no        512    4      0  4000  4500 0xff 0xff
          flash         65     6    32    0 yes      8192   64    128 30000 30000 0xff 0xff
          signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
          lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
          lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
          hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
          efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
          calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

        Programmer Type : STK500
        Description     : Atmel STK500 Version 1.x firmware
        Hardware Version: 2
        Firmware Version: 1.18
        Topcard         : Unknown
        Vtarget         : 0.0 V
        Varef           : 0.0 V
        Oscillator      : Off
        SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e930b (probably t85)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
        To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "/var/folders/89/gtt69frj135cgbpjf2z84bs80000gn/T/arduino_build_957582/TINY_VCNL4010.ino.hex"
avrdude: writing flash (3192 bytes):

Writing | ################################################## | 100% 4.51s

avrdude: 3192 bytes of flash written
avrdude: verifying flash memory against /var/folders/89/gtt69frj135cgbpjf2z84bs80000gn/T/arduino_build_957582/TINY_VCNL4010.ino.hex:
avrdude: load data flash data from input file /var/folders/89/gtt69frj135cgbpjf2z84bs80000gn/T/arduino_build_957582/TINY_VCNL4010.ino.hex:
avrdude: input file /var/folders/89/gtt69frj135cgbpjf2z84bs80000gn/T/arduino_build_957582/TINY_VCNL4010.ino.hex contains 3192 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 2.25s

avrdude: verifying ...
avrdude: 3192 bytes of flash verified

avrdude done.  Thank you.

I can see that my fuses are not use, however, I cannot find/see how to do program them, e.g. cannot find the

avrdude -pattiny85 -cstk500v1 -PCOM4 -b19200 -e -Uefuse:w:0xFF:m -Uhfuse:w:0xD7:m -Ulfuse:w:0xE2:m

"If you enable verbose output in the IDE you can see which parameters are used."

For example, I would like to use the BOD... How can I do that and which fuse is that actually???

Best.

Fuses are only programmed when you do "Burn Bootloader"

You have cut off your verbose output at the line after the line that shows the AVRDude invocation - the line you're looking for is the one immediately before the first line you posted.

If you're using my attiny core ( https://github.com/SpenceKonde/ATTinyCore ) you can select the BOD setting from the Tools -> BOD menu - just select the BOD setting you want, do burn bootloader, and you're good to go.

There we go! Your core installed, and I must say, it looks you did a great job... Ok it seems it works, however, what would be the ultimate test? Currently, I am turning on/off the power supply, since it requires some time to provide the stable 5v (BOD is on 4.3v) ... however, is there any other way to test it out?

Best.

PS btw what is good to use the LTO, actually what is it?

Load blink or something, then lower the voltage (using an adjustable power supply), and verify that the sketch stops running at 4.3v (at 8mhz w/out bod it would normally keep running until much lower voltage)

LTO is link time optimization. Very aggressive set of optimizations done by the linker. Reduces the size of the compiled code by 10-20% typically.

DrAzzy:
No, the other fuses can be changed back freely. The ones you cant' change back easily are SPIEN (enable serial programming via SPI/ISP - if you change this one, it will disable ISP programming) and RSTDISBL (which breaks ISP programming because that needs the reset pin to put the chip into reset)

Those two are the really nasty ones, but the clock settings can also bite you in the butt if you configure them wrong. If you accidentally enable the external oscillator option I don't believe you can change the setting back until you plug a crystal/resonator in. The low speed internal oscillator (128 kHz) might also require changing a setting on your command line to slow down the SPI communication, I'm not sure which one that is.

Thank you both for your comments! Just got at the tiny45 and it seems the new version runs up to 20Mhz (via external clock?).

@DrAzzy Thanks for explanations... indeed, the memory size has shrank, which is good, especially when thinking about moving to/using tiny45... If I take into account what Jiggy-Ninja told about the clock, then I guess the fastest 'internal' clock of tiny is 8MHz, everything else is 'external', except 16MHZ PLL, which I am not sure what is it? In addition, I am not sure what Time 1 Clock is used for? At the moment I am using "CPU"... @Jiggy-Ninja thanks for reminding to stay within the 'internal' clock setting!

Need to improve the code, timing, namely millis() is giving me headache... maybe the LTO will help :slight_smile:

"Talk" to you soon and all the best!

With an external crystal or clock, the attiny x5 series can all run at 20mhz.

16mhz PLL clock option runs at 16mhz using the on-chip PLL with the internal oscillator (8mhz kicked up by 8x to 64mhz, then divided by 4) - this lets you run at 16mhz without an external crystal or clock source.

The attiny x5 series can also clock Timer1 off of the internal PLL (at the full 64mhz) for outputting highspeed PWM. That menu allows you to configure this at startup, and will also correct Tone() for this. See the datasheet for more information on the advanced functionality available on the highspeed timer. Unless you need to run the timer at high speed, leave this set to CPU.

millis() functionality should not be impacted by whether LTO is enabled.