Burnt wrong bootloader! Oops! (attiny84)

Hello, I’m messing with Attinys today and trying to get the power consumption way down. I was setting up a new chip and accidentally burnt the board with “128 khz WDT” for the clock. And now it refuses to burn or upload anything!

I’m very familiar with the connections and I’ve verified them multiple times. I haven’t switched or changed anything in my current upload/burn setup and I’ve tried other boards that work since I have a box of 5. I also burnt one with 20MHz external clock on accident as well but I think I found the solution in another post (attach 20MHz pwm to clock pin).

My question is really how can I correct this and revert the tiny to anything usable? Is there some interrupt pin I have to hold while uploading/burning or is it permanently screwed? No magic smoke or heat came out btw.

Oh and I’m using an Arduino Uno as ISP programmer.

I’ll attach the error message below if that helps.

Arduino: 1.8.13 (Windows 10), Board: "ATtiny24/44/84, Enabled, ATtiny84, 1 MHz (internal), EEPROM retained, B.O.D. Disabled, Counterclockwise (like old ATTinyCore and x41-series), Enabled, Port A (CW:0~7,CCW:3~10)"

C:\Users\Dean\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\Dean\AppData\Local\Arduino15\packages\ATTinyCore\hardware\avr\1.3.2/avrdude.conf -v -pattiny84 -cstk500v1 -PCOM5 -b19200 -e -Uefuse:w:0xFF:m -Uhfuse:w:0b11010111:m -Ulfuse:w:0x62:m 



avrdude: Version 6.3-20190619

         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         Copyright (c) 2007-2014 Joerg Wunsch



         System wide configuration file is "C:\Users\Dean\AppData\Local\Arduino15\packages\ATTinyCore\hardware\avr\1.3.2/avrdude.conf"



         Using Port                    : COM5

         Using Programmer              : stk500v1

         Overriding Baud Rate          : 19200

         Setting bit clk period        : 5.0

         AVR Part                      : ATtiny84

         Chip Erase delay              : 15000 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     6     4    0 no        512    4      0  4000  4500 0xff 0xff

           flash         65     6    32    0 yes      8192   64    128  4500  4500 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 = 0x000000 (retrying)



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



avrdude: Device signature = 0x000000 (retrying)



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



avrdude: Device signature = 0x000000

avrdude: Yikes!  Invalid device signature.

         Double check connections and try again, or use -F to override

         this check.





avrdude done.  Thank you.



Error while burning bootloader.



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

There is a way to fix this, I remember reading about it once, but can’t remember where. The problem is that when uploading via ISP, the program data is sent from the programmer to the chip at a particular rate, regardless of the speed the chip is set to run at. That’s fine for when the chip is set to use faster speeds, like 1MHz or above, but for slower speeds, the chip cannot keep up with the incoming data. You need to set some parameter somewhere to get the programmer to send the data at a slower rate.

Hopefully someone such as @DrAzzy can help with more detail.

Ahhh yeah that makes total sense. I’ll try and google around for that parameter.

There’s a note about it here:
These options are slow enough that many ISP programmers may not be able to program them.
but no advice for recovery. ATTinyCore does provide a Tools > Programmer > USBtinyISP (ATTinyCore) SLOW, for new or 1 MHz parts programmer, but that only helps if you are using a USBtinyISP programmer, whereas you ar using the “Arduino as ISP”.

That may not even be slow enough for the 128 KHz WDT oscillator. But, good news, you’re using Arduino as ISP. Remember the first step of using it, where you upload Arduino as ISP onto the board you’re using as programmer? You have the source code for the programming tool right there!

Open Arduino as ISP, save a copy of it, and find the line where they set the SPI clock. Line 53 looks promising:

#define SPI_CLOCK 		(1000000/6)

Changing to

#define SPI_CLOCK 		(100000/6)

ought to do the tric, upload modified arduino as ISP to the arduino being used as p[rogrammer, burn bootloader to target using correct settings.

Edit: Haaah! a few lines before that they actually gave example. They did 128000/6 - but I said 100000/6; since the WDT oscillator is not carefully calibrated, and we don’t really careabout it being 28% faster, but we do care about itfailing to program the part because you got unluicky and have an unusually slow WDT oscillator (they are not very carefully calibrated - where it’s given, the spec is like +/- 30%)

That’s how I’d probably undo something like that.

1 Like

Holy crap you are a genius. That worked perfectly!! Thank you so much man you saved me a huge frustrating day.
And I even learned something about the isp programmer! Great day