I managed to mangle my bootloader on a 3V Trinket. My bad, I don't know how, but it WAS me. When looking for a fix I found:
https://learn.adafruit.com/introducing- ... bootloader
There were two problems with that fix. 1) I'm not sure if this is even safe with a 3V Trinket. I don't think so since Uno is 5V and Trinket 3V isn't stated to be 5V tolerant. Oh yes, 2) I don't have a Uno. However, I do have access to a Bus Pirate, http://www.adafruit.com/products/237 , Everyone should!
These are the steps I used to get a firmware image, power the Trinket, then finally repair the bootloader with the Bus Pirate.
This is how I did it. Just because it worked for me doesn't mean I'm tell you it'll work in your circumstance. For all I know, you'll have a pile of goo and burned hands. Don't blame me if that's exactly what you get.
0. Start.
1. Getting the Trinket bootloader binary/hex (this is the hard part)
a. make a place to work:
mkdir ~/trinketloader
cd ~/trinketloader/
b. get the adafruit archive that contains our bootloader:
wget http://learn.adafruit.com/system/assets ... loader.zip
c. unzip trinketloader.zip; cd trinketloader/
d. Use magic to create the hex file:
grep '^":' images.cpp | cut -d'"' -f2 | cut -d'\' -f1 > trinket.hex
The first line should start with:
:20000000
The last line should be:
:00000001FF
If this isn't the case then this step didn't work, DON'T CONTINUE. (or create this file manually from images.cpp, it's pretty obvious)
2. Connect the Bus Pirate to the Trinket (5 connections)
These are in the order of the wires on the Bus Pirate. I'd recommend following this order when connecting to avoid confusing the colors. The color and order reinforce the correct Bus Pirate clips.
Code: Select all
Bus Bus Trinket ATtiny85 ATtiny85
Pirate Pirate Label Label Pin
Color Label Name
------------------------------------------
BROWN GND GND GND GND
RED 3v3
ORANGE 5v0
YELLOW ADC
GREEN Vpu
BLUE AUX
VIOLET CLK 2 SCK PB2
GREY MOSI 0 MOSI PB0
WHITE CS RST RST RST
BLACK MISO 1 MISO PB1
4. Connect the computer USB to the Trinket (only for power)
5. Wait for a 15 seconds just to be sure we're past any bootloader code remaining in the Trinket.
6. Verify avrdude can see your Trinket via the Bus Pirate:
avrdude -c buspirate -P /dev/ttyUSB0 -p attiny85 -v
7. Program the Trinket via the Bus Pirate:
avrdude -c buspirate -P /dev/ttyUSB0 -p attiny85 -U flash:w:trinket.hex
Success will be indicated by avrdude reporting:
avrdude done. Thank you.
8. Fin.
Best luck!
====
Useful references:
Microcontroller cheat sheet:
http://tinkerlog.com/2009/06/18/microco ... eat-sheet/
Adafruit - Repairing bootloader:
https://learn.adafruit.com/introducing- ... bootloader
Bus Pirate AVR Programming:
http://dangerousprototypes.com/docs/Bus ... rogramming
--
Jeffrey Hundstad