ATTiny Burn Bootloader erases Flash

Hey all,

We're trying to do the following:

Using an Arduino UNO as ISP: Flash an ATTiny85 with code that will ultimately use Pin5/ADC0/!RESET/Leg1 as an analog input. Set the Fuses such that the Tiny disables reset functionality of that pin Then use the device.

The problem I'm having is that setting the fuse is accomplished with the "Burn Bootloader" tool and this tool seems to clean the flash after setting the fuses. This is a problem as the fuse that I just set prevents me from flashing my firmware back onto the chip :( (This is of course possible with a High Voltage Programmer, but I don't have one)

My question is: Can I adjust the behavior of the Burn Bootloader tool so that after setting the fuses, it does not reflash the device.

Or: Is there a way to use avrdude commands manually when I'm using an Arduino as ISP?

Thanks for your time -Kyle

You should do (or rather you should have done) one of 2 things:

  1. Put a bootloader on the chip that will allow uploads when the reset pin is disabled, and then when you burn the bootloader and set the fuse to disable the reset pin, you will still be able to upload programs to it. Example bootloaders to use are Micronucleus and Trinket bootloaders.

or

  1. Upload your program to the chip using ISP programming, make sure it is a good program, then use avrdude command line to set the fuse to disable the reset pin. That will effectively lock the program into the chip.

You’ve bricked your chip, but no big deal. Since you have an Uno, you have most of a high voltage programmer right there. This is probably something you’ll want to learn anyway if you’re going to be messing around with ATtiny’s and messing with disabling reset, I suggest read these 2 articles:

Use either one to unbrick your ATtiny85.

KyleHagen: Is there a way to use avrdude commands manually when I'm using an Arduino as ISP?

This is my favorite way: In the Arduino IDE preferences you can checkmark the show verbose output during upload. Then when you burn the bootloader (don't use the fuse setting that disables reset), you'll be shown the avrdude command lines. Copy and paste the command lines to a notepad and use as a model to run avrdude manually, to do stuff like just set one fuse.

Hi! Thanks for the quick reply.

dmjlambert: You should do (or rather you should have done) one of 2 things:

  1. Put a bootloader on the chip that will allow uploads when the reset pin is disabled, and then when you burn the bootloader and set the fuse to disable the reset pin, you will still be able to upload programs to it. Example bootloaders to use are Micronucleus and Trinket bootloaders.

This sounds like a great idea. Is this easily achievable using the Uno as an ISP? If so we have some 6kB of flash we dont need using the 85.

dmjlambert: 2. Upload your program to the chip using ISP programming, make sure it is a good program, then use avrdude command line to set the fuse to disable the reset pin. That will effectively lock the program into the chip.

Being a total noob with avr, is it possible to achieve this using an Uno talking SPI to the Tiny? If so, any good tutorials or resources you might know of?

dmjlambert: You've bricked your chip, but no big deal.

I have some more - I'll rescue bricks when we can build the high voltage programmer.

Thanks for the feedback

Also - if you use a USBAsp, there's eXtremeBurner AVR, which can easily set fuses with GUI.

KyleHagen: Can I adjust the behavior of the Burn Bootloader tool so that after setting the fuses, it does not reflash the device.

It sounds like you have other good alternatives figured out already but if you did want to accomplish this you could create a hardware package for your attiny with the right fuse values in the package's boards.txt and edit the avrdude recipes in the package's platform.txt to only set fuses when you do Burn Bootloader.

Thank you everyone.

I used: http://www.engbedded.com/fusecalc/ and http://www.atmel.com/images/atmel-2586-avr-8-bit-microcontroller-attiny25-attiny45-attiny85_datasheet.pdf (page 148) to determine the correct fuse settings

http://www.ladyada.net/learn/avr/avrdude.html To learn AVR.

I used the follow ing AVR line once it was installed get what I needed:

avrdude -c Arduino -p attiny85 -P COM29 -b19200 -U efuse:w:0xFF:m -U hfuse:w:0x57:m -U lfuse:w:0xE2:m -v

Thanks everyone. Your help and response time are really quite exceptional. Gotta love this community.

All the best

  1. Put a bootloader on the chip that will allow uploads when the reset pin is disabled, and then when you burn the bootloader and set the fuse to disable the reset pin, you will still be able to upload programs to it. Example bootloaders to use are Micronucleus and Trinket bootloaders.

KyleHagen: Is this easily achievable using the Uno as an ISP? If so we have some 6kB of flash we dont need using the 85.

I should have mentioned this means to upload you would need to outfit your ATtiny85 with the USB circuitry you can find in the schematics for the Trinket or Digispark. Yes, you can use Uno as an ISP for any fuse burning, sketch uploading via ISP, or bootloader burning.