5.4. AVR programming using the Arduino IDE

Note: We do not expect this tutorial to be useful for typical Arduino-compatible boards, which usually come with a bootloader that can be used to load sketches. If you want to use the programmer as a USB-to-serial adapter along with the Arduino IDE to load sketches onto a board using its existing bootloader, see Section 6.3.

The following tutorial covers the steps needed to program AVRs in Windows using the Arduino Software (IDE) and a Pololu USB AVR Programmer v2.x. In this tutorial, we will use the programmer to directly load sketches (programs) onto an AVR using its ISP interface. This could be useful if you want to program a bare AVR chip using the Arduino IDE.

  1. Download and install the Arduino Software.
  2. Open the Arduino IDE. A new template program will automatically be generated.
  3. In the Tools menu, find the Programmer menu, and then select Atmel STK500 development board. If you do not see an entry for the STK500, you should update to Arduino 1.6.5 or later.
  4. In the Ports menu, select the port that corresponds to the programmer’s programming port. If you are not sure which of the listed serial ports is the programming port, see Section 4.5.
  5. In the Boards menu, select an entry corresponding to the AVR microcontroller or board you want to program. If there are no entries in the Boards menu that exactly match the target you are trying to program, then there might be one that is close enough to work. For example, if you are programming an ATmega328P running at 16 MHz, then the entry for the “Arduino/Genuino Uno” will probably work since it uses the same processor and clock speed. If needed, you can add a new entry to the Boards menu by locating the “hardware/arduino/avr/boards.txt” file inside your Arduino IDE installation and editing it.
  6. In the Sketch menu, select Upload with Programmer. This is a special version of the upload command that causes the Arduino software to run AVRDUDE using the settings for an STK500 instead of using the board’s usual bootloader. It should load the default template program onto your AVR. If everything worked, the message “Done uploading.” will appear in the status bar.

If an error occurs during the upload step, the first step to debugging it should be to turn on verbose output during uploading. In the Arduino IDE, under the File menu, selected Preferences, then check the upload checkbox on the line that says Show verbose output during, and click OK. Now when you try to upload again, you will see detailed information about how the Arduino IDE is attempting to load your program. One of the most important things to look at is the command used to invoke AVRDUDE: you should make sure that it says “-cstk500”, uses the right COM port, and specifies the right AVR microcontroller using the “-p” option. For more help troubleshooting, see Section 5.6.

Related Products

Pololu USB AVR Programmer v2
Pololu USB AVR Programmer v2.1
Log In
Pololu Robotics & Electronics
Shopping cart
(702) 262-6648
Same-day shipping, worldwide
Menu
Shop Blog Forum Support
My account Comments or questions? About Pololu Contact Ordering information Distributors