V-Tech Design

USBTinyISP as a primary programmer

Why do this? Currently Arduino platforms rely on a bootloader and Serial communications to download programs you develop in the Arduino IDE. Following these instructions allows you to skip the bootloader and doesn't require Serial communications at all.

This guide assumes the following:

  • You have a Arduino on a Breadboard or Doduino (See the Homepage)
  • A Blank ATMEGA328P-PU (PDIP)
  • A 16mhz crystal, which the fuse setting rely on
  • A USBTinyISP variant (eBay,Sparkfun or AdaFruit)
  • Installed Arduino 1.05 or 1.5 Beta

Connections to the USBTinyISP are as follows:

USBTinyISP ATMEG328P
SCK PIN 19 (Arduino 13)
MISO PIN 18 (Arduino 12)
MOSI PIN 17 (Arduino 11)
RST PIN 1 (Arduino Reset) through a 120 ohm resistor
VCC PIN 7 (Arduino VCC/5V)
GND PIN 8 (Arduino GND)

After building a DIY breadboard (See: Standalone Arduino) or Doduino (See: Building a DoDuino) and completing the above proceed with programming the fuses on your Atmel chip :

Step 1: The first step will depend on the USBTinyISP you purchased. Generally follow the driver installation directions from the manufacturer, but if you run into driver issue then try downloading this version USBTiny Drivers (view raw file) and follow the directions in the readme enclosed in the zip file.

Step 2: Download AVR Setup and install. i.e. C:\WINAVR. I will referred to as {YourPath} for the rest of this document

Step 3: Connect your USBTinyISP to your ATMEGA328P as described above and complete the following test: {YourPath}\bin\avrdude.exe -b 19200 -c usbtiny -p m328p -v

You should get a response that includes something like:

  • Reading | ############################## | 100% 0.09s
  • avrdude.exe: Device signature = 0x1e950f
  • avrdude.exe: safemode: lfuse reads as xx
  • avrdude.exe: safemode: hfuse reads as xx
  • avrdude.exe: safemode: efuse reads as xx
  • avrdude.exe: safemode: Fuses OK (H:xx, E:xx, L:xx)

If you have trouble check the connections and power to the Arduino. If everything looks good it's time to burn the fuses to let the chip know you are intending to use a 16mhz external crystal:

{YourPath}\bin\avrdude.exe -b 19200 -c usbtiny -p m328p -v -U lock:w:0x3f:m -U efuse:w:0x05:m -U hfuse:w:0xda:m -U lfuse:w:0xff:m -e -u

You should get a response that includes something like:

  • ...
  • avrdude: safemode: lfuse reads as FF
  • avrdude: safemode: hfuse reads as DA
  • avrdude: safemode: efuse reads as 05
  • avrdude: safemode: Fuses OK (H:05, E:DA, L:FF)
  • ...

Note: It is possible to use different crystal speeds, but requires an understanding of Atmel Fuse bits. For more information on fuses check out the following websites:

Next we need to modify the Arduino boards.txt file to ensure it knows about the USBTinyISP. You will find it in these locations if you installed 1.05 or 1.5 in the default location:

  • C:\Program Files\Arduino\hardware\arduino\boards.txt v1.05
  • C:\Program Files\Arduino\hardware\arduino15\boards.txt v1.5

Add an entry above the first line of #'s at the top of the file:

  • ##########################################
  • usbtinyisp328.name=ATmega328 w/ USBtinyISP
  • usbtinyisp328.upload.tool=avrdude
  • usbtinyisp328.upload.using=usbtinyisp
  • usbtinyisp328.upload.maximum_size=32768
  • usbtinyisp328.upload.speed=115200
  • usbtinyisp328.build.mcu=atmega328p
  • usbtinyisp328.build.f_cpu=16000000L
  • usbtinyisp328.build.core=arduino
  • usbtinyisp328.build.variant=standard

Last modify the Arduino programmers.txt file to slow down to connection to to the target from the USBTinyISP. You will find it in these locations if you installed 1.05 or 1.5 in the default location:

  • C:\Program Files\Arduino\hardware\arduino\programmers.txt v1.05
  • C:\Program Files\Arduino\hardware\arduino15\programmers.txt v1.5

Add an entry below "usbtinyisp.protocol=usbtiny":

  • usbtinyisp.speed=19200

Note: You can also use File->Upload Using Programmer, if you select the USBTinyISP under Tools->Programmer. I prefer the above method as it allows you to just click the compile and upload buttons just as you would if you had a bootloader installed.

Lastly we should test the blink program to ensure everything works. In order for this to work you need an LED connected to Pin 19 on the ATMEGA328P, which is the standard Arduino Pin 13. To complete the test restart your Arduino IDE to allow the new entry added into boards.txt to show up and complete the following:

  • Open the Arduino IDE
  • Select Tools->Board->"ATmega328 w/ USBtinyISP"
  • Select File->Examples->01.Basic->Blink
  • Click the Upload button (Arrow below the Edit menu)

If all went well you should have a blinking LED with a 1 second interval between on and off.

That's it! Enjoy your Arduino platform.