Arduino AVR High-Voltage Serial Programmer

My son Paul is the author of this guest post.

This Arduino sketch is useful for rescuing ATtiny microcontrollers rendered useless by incorrect fuse settings. It does this by putting the bricked tiny into high-voltage serial programming mode and writing the fuses to safe values.

Connection Diagram

Diagram

Click to enlarge

The Arduino is connected to the tiny though 1k resistors and a 2N3904 transistor is used to switch 12 volts applied to the tiny’s reset pin. After uploading the sketch the Arduino sends “Hello?” repeatedly until communications are established by sending a byte through the serial monitor. The Arduino then programs the fuses.

Serial Monitor log

Hello?

Hello?

Hello?

1

Entering programming Mode

lfuse reads as 62

hfuse reads as 5F

efuse reads as FF

Writing hfuse

Writing lfuse

lfuse reads as 62

hfuse reads as DF

efuse reads as FF

Exiting programming Mode

Download the program: hv_serial_prog.pde

Based on work by Jeff Keyzer.

Let me know if it works for you.

Comments

  1. Anonymous says:

    R1-R5 = x Ohm ?

  2. Michael says:

    If you need a 5 to 12V converter then you can design your own at:

    http://www.nomad.ee/micros/mc34063a/index.shtml

    with the standard MC34063A controller.

  3. Michael says:

    Adding support for more Attinys ?

    // Defaults for ATtiny13

    HFUSE 0xFF
    LFUSE 0x6A

  4. André Delgado says:

    Excelent AVR Programer

  5. hobby16 says:

    It works fine for me on a AtTiny45 ! Thank you so much.
    I’ve tried on an AtTiny15 (default fuse value = 0×50) with some tweaks in the ARduino sketch but it keeps sending back 0xFF. Then I remembered that RB3 and RB4 pins on AtTiny15 are swapped compared to ATTiny25 (hell, the Atmel guy who did it deserves tar & feather).
    So I rewired for Tiny15 and then… it doesn’t work either (the bricked AtTiny15 remains bricked).

    • Paul says:

      Hobby it looks like the algorithm to enter the High-voltage programming mode is different on the AtTiny15 but the instructions to read and write the fuse bits are similar. I would first try commenting out read hfuse, read efuse, and write hfuse. Then try writing 0x5C instead of 0×50 as the fuse value. It appears the third and forth bits are part of the write instruction and need to be 1s. If that does not work try changing the sequence to enter programming mode to match the datasheet (page 56).

  6. Michael says:

    So i’ve build this thing and testet it with a bricked ATTiny13 : I works at the first time.

    http://wegzumselbst.de/images/DSC01509.JPG

  7. Michael says:

    Use MAX662 to convert 5V into 12V. Needs only 2 capicators and no justage. DIL8 package.

    http://datasheets.maxim-ic.com/en/ds/MAX662A.pdf

    • Paul says:

      Is that the other chip on your shield? That’s pretty neat Michael.

      • Michael says:

        For my shield i have use the usual and cheap MC34063. But you need an bunch of other components to build this.

        I you don’t want to solder much the MAX 662 is a better solution although it is harder to get and much more expensive as the MC34063.

        • Michael says:

          And:

          If you use the MAX662 you don’t need T1 and R6 anymore. You can connect R5 to the shutdown input of this ic. (No need to modify the code.)

          And the RESET input of the Attiny connects directly to the 12V output of the MAX662.

          • Michael says:

            OK. You need a delay for minimal 400us after activating the programming voltage by your program to stabilize the 12V output of the MAX 662. (see data sheet).

  8. studioeng says:

    Hi, I’ve recently done the stupid thing of setting the wrong fuses on my Attiny85. I only have a Teensy++2.0 to work with and I’m having a job trying to ‘convert’ the pins to work with this. Any help would be much appreciated. Thank you.

    • Paul says:

      Here is my best guess studio,
      Match up the green pin numbers on my connection diagram to the white silk screen numbers on your Teensy board as follows:
      Arduino – Teensy++ 2.0
      GND – GND
      13 – C3
      12 – C2
      11 – C1
      10 – C0
      9 – E1
      8 – +5v

      • studioeng says:

        Thank you for your reply.

        In the meantime while I was waiting for my post to be moderated I jumped in the deep end and wired it up. It all worked perfectly. If it helps anyone else, I used a 2N2222A transistor and a 12v power pack from a cheap USB->SATA/IDE converter and connected it following the pin numbers in the schematic. I have saved my first tiny85 :D happy days.

        I must admit I didn’t quite follow your post, are you indicating the connection pins between the Arduino and Teensy++ 2.0 or the equivalents between them? In my case I simply connected using the same Arduino pin numbers as the schematic and it worked perfectly.

        • rickety says:

          Once you have a comment that contains your email that is approved, all subsequent comments that contain the same email will be posted immediately. See Comments Policy.

          Thanks for helping others by posting of your experiences.

        • Paul says:

          Glad to hear you got things working studio. I am indicating the equivalency between the Arduino pins on the schematic and the Teensy++ 2.0.

          To be a little more clear:
          Attiny85 pin 2 connects to Arduino pin 12 or in your case Teensy++ 2.0 pin C2.
          Attiny85 pin 7 connects to Arduino pin 11 or in your case Teensy++ 2.0 pin C1.
          etc.

          Is this the way you wired it up? If not maybe a picture of the correct setup could help clear things up.

          I am getting these pin mappings from this picture, http://www.pjrc.com/teensy/teensyduino.html and a table http://www.pjrc.com/teensy/td_digital.html

  9. Thierry says:

    Hi,

    I wanted to thank you for this excellent work and programmer, which I used successfully to revitalize two “broken” attiny45. For the 12 V source, I used directly (without regulation) a wall plug adapter which provided ~ 12.5 V. I also used a BC337 as a switch transistor instead of the 2N3904. Thanks again for sharing your work like this !

    • Paul says:

      Glad to hear it worked for you Thierry. It looks like the absolute maximum rating for the reset pin is 13 volts if someone has an odd value transformer.

      • Michaho says:

        Hi,

        Has anyone tried this on a bricked ATTiny2313?
        Does the serial high-voltage programming mode program the SPIEN bits on the 2313?

        Thanks

  10. Fettes says:

    Thanks, this saved my butt

  11. putyn says:

    hey , would this work on other atmel chips like atmega specially atmega8 ?
    thanks

  12. Anonymous says:

    ATtiny84 wiring require more pins to be connected to GND:
    http://www.instructables.com/id/AVR-Attiny-fusebit-doctor-HVSP/step2/How-it-works/

Trackbacks

  1. [...] need to flash another firmware, you will need to reset the fuses using a High Voltage programmer; this one worked fine for me. AVR GNU toolchain is used for this project, so the code is written in GNU [...]

Speak Your Mind