Atmega Programming With USBtinyISP and Arduino

60K4512

Intro: Atmega Programming With USBtinyISP and Arduino

This is to show how you can program an Amtel Atmega chip using a USB AVR programmer.  I have chosen the USBtinyISP v3.0 to program.  I picked mine up on ebay for i think $10.  I will also be using the Arduino software, because it is free and I like the language it uses.  You are welcome to use any software you would like, and I will try to post more tutorials on using different software options as I get around to them.

First download the software from arduino.cc.  Next we will need to set up header pins for our AVR programmer.  To program the Atmega328 I am using here we are going to need the 6 pin header.  Be very careful with the images I have posted.  They are from the Arduino website.  The one labeling each of the pins can be misleading.  You need to pay special attention the actual numbers of each pin.  Compare the second image and third image above to understand where pin number 1 is.

First make your connections to the Atmega328.  There are 3 data connections, 1 reset, and 2 power/ground connections.  (making up the 6 pin header)

Once you have made sure all six connections are correct, plug your ISP programmer into your computer and the 6 pin header into the ISP programmer.  

You should see the power light come on on the ISP programmer.  Make sure you have downloaded the driver for the programmer.  I had some issues with installing the driver.  I ended up needing to go into my computer's device manager, select the programmer and choose update driver, and then manually direct it to the driver installer.  It was a pain, but once I did that everything was working correctly.

Next open up arduino.  For this tutorial we are going to just use the Blink example program. I have changed the LED pin to Digital pin 9 though.  The reason for doing this is because we cannot have any low-impedance (resistance) on any of the pins the ISP programmer uses.  the original pin in the arduino example is 13, which is the pin that the SCK connection uses.

So open up the "BLINK" example and change the LED pin to pin 9.

Next we have two options.  Either you can hold shift and press upload, or go to file>upload using programmer.

either way, it should verify your program, then the busy LED on the ISP programmer should flash, and the program should be uploaded to the atmega328.

And that should be it.  Place a resistor and LED on pin 9 (the bottom right pin) and it should flash on and off


Thats the easiest set-up to using an ISP programmer.  I will hopefully add more options as I am able to get through them.



Now there is one downside to this.  You no longer have the serial connection to the arduino software that you do with a normal FTDI connection.  The upside is we no-longer need the bootloader, so when our chip is powered, the program starts immediately.  You can still use serial commands, you just cant watch them in the serial monitor without the FTDI cable connected too.


11 Comments

DrNicker I hope you will be able to help! Your my last hope :( I am trying to program a ATiny 85 for a piranha project. I am using exactly the same ATtiny ISP as you are, with the same driver issues. Win8.1 says it has encountered a problem while trying to load the driver " the third party INF does not contain digital signature information " and I don't think Win8.1 allows me to "install it anyways". Your suggestions would be greatly appreciated.

Download the drivers from the Adafruit USBTinyISP project. Those are digitally signed and Win 8.1 does not complain.

Does the ATMEGA328 used here have bootloader already in it, if yes, can this process be used without bootloader present in ic? Is there any process to upload .hex file directly in the absence of bootloader?

This uC does not have the bootloader. You would use the same USBtinyISP to program the bootloader and then you can use the normal FTDI method to program it. There should be an option in the arduino menus to program the bootloader

sorry, could you please explain what driver are you mentioning in "Make sure you have downloaded the driver for the programmer."
I am looking for help I just got a Usbtiny which I wish to use it seems to be the same as the one above in the picture.
And being I have never programmed a chip of any kind before I a lost for words Firstly I would like to know if I could get a schematic of the bread board arangment above built by the DrNicker that would be handy and also help in where to start any help would be greatly appreaceated
Check out my other tutorial on that breadboard layout. This will tell you everything you need to know to re-create it.

https://www.instructables.com/id/Build-your-own-Arduino-Bare-Bone-System/
I can't find any 'file> upload using programmer' option in the arduino software.
Shift+upload also does nothing.
And how do you set the port? I'm using ladyada's USBtinyISP programmer and it doesn't come under any port.
Check that you are using the most recent version of Arduino. I have also posted an image here of my menu that you can compare yours to.

To choose the port you select Tools>Serial Port>COM#, (# being the USB port you are connecting to, you may need to try each option if you don't know which one it is)
Ah thanks. I might need to install the newer version. Also, ladyada's USBtinyISP doesn't incorporate all USB device features. So it doesn't come under any COM port. It appears under LibUSB Devices in Device Manager in Windows
Yea, the cheaper USBtinyISP devices take some fiddling with. I had a lot of trouble getting the drivers sorted out and working for mine. You just need to trouble shoot and mess around with everything until you get it working.