Programming (Bootloader or otherwise) using USBTiny

In the past few days, I’ve picked up a USBTiny and have been playing with that, Atmel Studio and the project I’ve been putting together using code from another author. In a breadboard, I’ve made a real basic ISP interface for the 328P chips. I can program them in this using Atmel Studio without issue. The problem is with Arduino bootloaders. Right now, the only way I know to do this is using an uno loaded up with a script to program the bootloader. I’d like to be able to do this using the USBTiny on some kind of board that has a ZIF socket (homemade or otherwise), rather than plugging a chip into an arduino and running a sketch any time I want to flash a bootloader.

I’ve found the ‘Tools > Programmer’ and ‘Tools > Burn Bootloader’ options in the Arduino IDE, and one would think those would be the ideal option… but I’ve had two different outcomes, neither successful. One was it saying the signature didn’t match and to use -F to override. I searched on that, found some info related to it and modified the signature in the ‘avrdude.conf’, but I then got the same message but saying it was looking for the new signature. The other outcome was the USBTiny hanging with the program LED on and Arduino IDE hanging at ‘burning the bootloader could take a minute’ (Or something to that effect).

Does anyone know of a good way to program the bootloaders using a simple ISP setup?

Avrdude is the way for isp uploading.
by the way, which fuses are set on your 328p.

Make sure you select correct board in the "Boards" menu of Arduino ISP. If you programming ATMega328p with internal oscillator, there's no default setting in Arduino ISP for that, look up and download boards.txt file for that...

I have AVRDude tied in with Atmel Studio, which I’ve been using to work with the wireless temp & Sensor humidity project I’ve been putting together with the code from IOT-Projects.com, and it’s been working well, except for one thing: I have two kinds of 328P chips - some with a signature of ‘0x1e 0x95 0x14’ and some with a signature of ‘0x1e 0x95 0x0F’. I found info on modifying the avrdude.conf to change the signature and that works, but what wasn’t clear was how to make it so BOTH are recognized for the 328P chip so I don’t have to keep modifying the fole to go back and forth. What I found for accomplishing that was to add ‘part parent “m328” id = “m328pu”; desc = “ATmega328PU”; signature = 0x1e 0x95 0x14; ocdrev = 1;’ to avrdude.conf. It’s not clear (to me) exactly where and how that should be added to the file…

Since my first post, I built a board with a ZIF socket and a six pin ISP header so I can easily program the chips without the arduino. But I think I programmed over all my Uno chips so I will eventually need to program one with the Uno bootloader.

Looks like the fuses on at least one of my 328Ps are:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: Expected signature for ATMEGA328P is 1E 95 14
avrdude: reading lfuse memory:

Reading | ################################################## | 100% 0.01s

avrdude: writing output file "<stdout>"
0xff
avrdude: reading hfuse memory:

Reading | ################################################## | 100% 0.01s

avrdude: writing output file "<stdout>"
0xde
avrdude: reading efuse memory:

Reading | ################################################## | 100% 0.01s

avrdude: writing output file "<stdout>"
0x5
avrdude: reading lock memory:

Reading | ################################################## | 100% 0.00s

avrdude: writing output file "<stdout>"
0x3f

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

WinAVR seems questionable - what’s a good gui front end for AVRDude?

As far as clocking, right now I’m running everything with 16Mhz resonators. I may look to run the sensor nodes of the current project at 8Mhz so I can run it on 3.3v rather than 5v, but I’ll probably just find some 8Mhz resonators.

I assume programming the bootloader would be just programming the hex file in the ‘bootloaders\atmega8’ folder (or ‘lilypad’ if I want to run an internal clock)?

I guess you got both 328P and 328 without 'P', hence the different signature.

And yes, burning bootloader is just uploading the bootloader .hex BUT also setting the fuses (for example, Uno bootloader requires external clock fuse, lilypad requires internal clock fuse). Setting fuses with avr studio is easy but Im used to avrdude commands (I dont like GUI, just avrdude on console)

mart256:
I guess you got both 328P and 328 without 'P', hence the different signature.

And yes, burning bootloader is just uploading the bootloader .hex BUT also setting the fuses (for example, Uno bootloader requires external clock fuse, lilypad requires internal clock fuse). Setting fuses with avr studio is easy but Im used to avrdude commands (I dont like GUI, just avrdude on console)

That takes us back to the last question - what's the best way to modify the config file so that both signatures are recognized as the proper chip and it successfully programs?

I assume you're referring to Atmel Studio - I found the 'Burn Bootloader' option in there and that hangs the same way Arduino IDE does...

Any suggestions as to how I could modify the config file so that it recognizes both the '1E 95 14' and '1E 95 0F' signatures as the same chip so I don't have to go back and forth and change the config file each time I want to flash the other one?