Skip to content
An Arduino sketch to program an ATtiny10. A rewrite of code by feynman17, Keri DuPrey, Nat Blundell, pcm1723, and others.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ATtiny10Programmer
LICENSE
README.md

README.md

ATtiny10Programmer

An Arduino sketch to program an ATtiny10. A rewrite of code by feynman17, Keri DuPrey, Nat Blundell, pcm1723, and others.

Comments from the source:

// ATtiny10Programmer.ino
//
// Brian Doyle, brian@balance-software.com, 2014.09.27
//
// This is a complete rewrite of the ATtiny4/5/9/10 programmer I found here:
// http://junkplusarduino.blogspot.com/p/attiny10-resources.html
// which appears to be the blog of "feynman17'.
//
// Credits for the original code go at least to:
//
// feynman17
// pcm1723
// Keri DuPrey
// Nat Blundell
//
// I would like to expressly thank all of the above individuals for their efforts.
// This is my first program for the Arduino and I simply would not have been able
// to learn as much as I have in such a short amount of time had it not been
// for their substantial efforts.  Sincerely, thank you.
//
// While much of this code derives directly from their efforts, it is all new,
// so any errors are mine.  That said, if you use it you take all the responsibility.
// If it eats your hardware or sets your house on fire too bad.
//
// This code is expressly licensed under the MIT License.
//
// This code is both more and less functional than the original, owing
// to the fact I haven't yet ported a few things.
//
// The original code had a few problems.  First, it didn't correctly handle
// the address field of AVRStudio .hex files.  This prevents using .org directives
// to specify where certain chunks of code or data should go.
//
// Second, the original code tended to fail arbitrarily depending on
// how much code I was trying to send over the serial port.  I know now the
// reason it failed was because of serial buffer overruns, but *not* knowing that
// initially was enough for me to start rewriting the code.  You might ask why I
// chose that route instead of trying to modify the original.  I learn better when
// I write things from scratch, but I also had to understand it all before I knew
// for sure what the problem was.  Rewriting it was the fastest way for me to do that.
//
// Now that I have a handle on things I've changed the upload logic so that it
// writes all the serial data into a buffer first and then writes to the ATtiny.
//
// My implementation currently doesn't support ATtiny 20 and 40, at least insofar
// as those chips support 2KB and 4KB flash areas respectively.  Modifying
// this code to support those chips wouldn't be too hard, but as I only have
// ATtiny10's, there's no reason yet for me to do it.
//
// What else don't I have in here at the moment?
//
// High voltage programming
// Fuse setting/clearing
// Quick reset
// Probably some other stuff
//
// How to use this?
//
// Get an Arduino.  I have an Arduino Nano which works great.
// Get an ATtiny10 (get a few, I've fried one already).
// Hook up the Arduino to the ATtiny10 as shown in this diagram:
//
//
//    Arduino                ATtiny10
//    -----------+          +----------------
//    (SS#)  D10 |----------| 6 (RESET#/PB3)
//               |          |
//    (MOSI) D11 |--[R]--+--| 1 (TPIDATA/PB0)
//               |       |  |
//    (MISO) D12 |-------+  |
//               |          |
//    (SCK)  D13 |----------| 3 (TPICLK/PB1)
//    -----------+          +----------------
//
//    -----------+          +----------------
//    (HVP)   D9 |---       | 6 (RESET#/PB3)
//               |          |
//
//	-[R]-  =  2.2kΩ resistor
//
//	2011.12.08:		Original image by pcm1723
//
//	2014.09.26 bd:  The pcm1723 image had resistors on D10, D12, and D13.
//                  Both the Arduino Nano and the ATtiny10 operate at 5V and
//                  are rated at 40mA per pin (ATtiny reference §16.1 p. 115,
//                  Nano via online) so I'm getting rid of all the resistors
//                  except the one on D11 to prevent MISO->MOSI.
//
//
// Note the HVP connection is not necessary, and isn't even supported by this
// program (to do).
// Write some assembly code in AVRStudio for the ATtiny10.
// Build it, then open the .hex file generated by AVRStudio.
// Upload this sketch to the Arduino.
// I use Sublime Text 2 with Stino on my Mac (https://github.com/Robot-Will/Stino),
// and I run AVRStudio under Windows in a VM.  You should use whatever
// Arduino environment makes you happy.
// Once the sketch is uploaded, open the Serial Monitor.
// Set the baud rate to 115,200.
// Type in a question mark (?) and hit enter to see a list of commands.
// Use the 'u' command to start programming the ATtiny10.
// Next copy the entire contents of your .hex file.
// Paste the .hex file content into the Send box of the Serial Monitor and click send.
// Your Arduino should program your ATtiny.
// I've noticed if I do all of this from Windows (even under VMware), I never
// have to pull out the USB cable and reset the Arduino.  It just programs
// the ATtiny10 then my program starts to run.  I can write it over and over again,
// just repeatly using the 'u' command and uploading.  That's nice.
// Congratulations, if you're like me you've spend an absurd amount of time getting
// an LED to blink.
//
// Some other interesting code I wrote in support of my LED color cycling project
// can be found here:
//
// http://jsfiddle.net/16bmnzn8/
//
// The section references sprinkled throughout the comments refer to the
// ATtiny10 datasheet:
//
// http://www.atmel.com/Images/Atmel-8127-AVR-8-bit-Microcontroller-ATtiny4-ATtiny5-ATtiny9-ATtiny10_Datasheet.pdf
You can’t perform that action at this time.