8
\$\begingroup\$

I am having a problem with my ATTiny85. I should mention I use Arduino as an ISP to program it.

My ATTiny worked fine until I decided that I need to step up the clock speed from 1MHz to 20MHz so I selected ATTiny85 at 20MHz from the Boards menu and then clicked on Tools>Burn Bootloader. But that was stupid, since now my ATTiny doesn't work at all. I cannot upload sketches on it and if I try I get this message:

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

So my question to you would be, is there a way to reset what I have done? Or even better, to make it work at 20MHz?

\$\endgroup\$
  • 2
    \$\begingroup\$ Do you remember the fuse values you set? It may still be on screen if you scroll up a bit. You can't set an ATtiny85 to 20MHz with the internal oscillator, did you connect a clock source? \$\endgroup\$ – jippie Apr 23 '13 at 19:37
  • \$\begingroup\$ No I did not connect a clock source. I just burned the bootloader with 20mhz attiny selected as the board(and of course, with the attiny connected to the arduino). \$\endgroup\$ – Calin Apr 23 '13 at 19:58
  • \$\begingroup\$ I have another arduino, is there a way to reset the fuses using it? \$\endgroup\$ – Calin Apr 23 '13 at 19:58
  • \$\begingroup\$ Why would you need another Arduino? As understand it you bricked your ATtiny, not your Arduino. The error messege in your question points in that same direction: The Arduino is OK. If you are in doubt about your Arduino, disconnect everything except USB, then program the Blink example. If that works fine, you can return to your ArduinoISP (I believe that is the name of the programmer software you were using). \$\endgroup\$ – jippie Apr 23 '13 at 20:06
  • 2
    \$\begingroup\$ Without knowing the exact fuse settings you used, we can't be sure of what you actually did. If you did, in fact, set the clock for 20MHz, all you need to do is connect an external clock source, be it a crystal, resonator, or pulse from another circuit, just so long as the external clock source is 20MHz. \$\endgroup\$ – Kurt E. Clothier Apr 23 '13 at 20:08
10
\$\begingroup\$

I suspect you have set the controller's fuses to use an external clock source as it is impossible to get the internal oscillator to run at 20MHz. You can blow new life into your controller by connecting a clock signal to pin 2 CLKI and try to reset the clock to 8MHz internal RC clock.

There is actually a 'fixed' version of ArduinoISP that has a clock output on digital pin 9. I didn't test this clock output myself, but it is worth to try. So in addition to the connections you already have between Arduino and ATtiny, connect Arduino digital pin 9 to ATtiny85 pin 2 (CLKI). Then try to program the 8MHz internal RC clock.

If you check the datasheet chapter 6.2 'Clock sources' for details.

An alternative method is using a High Voltage programmer, which can easily be improvised using an Arduino.

BTW: A similar thing will happen when you select a RC clock source < 1MHz, your controller clock in that case will run too slow for the standard ArduinoISP software.

\$\endgroup\$
  • \$\begingroup\$ Thanks! So I need a 12v power source to do this(which I currently don't have). I'll see what I can do to improvise. Is there any problem if the source is a bit over 12v? \$\endgroup\$ – Calin Apr 23 '13 at 20:02
  • \$\begingroup\$ @Calin How "over 12V" are you talking about? You can damage the chip pretty easily... A couple of resistors could be used to lower the voltage to 12V. See this: electronics.stackexchange.com/questions/25038/… \$\endgroup\$ – Kurt E. Clothier Apr 23 '13 at 20:05
  • \$\begingroup\$ Ok thanks! I'll try tomorrow since now it's almost midnight. I'll keep you updated! \$\endgroup\$ – Calin Apr 23 '13 at 20:07
  • \$\begingroup\$ Try the external clock source options from my answer before accidentally frying the controller with a too high voltage. The high voltage must be between 11.5 and 12.5V (chapter 20.7.1 in the datasheet). \$\endgroup\$ – jippie Apr 23 '13 at 20:24
  • 1
    \$\begingroup\$ Thank you! The "fixed" version of the ArduinoISP helped me solve my problem! I uploaded the fixed version on the Arduino, disconnected the Arduino and connected the ATTiny as normal but with pin 9 from Arduino connected to ATTiny's pin 2(as you suggested). After that I opened the Arduino IDE and selected ATTiny85 (with internal 8MHz clock) as my board and ArduinoISP as Programmer. I clicked on Tools>Burn Bootloader and everything went ok. After that I re-uploaded the original ArduinoISP sketch from the Examples directory and I could program the ATTiny again using my Arduino as Programmer. \$\endgroup\$ – Calin Apr 24 '13 at 9:42
5
\$\begingroup\$

As @jippie said, this is simply a matter of applying an external clock source (it actually does not matter whether the clock source is 20MHz or not, it just needs to hit 1MHz or so to manage the SPI programming speed of ArduinoISP).

As an alternative to the ArduinoISP version mentioned above, you could try ScratchMonkey, which in addition to clock generation also does software SPI to deal with some other clocking issues. Unless you managed to disable your reset pin, there should be no reason to resort to high voltage programming.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.