Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 16:56 25 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Simple High Voltage Serial Programmer for Attiny

Author Message
less_is_more
Newbie

Joined: 03/04/2023
Location: Spain
Posts: 12
Posted: 05:32pm 27 Jan 2024
Copy link to clipboard 
Print this post

Hi,

I am proud to propose here a complete programmer for DIP8 attiny13 (would also probably work for attiny 45/85, but I don't have them at hand to test).

For people discouraged from using these little chips, this takes almost all the hurdles away:
- build your own programmer with an Arduino and only 8 easy to find components.
- use the arduino IDE in the same way you program an uno, nano, or other board
- PLUS you can set/reset the fuses, and choose to use the reset pin as a normal pin.
      + having 6 programable pins instead of 5 is a whopping 20% increase!
      + the reset pin widstands 12V.   It CAN be used to sink such high voltage (successfully tested)  

I believe that such a programmer hardly could be simpler to build and easier to use

History:
When I began using the attiny13 for projects (using Microcore with arduino IDE), I stumbled on the need of one more pin, with the reset pin not used, but neither easily available.
I digged a bit about how to program and use this pin. The usual proposed procedure is:  
      - use a fuse programmer board to reset fuses to default
      - program the chip on the usual serial programmer board
      - use again the fuse programmer board to put back the reset_disable fuse
For this, on top of your programmer board, you need also a fuse programmer board which works with high voltage.

So why not program directly with high voltage? Tyler td0g.ca had already this idea, and did it on attiny85.

Most of the high voltage fuse resetter work with an independant 12V source, or a dedicated dc-dc. This can and has to be simplified!
Waynes had already the idea to use a 12V charge pump based on arduino's capacity to generate ac.

His circuit has been further simplified to only 3 signal diodes,and 3 caps. Using a nano board, the generated voltage is 11.75V which is sufficient to enter HVSP mode. To stay safe, a 12V zener was added.

This is the resulting circuit   :


Taking advantage of both this charge pump and the special flash programming of Tyler, HVSP was achieved on a breadboard at first try!
I was really surprised how well it works: you can use it simply as the usual arduino programmer, and can forget about swapping the chip to a special board for (re)setting fuses.
I discovered also that avrdude in Microcore arduino IDE was able to set fuses. If you modify just one file from Microcore, you gain access in the IDE to program AND modify fuses, all through HVSP.

With this solution you can directly upload the firmware AND at the same time PROGRAM THE FUSES through USB on the attiny.

This was the first (and working!) attempt on a breadboard:


Now mounted on a stripboard with a nano, this programmer is the one I am using since 2 years:

Note there is an unpopulated place for a 14 pin socket, which was planned for programming Attiny24/44/84 chips
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4223
Posted: 08:04am 28 Jan 2024
Copy link to clipboard 
Print this post

Thanks for sharing.
I had something similar for the PIC16F84 in those days. That only had high voltage programming.
But it is good to see there is a solution to "win a pin" on the tiny 8 bit chips.
Did you share your Arduino code for the programmer ? I did not see a link. You can also ZIP it up and upload it.

Volhout
Edited 2024-01-28 18:07 by Volhout
PicomiteVGA PETSCII ROBOTS
 
less_is_more
Newbie

Joined: 03/04/2023
Location: Spain
Posts: 12
Posted: 03:52pm 28 Jan 2024
Copy link to clipboard 
Print this post

  Volhout said  Did you share your Arduino code for the programmer ? I did not see a link. You can also ZIP it up and upload it.
Volhout

You're right. I didn't upload the firmware, wanted to explain it a bit, but english is not my native language, so it takes some more time.

Also it's quite a while I did'nt look at the code, as it's just working for my needs.
As said, its based on Tyler's code, itself a mod from Randall Bohn's ArduinoISP

Simple_Attiny_HVSP_programmer.zip

The code is "as is", I did'nt test it on other chips than Attiny13 (Tyler tested his firm only on Attiny85).
So this code MAY work on Attiny85/45/25 .
      If you find it does'nt, first verify that high voltage is in the correct range (11.5V-12.5V, see datasheet).
      Then take a look at timings, see this

Mods done to Tyler's code:
      - added AC generating interrupt: HV_generator.ino
      - modded accordingly start/end programming mode (_pmode.ino) , general defines, setup() and Loop()
      - some cosmetic changes in reading/writing fuses (_command_Line.ino -> fuses.ino)

How to program with this firm the arduino already mounted in the HVSP programmer circuit   (the 10uF between reset and 5V doesn't let you program it as usual)
      - press the reset button on the arduino board, maintain it pressed
      - start uploading the sketch from arduino IDE
      - when compile finishes and avrdude starts (log color changes from white to orange in IDE bottom window), release the reset button
      - the code will now be uploaded on the arduino board

You can then test the high voltage generator without attiny:
      - enter the arduino IDE serial console
      - type P , click Send, this starts the HV generator, the arduino LED lights up, you can measure the voltage on attiny socket pin1.
      - type Q , click Send, this stops the HV generator, the arduino LED goes off

More in next post on how to use this programmer with the arduino IDE
 
less_is_more
Newbie

Joined: 03/04/2023
Location: Spain
Posts: 12
Posted: 11:44am 30 Jan 2024
Copy link to clipboard 
Print this post

I only used this programmer with Arduino IDE version 1.8.13
and with Microcore version 2.1.0.
      MicroCore is a special lightweight Arduino package for ATtiny13, ATtiny13A and ATtiny13V , which brings much code optimizacion so you can fit a lot of high level code into 1024 bytes!

This is the slightly modified Microcore I am using, mods are only to permit direct fuse setting for reset pin
      - README_modded.md , original file README.md
      - boards.txt changes BOD to BOD&reset in IDE board menu, original file boards.ori

To install Microcore in Arduino IDE, read How to install in README,
      - using Manual Installation will install the modded 2.1.0 version, if it works for you
      - using Boards Manager Installation will probably install the last version of Microcore
             + if you want to take advantage from the reset pin, you'll need to manually modify the boards.txt file as I did. Compare my boards.txt and boards.ori files to find out how to do it.

Use with arduino IDE is straightforward,
in the Tools menu :
      - select ATtiny13 in the Boards menu
      - select Arduino as ISP in the Programmer menu
      - select the right fuses (BOD&reset, EEPROM, Clock,...)
Note: If you are programming different boards/chips, beware when changing from one project to other because the Tools settings are not saved on a project base.

- Disconnect the USB cable of your programmer board from the PC
- Insert the Attiny in the right position on the socket
- Reconnect the USB cable of your programmer board to your PC
- Upload a sketch on the attiny: RX and TX leds will blink during transfer, Arduino Led will light while programmer high voltage is present.
- Disconnect the USB cable of your programmer board from the PC
- Take out the Attiny from its socket and insert it in your (test) board

You have also some available functions opening the serial console, like
- read chip signature
- read / program directly fuses
- erase chip (to recover a bricked attiny)
- start/stop high voltage
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2350
Posted: 11:58am 06 May 2024
Copy link to clipboard 
Print this post

hi Lorenzo,
   a quick question: is it common for an attiny13 to be shipped from the factory with the fuses set such that the reset pin can not be used for programming - ie, so only HVSP is possible?

i ask because i'm trying to help a friend get some code into an attiny13a, and the accursed little device is being most uncooperative. i've tried using an AVRISP mk2 that i bought many years back without luck, as well as an 'arduino as ISP'. in both case i'm using these with avrdude as shipped with the arduino IDE, and with the AVRISP mk2 i'm supplying external 5v power to the attiny13a.


cheers,
rob   :-)
Edited 2024-05-06 21:59 by robert.rozee
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3800
Posted: 03:07pm 06 May 2024
Copy link to clipboard 
Print this post

Sorry I can't answer your actual question.

What is/are the avrdude error message(s)?

John
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2350
Posted: 12:20pm 07 May 2024
Copy link to clipboard 
Print this post

  JohnS said  What is/are the avrdude error message(s)?


over an afternoon of attempts, the error messages were many as we tried different things, but all boiled down to avddude not being able to detect a valid device. we tried several different programmers, swapping MISO and MOSI, different power configurations, etc.

i remember way back when Peter and i were doing stuff with pic16F1455 there was an issue with needing an HV programmer, and i vaguely recall reading something at the time about microchip inadvertently shipping some parts with LV programming disabled. am wondering if atmel has done the same.

collected together the parts for Lorenzo's HVSP today and passed them on to my friend, so hopefully he will have one assembled soon and will see what happens.


cheers,
rob   :-)
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024