Pages: [1] 2   Go Down
Author Topic: Burnt wrong bootloader on ATtiny85 - how to correct?  (Read 2011 times)
0 Members and 1 Guest are viewing this topic.
Cape Town, ZA
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have an Arduino Uno R3 board and successfully used it to program my first ATtiny85.  I followed the MIT Media Lab instructions and, in burning the Bootloader, selected "ATtiny85 (with internal 8MHz clock)" in Tools>Board.

Moving on to my second ATtiny85 I got careless and, in burning the Bootloader, I accidentally selected "ATtiny85 (with external 20MHz clock)" - the next one down in the Tools>Board list.  When I subsequently tried to re-burn the Bootloader having now selected "ATtiny85 (with internal 8MHz clock)" I get the following error message:

"Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check."

Is there an easy way to put this right?  I am very much of a beginner.

What does "use -F" mean and would that solve the problem?

Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 208
Posts: 12937
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Do you have a crystal + capacitors?  Or a resonator?
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 208
Posts: 12937
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What does "use -F" mean and would that solve the problem?

Doesn't matter.  No.
Logged

Cape Town, ZA
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Do you have a crystal + capacitors?  Or a resonator?


No, yes, and no.

I can go and buy a crystal (I've never worked with them though).  Could you briefly explain what crystal to buy, how to connect it up, and the procedure?

Many thanks for your speedy reply.
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 146
Posts: 5535
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have an Arduino Uno R3 board and successfully used it to program my first ATtiny85.  I followed the MIT Media Lab instructions and, in burning the Bootloader, selected "ATtiny85 (with internal 8MHz clock)" in Tools>Board.

Moving on to my second ATtiny85 I got careless and, in burning the Bootloader, I accidentally selected "ATtiny85 (with external 20MHz clock)" - the next one down in the Tools>Board list.  When I subsequently tried to re-burn the Bootloader having now selected "ATtiny85 (with internal 8MHz clock)" I get the following error message:

I find it helps if I remove the boards I don't own from boards.txt. Make the menu smaller, and avoids accidents.


Is there an easy way to put this right?  I am very much of a beginner.

What does "use -F" mean and would that solve the problem?

I've heard you can connect any clock source to the clock pin to make it run while you fix the fuses. Doesn't have to be 20mHz.

Oscilloscopes and signal generators have square wave outputs...or maybe you can use the PWM signal from another Arduino...
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Cape Town, ZA
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Do you have a crystal + capacitors?  Or a resonator?


I have just found an old printed circuit board with what appears to be a crystal on it (oblong silver can, with two pins, and "XT1" marked on the pc-board next to it).  The only marking on the can is 12000.SN so I have no idea if it will be of any use.
Logged

Cape Town, ZA
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I've heard you can connect any clock source to the clock pin to make it run while you fix the fuses. Doesn't have to be 20mHz.

Oscilloscopes and signal generators have square wave outputs...or maybe you can use the PWM signal from another Arduino...


Thanks.  I mentioned in my other post that I did, I think, find a crystal.  Do I simply connect its two terminals across pins 4 (GND) and 7 (SCK) of the ATtiny and see if I can then re-burn the (correct) bootloader?
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 146
Posts: 5535
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks.  I mentioned in my other post that I did, I think, find a crystal.  Do I simply connect its two terminals across pins 4 (GND) and 7 (SCK) of the ATtiny and see if I can then re-burn the (correct) bootloader?

It's pin 2 on a Tiny85...

Give it a try, you can't do any harm. All you need is some pulses on that pin while you set the fuses.


Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 208
Posts: 12937
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I can go and buy a crystal (I've never worked with them though).

(Probably) no need.  What are you using for a programmer?  Do you have an Uno (or equivalent)?
Logged

Cape Town, ZA
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks.  I mentioned in my other post that I did, I think, find a crystal.  Do I simply connect its two terminals across pins 4 (GND) and 7 (SCK) of the ATtiny and see if I can then re-burn the (correct) bootloader?

It's pin 2 on a Tiny85...

Give it a try, you can't do any harm. All you need is some pulses on that pin while you set the fuses.


Success!!

This is what I've done:

1. Your comment about the pin told me I needed to do some homework.  So I looked up the data sheet for the ATtiny85. (As they say, if all else fails read the instructions.)  In paragraph 6.2.6 it shows you how to connect up a crystal.

2. I carefully unsoldered the crystal from the old PC-board I happened to have lying around, as well as two surface-mount components next to it, which I assumed to be the required capacitors.

3. Apart from the usual connections between the Arduino board and the ATtiny85 required to burn the Bootloader, I connected the crystal between pin 2 (XTAL1) and pin 3 (XTAL2) of the ATtiny, the one capitor between pin 4 (GND) and pin 2 and the other capacitor between pin 4 and pin 3.

4. I then re-burnt the Bootloader, this time having selected the correct board, and it worked first time.

Unfortunately I have no idea what the values of the crystal and capacitors are.
Logged

Cape Town, ZA
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
(Probably) no need.  What are you using for a programmer?  Do you have an Uno (or equivalent)?


As mentioned in my other post the problem has been solved.  For what it's worth, I used the ArduinoISP sketch and an Arduino Uno R3 board.  Thanks again.
« Last Edit: January 04, 2013, 01:31:18 pm by Coding Badly » Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 146
Posts: 5535
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Success!!

Yay!

Unfortunately I have no idea what the values of the crystal and capacitors are.

Who cares, it oscillated!

Now you need to delete the "bad" entry from your boards.txt file so it can't happen again... smiley
« Last Edit: January 04, 2013, 08:28:56 am by fungus » Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
   
Burnt wrong bootloader on ATtiny85 - how to correct?

Would burning the right bootloader correct it?
Logged

Cape Town, ZA
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
   
Burnt wrong bootloader on ATtiny85 - how to correct?

Would burning the right bootloader correct it?


You had me worried there for a moment, because I hadn't actually tried loading a sketch to the ATtiny.

But I have now done so and it does work.  So, as far as I am concerned, it did correct what the previous (wrong) bootloader did.
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 208
Posts: 12937
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


For future reference, it's fairly easy to get a board running the ArduinoISP sketch to output an appropriate clock signal.  LadaAda published a modified ArduinoISP sketch, I published a version, Nick Gammon published relevant code, and you can probably find a snippet in the forum.

Armed with a modified ArduinoISP sketch, you simply connect the clock output (an Arduino pin) to the XTAL1 pin on the target and re-burn the bootloader.

Good job extracting the crystal!
Logged

Pages: [1] 2   Go Up
Jump to: