Pololu USB AVR Programmer v2 User’s Guide

Pololu USB AVR Programmer v2.1.

View document on multiple pages.
You can also view this document as a printable PDF.

1. Overview
1.1. Supported AVR microcontrollers
1.2. Supported operating systems
2. Contacting Pololu
3. Pinout and components
4. Getting started
4.1. Installing Windows drivers and software
4.2. Installing Linux software
4.3. Installing macOS software
4.4. LED feedback
4.5. Determining serial port names
5. AVR programming
5.1. Connecting an AVR for programming
5.2. AVR programming using Microchip Studio
5.2.1. Faster programming with F5 in Microchip Studio
5.3. AVR programming using AVR Studio 4
5.4. AVR programming using the Arduino IDE
5.5. AVR programming using AVRDUDE
5.6. Troubleshooting AVR programming issues
5.7. Programming faster
5.8. Reading and writing from EEPROM and flash
5.9. Setting fuses and lock bits
5.10. Using the clock output to revive AVRs
6. USB-to-TTL serial adapter
6.1. Asynchronous serial communication
6.2. Serial control lines
6.3. Connecting to a serial bootloader
7. Power settings and status
8. Using VCC or VBUS to supply power
9. Upgrading firmware

1. Overview

<table class="picture_with_caption right"><tr><td style="max-width: 300px"><a href="https://a.pololu-files.com/picture/0J7110.1200.jpg?761369531ef4e6422775aa38735c5dd7" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J7110&quot;,&quot;caption&quot;:&quot;\u003cp\u003ePololu USB AVR Programmer v2 or v2.1 with included hardware.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J7110.98x98.jpg?761369531ef4e6422775aa38735c5dd7&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J7110.600x480.jpg?761369531ef4e6422775aa38735c5dd7&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J7110.1200.jpg?761369531ef4e6422775aa38735c5dd7&quot;,&quot;longest_side&quot;:1200}]" data-picture-id="0J7110" data-picture-longest_side="1200" src="https://a.pololu-files.com/picture/0J7110.300.jpg?761369531ef4e6422775aa38735c5dd7" /></a></td><p></tr><tr><th style="max-width: 300px"><p>Pololu USB AVR Programmer v2 or v2.1 with included hardware.</p></th></tr></table></p> <p>The <a href="/product/3170"><strong>Pololu USB AVR Programmer v2</strong></a> and the <a href="/product/3172"><strong>Pololu USB AVR Programmer v2.1</strong></a> are compact, low-cost in-system programmers (ISP) for AVR microcontrollers from Atmel (now a part of Microchip). The programmer provides an interface for transferring a compiled AVR program from your computer to the target AVR&#8217;s flash memory, allowing it to run the program. It is a good solution for programming AVR-based controllers like our <a href="/category/239/a-star-328pb-micro">A-Star 328PB Micro</a> and <a href="/category/187/orangutan-robot-controllers">Orangutan robot controllers</a>. It can also be used to update, replace, or remove the bootloader on <a href="/category/125/arduino-compatible">Arduino boards</a> and our Arduino-compatible <a href="/category/149/a-star-programmable-controllers">A-Star 32U4 controllers</a>. This programmer is designed to work well with both 3.3&nbsp;V and 5&nbsp;V devices, and it can even be configured to provide power to the target device in low-power systems.</p> <p>This guide covers both the Pololu USB AVR Programmer v2 (Pololu item #3170) and the Pololu USB AVR Programmer v2.1 (Pololu item #3172). Unless otherwise specified, the information in this guide applies to both versions. This guide often uses the designation &#8220;Pololu USB AVR Programmer v2.x&#8221; to refer to both versions at the same time. Many of the pictures in this user&#8217;s guide show a specific version of the programmer, but both versions have the same size and pinout, so you can refer to the pictures to learn about your programmer even if you have a different version from what is shown.</p> <h3>Features and specifications</h3> <ul> <li>Connects to a computer through USB via a <a href="/product/2072">USB A to Micro-B cable</a> (not included)</li> <li>Emulates an STK500 programmer through virtual COM port interface</li> <li>Works with standard AVR programming software, including Microchip Studio (Atmel Studio), AVRDUDE, and the Arduino IDE</li> <li>Configuration software available for Windows, Mac OS X, and Linux</li> <li>Supports both 3.3&nbsp;V and 5&nbsp;V devices; can automatically switch operating voltage based on detected target VCC</li> <li>Can optionally power the target at 3.3&nbsp;V or 5&nbsp;V in low-power systems</li> <li>USB-to-TTL serial adapter functionality for general-purpose serial communication</li> <li>Provides a 100&nbsp;kHz clock output, which can be useful for reviving misconfigured AVRs</li> <li>All I/O pins are protected with 470&nbsp;Ω resistors</li> <li><a href="/product/972">6-pin ISP cable</a> and a 1×6 <a href="/product/1065">double-sided male header</a> included</li> </ul> <h3>Distinguishing different Pololu programmers</h3> <p>If you have a blue programmer and you are not sure what version it is, look at the name printed on the bottom side. If you have a green programmer, refer to the pictures below.</p> <p>Please note that this guide only applies to the Pololu USB AVR Programmer v2 (Pololu item <strong>#3170</strong>) and the Pololu USB AVR Programmer v2.1 (Pololu item <strong>#3172</strong>), which are both blue. If you have the original version of the Pololu USB AVR Programmer (Pololu item #1300), you can find its user&#8217;s guide <a href="/docs/0J36">here</a>. If you have the Orangutan USB programmer (Pololu item #740), you can find its user&#8217;s guide <a href="/docs/0J6">here</a>.</p> <table class="picture_with_caption center"><tr><td style="max-width: 400px"><a href="https://a.pololu-files.com/picture/0J7112.1200.jpg?46ba0582315e933c09a174c33681e08b" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J7112&quot;,&quot;caption&quot;:&quot;\u003cp\u003ePololu USB AVR Programmer v2, bottom view.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J7112.98x98.jpg?46ba0582315e933c09a174c33681e08b&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J7112.600x480.jpg?46ba0582315e933c09a174c33681e08b&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J7112.1200.jpg?46ba0582315e933c09a174c33681e08b&quot;,&quot;longest_side&quot;:1200}]" data-picture-id="0J7112" data-picture-longest_side="1200" src="https://a.pololu-files.com/picture/0J7112.400.jpg?46ba0582315e933c09a174c33681e08b" /></a></td><p></tr><tr><th style="max-width: 400px"><p>Pololu USB AVR Programmer v2, bottom view.</p></th></tr></table> <table class="picture_with_caption center"><tr><td style="max-width: 400px"><a href="https://a.pololu-files.com/picture/0J8582.1200.jpg?37b86a966ffe9784f7d3c24804d63d83" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J8582&quot;,&quot;caption&quot;:&quot;\u003cp\u003ePololu USB AVR Programmer v2.1, bottom view.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J8582.98x98.jpg?37b86a966ffe9784f7d3c24804d63d83&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J8582.600x480.jpg?37b86a966ffe9784f7d3c24804d63d83&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J8582.1200.jpg?37b86a966ffe9784f7d3c24804d63d83&quot;,&quot;longest_side&quot;:1200}]" data-picture-id="0J8582" data-picture-longest_side="1200" src="https://a.pololu-files.com/picture/0J8582.400.jpg?37b86a966ffe9784f7d3c24804d63d83" /></a></td></tr><tr><th style="max-width: 400px"><p>Pololu USB AVR Programmer v2.1, bottom view.</p></th></tr></table> <table class="picture_with_caption center"><tr><td style="max-width: 500px"><a href="https://a.pololu-files.com/picture/0J7114.1200.jpg?0e1fea25eed1e122b4dd7a8864e52d8e" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J7114&quot;,&quot;caption&quot;:&quot;\u003cp\u003eFrom left to right: the original Orangutan USB Programmer, the Pololu USB AVR Programmer, and the Pololu USB AVR Programmer v2 (which looks almost the same as v2.1).\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J7114.98x98.jpg?0e1fea25eed1e122b4dd7a8864e52d8e&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J7114.600x480.jpg?0e1fea25eed1e122b4dd7a8864e52d8e&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J7114.1200.jpg?0e1fea25eed1e122b4dd7a8864e52d8e&quot;,&quot;longest_side&quot;:1200}]" data-picture-id="0J7114" data-picture-longest_side="1200" src="https://a.pololu-files.com/picture/0J7114.500.jpg?0e1fea25eed1e122b4dd7a8864e52d8e" /></a></td></tr><tr><th style="max-width: 500px"><p>From left to right: the original Orangutan USB Programmer, the Pololu USB AVR Programmer, and the Pololu USB AVR Programmer v2 (which looks almost the same as v2.1).</p></th></tr></table></p>

1.1. Supported AVR microcontrollers

<p>The programmer should work with all AVRs that can be programmed with the AVR ISP (in-system programming) interface, which is also known as in-circuit serial programming (ICSP), serial programming, or serial downloading, but it has not been tested with all devices. We expect it to work with most AVRs in the megaAVR (ATmega) family. It does <ins>not</ins>&nbsp;work with the megaAVR 0-series of AVRs (e.g. the ATmega4809). This programmer works with some members of the tinyAVR (ATtiny) family, but it does <ins>not</ins>&nbsp;support the Tiny Programming Interface (TPI), and it does <ins>not</ins>&nbsp;support the Unified Program and Debug Interface (UPDI). It does <ins>not</ins>&nbsp;work with the XMEGA family or with 32-bit AVRs. The programmer features upgradable firmware, allowing updates for future devices.</p> <p>The programmer is incompatible with some AVR boards that have extra components on their programming pins. The programmer&#8217;s I/O pins are protected by 470&nbsp;Ω resistors, so pull-up or pull-down resistors on those lines that have a value below 5&nbsp;kΩ might prevent the programmer from properly communicating with the AVR. For example, the programmer does <ins>not</ins>&nbsp;work with the Arduino Nano due to the 1&nbsp;kΩ pull-up resistor on its reset line.</p>

1.2. Supported operating systems

<p>We support using the Pololu USB AVR Programmer v2.x and its configuration software on Windows 7, Windows 8, Windows 10, Windows 11, Linux, and macOS 10.11 or later. The programmer is not likely to work on Windows 10 IoT Core, which is very different from the normal desktop versions of Windows. We have tested the programmer and its software on Raspbian Jessie for the Raspberry Pi, so we expect it to work on that version of Raspbian and later versions.</p>

2. Contacting Pololu

<table class="picture_with_caption right"><tr><td><a href="https://a.pololu-files.com/picture/0J7115.1200.jpg?7c5cce7c9875653e4628a4c53d01d658" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J7115&quot;,&quot;caption&quot;:&quot;\u003cp\u003ePololu USB AVR Programmer v2, connected to a USB cable (not included).\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J7115.98x98.jpg?7c5cce7c9875653e4628a4c53d01d658&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J7115.600x480.jpg?7c5cce7c9875653e4628a4c53d01d658&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J7115.1200.jpg?7c5cce7c9875653e4628a4c53d01d658&quot;,&quot;longest_side&quot;:1200}]" data-picture-id="0J7115" data-picture-longest_side="1200" src="https://a.pololu-files.com/picture/0J7115.200.jpg?7c5cce7c9875653e4628a4c53d01d658" /></a></td><p></tr></table></p> <p>We would be delighted to hear from you about any of your projects and about your experience with the Pololu USB AVR Programmer <span>v2.x</span>. You can <a href="/contact">contact us</a> directly or post on our <a href="http://forum.pololu.com/">forum</a>. Tell us what we did well, what we could improve, what you would like to see in the future, or anything else you would like to say!</p> <div class="clear"></div>

3. Pinout and components

<table class="picture_with_caption center wide"><tr><td style="max-width: 600px"><a href="https://a.pololu-files.com/picture/0J8587.1200.jpg?e615d6556d0a7b9485cc4a783f1ede69" class="noscript-fallback"><img alt="" class="wide zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J8587&quot;,&quot;caption&quot;:&quot;\u003cp\u003ePololu USB AVR Programmer v2.1, labeled top view.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J8587.98x98.jpg?e615d6556d0a7b9485cc4a783f1ede69&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J8587.600x480.jpg?e615d6556d0a7b9485cc4a783f1ede69&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J8587.1200.jpg?e615d6556d0a7b9485cc4a783f1ede69&quot;,&quot;longest_side&quot;:1200}]" data-picture-id="0J8587" data-picture-longest_side="1200" src="https://a.pololu-files.com/picture/0J8587.600.jpg?e615d6556d0a7b9485cc4a783f1ede69" /></a></td><p></tr><tr><th style="max-width: 600px"><p>Pololu USB AVR Programmer v2.1, labeled top view.</p></th></tr></table></p> <p>The Pololu USB AVR Programmer v2.x connects to a computer&#8217;s USB port via a <a href="/product/2072">USB A to Micro-B cable</a> (not included).</p> <p>The programmer has a standard <strong>6-pin AVR ISP connector</strong> for programming AVRs. It connects to the target AVR device via an included <a href="/product/972">6-pin ISP cable</a>. The cable has a keyed connector that matches the programmer&#8217;s shrouded header, making it impossible to plug the cable into the programmer in the wrong orientation. The older 10-pin ISP connections are not directly supported, but it is easy to create or purchase a 6-pin-to-10-pin ISP adapter. The six pins on the ISP connector are:</p> <ol> <li><strong>MISO</strong>: The &#8220;Master Input, Slave Output&#8221; line for SPI communication with the target AVR. This is called PDO in some AVR datasheets. The programmer is the master, so this line is an input.</li> <li><strong>VCC</strong>: By default, this line is an input that the programmer uses to measure the voltage of the target AVR (see <a href="#7">Section 7</a>). This line can also be configured to power the target device (see <a href="#8">Section 8</a>).</li> <li><strong>SCK</strong>: The clock line for SPI communication with the target AVR. The programmer is the master, so this line is an output during programming.</li> <li><strong>MOSI</strong>: The &#8220;Master Output, Slave Input&#8221; line for SPI communication with the target AVR. This is called PDI in some AVR datasheets. The programmer is the master, so this line is an output during programming.</li> <li><b><font style="text-decoration: overline;">RST</font></b>: The target AVR&#8217;s reset line. This line is used as an output driven low during programming to hold the AVR in reset.</li> <li><strong>GND</strong>: Ground. This line should be connected to the target device&#8217;s ground.</li> </ol> <p>When the programmer is not actively programming an AVR, the MISO, SCK, and MOSI pins are all high-impedance inputs.</p> <p>The end of the programmer has a <strong>6-pin serial header</strong> with a pinout that is similar to commonly-available FTDI cables and breakout boards. The programmer comes with a <a href="/product/2706">6-pin right-angle female header</a> soldered in. The six pins on this header are:</p> <ol> <li><strong>GND</strong>: Ground. This is connected to the GND pin on the ISP header and the GND pin of the USB cable.</li> <li><strong>A</strong>: By default, this line is just an input that is pulled up, but it can be configured to do serial control/handshaking functions (see <a href="#6.1">Section 6.1</a>).</li> <li><strong>VCC</strong>: This is connected to the VCC pin on the ISP connector. By default it is an input, but it can be configured as an output for powering other devices (see <a href="#7">Section 7</a> and <a href="#8">Section 8</a>).</li> <li><strong>TX</strong>: This is a TTL serial output pin that can send data to another device (see <a href="#6.1">Section 6.1</a>).</li> <li><strong>RX</strong>: This is a TTL serial input pin that can receive data from another device (see <a href="#6.1">Section 6.1</a>).</li> <li><strong>B</strong>: By default, this line is configured to be the DTR (Data Terminal Ready) signal. It can be configured for other serial/handshaking functions (see <a href="#6.1">Section 6.1</a>) or it can be used as a clock output signal (see <a href="#5.10">Section 5.10</a>).</li> </ol> <table class="picture_with_caption center"><tr><td style="max-width: 500px"><a href="https://a.pololu-files.com/picture/0J8583.1200.jpg?11f0339a3db0e89ead272c4016270764" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J8583&quot;,&quot;caption&quot;:&quot;\u003cp\u003ePololu USB AVR Programmer v2.1, bottom view with dimensions.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J8583.98x98.jpg?11f0339a3db0e89ead272c4016270764&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J8583.600x480.jpg?11f0339a3db0e89ead272c4016270764&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J8583.1200.jpg?11f0339a3db0e89ead272c4016270764&quot;,&quot;longest_side&quot;:1652}]" data-picture-id="0J8583" data-picture-longest_side="1652" src="https://a.pololu-files.com/picture/0J8583.500.jpg?11f0339a3db0e89ead272c4016270764" /></a></td><p></tr><tr><th style="max-width: 500px"><p>Pololu USB AVR Programmer v2.1, bottom view with dimensions.</p></th></tr></table></p> <p>The programmer&#8217;s circuit board is 0.6&Prime; wide and 1.35&Prime; long. With the right-angle female header, it is about 1.69&Prime; long.</p> <p>The programmer has 4 LEDs that indicate its status. The behavior of these LEDs is described in detail in <a href="#4.4">Section 4.4</a>.</p> <p>The <strong>VBUS</strong> line is connected directly to the USB cable&#8217;s 5V power supply line. It can be used to power external devices as long as you are careful not to draw too much current from it (see <a href="#8">Section 8</a>).</p> <h3>Included accessories</h3> <p>The Pololu USB AVR Programmer v2.x comes with the accessories shown in the picture below. The <a href="/product/972">6-pin ISP cable</a> can be used to program AVRs. The 1×6 <a href="/product/1065">double-sided male header</a> can be plugged into the serial header to effectively reverse its gender (making it possible to connect that header to a <a href="/category/28/solderless-breadboards">breadboard</a> or female <a href="/category/65/premium-jumper-wires">jumper wires</a>). A <a href="/product/2072">USB A to Micro-B cable</a> is required and <strong>not</strong> included.</p> <table class="picture_with_caption center"><tr><td style="max-width: 500px"><a href="https://a.pololu-files.com/picture/0J7110.1200.jpg?761369531ef4e6422775aa38735c5dd7" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J7110&quot;,&quot;caption&quot;:&quot;\u003cp\u003ePololu USB AVR Programmer v2 or v2.1 with included hardware.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J7110.98x98.jpg?761369531ef4e6422775aa38735c5dd7&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J7110.600x480.jpg?761369531ef4e6422775aa38735c5dd7&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J7110.1200.jpg?761369531ef4e6422775aa38735c5dd7&quot;,&quot;longest_side&quot;:1200}]" data-picture-id="0J7110" data-picture-longest_side="1200" src="https://a.pololu-files.com/picture/0J7110.500.jpg?761369531ef4e6422775aa38735c5dd7" /></a></td><p></tr><tr><th style="max-width: 500px"><p>Pololu USB AVR Programmer v2 or v2.1 with included hardware.</p></th></tr></table></p>

4. Getting started

4.1. Installing Windows drivers and software

<p class="note_warning">Please note that these drivers will only work for the <strong>v2.x versions</strong> of the Pololu USB AVR Programmer, not the original item #1300 Pololu USB AVR Programmer. If you have the original programmer, which has a green PCB instead of blue, you will need to <a href="/docs/0J36/3.a">install the drivers specific to that device</a>.</p> <p>The Pololu USB AVR Programmer v2.x has drivers and configuration software for Windows. The drivers tell Windows how to recognize the programmer and set it up correctly. The drivers are needed for Windows Vista, Windows 7, and Windows 8. For Windows 10 and later, the drivers are optional but recommended. The configuration software allows you to change the programmer&#8217;s settings and can be helpful for troubleshooting.</p> <p>Before connecting your programmer to a computer running Microsoft Windows, we recommend installing its drivers and software by following these steps.</p> <ol> <li>Download and install the <a href="/file/0J1119/pololu-usb-avr-programmer-v2-1.1.0-win.msi"><strong>Pololu USB AVR Programmer v2 Software and Drivers for Windows</strong></a> (9MB msi). Please note that the drivers and software in this installer will only work with the <strong>Pololu USB AVR Programmer v2</strong> and <strong>v2.1</strong>, which are blue-colored.</li> <li>During the installation, Windows will ask you if you want to install the drivers. Click &#8220;Install&#8221; to proceed.</li> <li>After the installation has finished, your computer should automatically set up the necessary drivers when you connect a Pololu USB AVR Programmer v2.x, in which case no further action from you is required.</li> </ol> <p>After installing the drivers and plugging the programmer in via USB, if you go to your computer&#8217;s Device Manager, you should see three entries for the programmer as shown below:</p> <table class="picture_with_caption center wide"><tr><td style="max-width: 600px"><a href="https://a.pololu-files.com/picture/0J7121.1200.png?3a6023f435745dfdf74e064770ae915b" class="noscript-fallback"><img alt="" class="wide zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J7121&quot;,&quot;caption&quot;:&quot;\u003cp\u003eWindows 10 Device Manager showing the Pololu USB AVR Programmer v2\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J7121.98x98.jpg?3a6023f435745dfdf74e064770ae915b&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J7121.600x480.jpg?3a6023f435745dfdf74e064770ae915b&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J7121.1200.png?3a6023f435745dfdf74e064770ae915b&quot;,&quot;longest_side&quot;:432}]" data-picture-id="0J7121" data-picture-longest_side="432" src="https://a.pololu-files.com/picture/0J7121.600.png?3a6023f435745dfdf74e064770ae915b" /></a></td><p></tr><tr><th style="max-width: 600px"><p>Windows 10 Device Manager showing the Pololu USB AVR Programmer v2</p></th></tr></table></p> <p>The programmer configuration software consists of two programs:</p> <ul> <li>The Pololu USB AVR Programmer v2 Configuration Utility is a graphical user interface (GUI) for configuring the programmer and viewing its status. You can find the configuration utility in your start menu by searching for it or looking in the Pololu folder.</li> <li>The Pololu USB AVR Programmer v2 Command-line Utility (pavr2cmd) is a command-line utility that can do everything that the GUI can do. You can open a terminal and type <code>pavr2cmd</code> with no arguments to a see a summary of its options.</li> </ul> <h3>COM ports</h3> <p>In the &#8220;Ports (COM &amp; LPT)&#8221; category of your Device Manager, you should see two COM ports with names like &#8220;Pololu USB AVR Programmer v2.1 Programming Port&#8221; and &#8220;Pololu USB AVR Programmer v2.1 TTL Serial Port&#8221;.</p> <p>You might see that the COM ports are named &#8220;USB Serial Device&#8221; in the Device Manager instead of having descriptive names. This can happen if you are using Windows 10 or later and you plugged the programmer into your computer before installing our drivers for it. In that case, Windows will set up your programmer using the default Windows serial driver (usbser.inf), and it will display &#8220;USB Serial Device&#8221; as the name for each port. The ports will be usable, but it will be hard to distinguish the ports from each other because of the generic name shown in the Device Manager. We recommend fixing the names in the Device Manager by right-clicking on each &#8220;USB Serial Device&#8221; entry, selecting &#8220;Update Driver Software&#8230;&#8221;, and then selecting &#8220;Search automatically for updated driver software&#8221;. Windows should find the drivers you already installed, which contain the correct name for the port.</p> <p>If you are using Windows 10 or later and choose not to install the drivers, the programmer will still be usable. See <a href="#4.5">Section 4.5</a> for information about determining which COM port is which.</p> <p>If you want to change the COM port numbers assigned to your programmer, you can do so using the Device Manager. Double-click a COM port to open its properties dialog, and click the &#8220;Advanced…&#8221; button in the &#8220;Port Settings&#8221; tab. Windows will associate this COM port number with the USB serial number of your programmer and use it whenever you plug that programmer in. If you have multiple programmers but only plug in one at a time, it can be helpful to assign each programmer to the same set of COM ports.</p> <h3>Native USB interface</h3> <p>There should be an entry for the programmer in the &#8220;Universal Serial Bus devices&#8221; category with a name like &#8220;Pololu USB AVR Programmer v2.1&#8221;. This represents the programmer&#8217;s native USB interface, and it is used by our configuration software. The programmer&#8217;s native USB interface implements Microsoft OS 2.0 Descriptors, so it will work on Windows 8.1 or later without needing any drivers. The driver we provide is needed for earlier versions of Windows.</p> <h3>USB troubleshooting for Windows</h3> <p>If the software you are using cannot communicate properly with the programmer, a good first step is to just unplug it from everything and then plug it back in again.</p> <p>You should also make sure you are specifying the right COM port name in your software. AVR programming software should usually connect to the programmer&#8217;s programming port. If you want to communicate using the RX and TX lines, you should connect to the TTL serial port. You can find the right COM port names by following the instructions in <a href="#4.5">Section 4.5</a>.</p> <p>If that does not work, you should try to locate all the entries for the programmer in the Device Manager. Be sure to look in these categories: &#8220;Other devices&#8221;, &#8220;Ports (COM &amp; LPT)&#8221; and &#8220;Universal Serial Bus devices&#8221;. It might help to click &#8220;View&#8221;, select &#8220;Devices by Connection&#8221;, and then expand entries until you can find entries relating to the programmer. When viewing devices by connection, the programmer is normally represented by a &#8220;USB Composite Device&#8221; entry that has three child entries which should look like the entries shown in the screenshot above. Any entry corresponding to the programmer might have an incorrect name if the wrong driver is installed or there was an error. You can tell if an entry corresponds to the programmer by unplugging the programmer and checking to see whether the entry disappears. Finding the programmer&#8217;s entries in the Device Manager can often give you a good idea of what is wrong.</p> <p>If the programmer has no entries in your Device Manager, you probably have a low-level hardware problem. Try using a different USB cable and a different USB port. Make sure your cable is not a charging-only cable.</p> <p>If the programmer does have entries in the Device Manager, but they don&#8217;t look like the screenshot above, then you might have a driver installation problem. To ask Windows to use the right drivers, you can right-click on each entry, select &#8220;Update Driver Software&#8230;&#8221;, select &#8220;Browse my computer for driver software&#8221;, and then enter the location of the &#8220;drivers&#8221; folder for the programmer. This is typically &#8220;C:\Program Files (x86)\Pololu\USB AVR Programmer v2\drivers&#8221;.</p> <p>Do <strong>not</strong> attempt to fix driver issues in your Device Manager using the &#8220;Add legacy hardware&#8221; option. This is only for older devices that do not support Plug-and-Play, so it will not help. If you already tried this option, we recommend unplugging the programmer from USB and then removing any entries you see for the programmer by right-clicking on them and selecting &#8220;Uninstall&#8221;. Do <strong>not</strong> check the checkbox that says &#8220;Delete the driver software for this device&#8221;.</p> <table class="picture_with_caption center wide"><tr><td style="max-width: 600px"><a href="https://a.pololu-files.com/picture/0J7124.1200.png?5ca895e239264fb8b057beacf4aca89f" class="noscript-fallback"><img alt="" class="wide zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J7124&quot;,&quot;caption&quot;:&quot;\u003cp\u003eThe Pololu USB AVR Programmer v2 Configuration Utility in Windows 10.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J7124.98x98.jpg?5ca895e239264fb8b057beacf4aca89f&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J7124.600x480.jpg?5ca895e239264fb8b057beacf4aca89f&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J7124.1200.png?5ca895e239264fb8b057beacf4aca89f&quot;,&quot;longest_side&quot;:579}]" data-picture-id="0J7124" data-picture-longest_side="579" src="https://a.pololu-files.com/picture/0J7124.600.png?5ca895e239264fb8b057beacf4aca89f" /></a></td><p></tr><tr><th style="max-width: 600px"><p>The Pololu USB AVR Programmer v2 Configuration Utility in Windows 10.</p></th></tr></table></p>

4.2. Installing Linux software

<p>To install the software for the Pololu USB AVR Programmer v2.x on a computer running Linux, follow these steps:</p> <ol> <li>Download the version for your system from this list: <ul> <li><a href="/file/0J1474/pololu-usb-avr-programmer-v2-1.1.0-linux-x86.tar.xz"><strong>Pololu USB AVR Programmer v2 Software for Linux (x86)</strong></a> (8MB xz) &mdash; works on 32-bit and 64-bit systems</li> <li><a href="/file/0J1475/pololu-usb-avr-programmer-v2-1.1.1-linux-rpi.tar.xz"><strong>Pololu USB AVR Programmer v2 Software for Linux (Raspberry Pi)</strong></a> (6MB xz) &mdash; works on the Raspberry Pi and might work on other ARM Linux systems</li> </ul></li> <li>In a terminal, use <code>cd</code> to navigate to the directory holding the downloaded file. For example, run <code>cd ~/Downloads</code> if it was downloaded to the &#8220;Downloads&#8221; folder in your home directory.</li> <li>Run <code>tar -xvf pololu-usb-avr-programmer-v2-*.tar.xz</code> to extract the software. If you downloaded multiple versions of the software, you should use an exact file name instead of an asterisk.</li> <li>Run <code>sudo pololu-usb-avr-programmer-v2-*/install.sh</code> to install the software. You will need to have sudo privilege on your system and you might need to type your password at this point. Look at the output of the script to see if any errors happened.</li> <li>After the installation has completed, plug the programmer into your computer via USB. If you already connected the programmer earlier, unplug it and plug it in again to make sure the newly-installed udev rules are applied.</li> <li>Run <code>pavr2cmd --list</code> to make sure the software can detect the programmer. This command should print the serial number and product name of the programmer. If it prints nothing, see the &#8220;USB troubleshooting for Linux&#8221; section below.</li> <li>Run <code>pavr2gui</code> to start the configuration utility.</li> </ol> <p>The programmer does not require any driver installation on Linux. The Linux kernel&#8217;s <strong>cdc_acm</strong> module creates entries for the programmer&#8217;s virtual serial ports with names like <code>/dev/ttyACM0</code> and <code>/dev/ttyACM1</code> so that they can be used by software, and other parts of Linux allow access to the programmer&#8217;s native USB interface. For more information about determining the names assigned to the programmer&#8217;s virtual serial ports, see <a href="#4.5">Section 4.5</a>.</p> <p>This programmer configuration software consists of two programs:</p> <ul> <li>The Pololu USB AVR Programmer v2 Configuration Utility (pavr2gui) is a graphical user interface (GUI) for configuring the programmer and viewing its status. You can open a terminal and type <code>pavr2gui</code> to run it.</li> <li>The Pololu USB AVR Programmer v2 Command-line Utility (pavr2cmd) is a command-line utility that can do everything that the GUI can do. You can open a terminal and type <code>pavr2cmd</code> with no arguments to a see a summary of its options.</li> </ul> <p>The programmer&#8217;s configuration software for Linux is statically compiled; it does not depend on any shared libraries. The <a href="https://github.com/pololu/pololu-usb-avr-programmer-v2">source code for the software</a> is available.</p> <h3>Software installation troubleshooting for Linux</h3> <p>If you do not have sudo privilege or you do not remember your password, you can skip running <code>install.sh</code> and just run the programs directly from the directory you extracted them to. You should also consider moving the software to a more permanent location and adding that location to your PATH as described below.</p> <p>If you get a &#8220;No such file or directory&#8221; error while running <code>./install.sh</code>, it is possible that your system is missing one of the directories that the install script assumes will be present. Please <a href="/contact">contact</a> us to let us know about your system so we can consider supporting it better in the future.</p> <p>If you get the error &#8220;command not found&#8221; when you try to run <code>pavr2cmd</code> or <code>pavr2gui</code>, then you should run <code>echo $PATH</code> to see what directories are on your PATH, and then make sure one of those directories contains the programmer executables or symbolic links to them. The installer puts symbolic links in <code>/usr/local/bin</code>, so if that directory is not on your PATH, you should run <code>export PATH=$PATH:/usr/local/bin</code> to add it. Also, you might want to put that line in your <code>~/.profile</code> file so the directory will be on your PATH in future sessions.</p> <p>If you get the error &#8220;cannot execute binary file: Exec format error&#8221; when you try to run <code>pavr2cmd</code> or <code>pavr2gui</code>, then it is likely that you downloaded the wrong version of the software from the list above. If all of the listed versions give you this error, you will probably need to compile the software from source by following the instructions in <a href="https://github.com/pololu/pololu-usb-avr-programmer-v2/blob/master/BUILDING.md">BUILDING.md</a> in the <a href="https://github.com/pololu/pololu-usb-avr-programmer-v2">source code</a>. Please <a href="/contact">contact</a> us to let us know about your system so we can consider supporting it better in the future.</p> <p>If the text in the configuration utility window is not visible, make sure that the <code>.ttf</code> font file that we ship with the software is in the same directory as the <code>pavr2gui</code> executable.</p> <h3>USB troubleshooting for Linux</h3> <p>If the programmer&#8217;s configuration software cannot connect to your programmer after you plug it into the computer via USB, the tips here can help you troubleshoot the programmer&#8217;s USB connection.</p> <p>If you have connected any electronic devices to your programmer besides the USB cable, you should disconnect them.</p> <p>You should look at the LEDs of the programmer. If the LEDs are off, then the programmer is probably not receiving power from the USB port. If the green LED is flashing very briefly once per second, then the programmer is receiving power from USB, but it is not receiving any data. These issues can be caused by using a broken USB port, using a broken USB cable, or by using a USB charging cable that does not have data wires. Using a different USB port and a different USB cable, both of which are known to work with other devices, is a good thing to try. Also, if you are connecting the programmer to your computer via a USB hub, try connecting it directly.</p> <p>If the programmer&#8217;s green LED is on all the time or flashing slowly, but you can&#8217;t connect to it in the programmer&#8217;s configuration software, then there might be something wrong with your computer. A good thing to try is to unplug the programmer from USB, reboot your computer, and then plug it in again.</p> <p>If you get a &#8220;Permission denied&#8221; error when trying to connect to the programmer, you should make sure to copy the <code>99-pololu.rules</code> file into <code>/etc/udev/rules.d</code> and then unplug the programmer and plug it back in again. The install script normally takes care of installing that file for you.</p> <p>If that does not help, you should try running <code>lsusb</code> to list the USB devices recognized by your computer. Look for the Pololu vendor ID, which is <strong>1ffb</strong>. You should also try running <code>dmesg</code> right after plugging in the programmer to see if there are any messages about it.</p>

4.3. Installing macOS software

<p>To install the configuration software for the Pololu USB AVR Programmer v2.x on a computer running macOS, follow these steps:</p> <ol> <li>Download the <a href="/file/0J1120/pololu-usb-avr-programmer-v2-1.1.0-macos.pkg"><strong>Pololu USB AVR Programmer v2 Software for Mac OS X</strong></a> (7MB pkg).</li> <li>Double-click on the downloaded file to run it, and follow the instructions.</li> </ol> <p>The programmer does not require any driver installation on Mac OS X. The AppleUSBCDCACM driver that comes with the operating system creates entries for the programmer&#8217;s serial ports with names like <code>/dev/cu.usbmodem00022331</code> so that they can be used by software, and other parts of Mac OS X allow access to the programmer&#8217;s native USB interface. For more information about determining the names assigned to the programmer&#8217;s virtual serial ports, see <a href="#4.5">Section 4.5</a>.</p> <p>The programmer&#8217;s configuration software consists of two programs:</p> <ul> <li>The Pololu USB AVR Programmer v2 Configuration Utility is a graphical user interface (GUI) for configuring the programmer and viewing its status. You can run the configuration utility by clicking on &#8220;Pololu USB AVR Programmer v2&#8221; in your computer&#8217;s Appllications folder.</li> <li>The Pololu USB AVR Programmer v2 Command-line Utility (pavr2cmd) is a command-line utility that can do everything that the GUI can do. You can open a Terminal and type <code>pavr2cmd</code> with no arguments to a see a summary of its options.</li> </ul> <h3>Software installation troubleshooting for macOS</h3> <p>If you get the error &#8220;command not found&#8221; when you try to run <code>pavr2cmd</code> or <code>pavr2gui</code>, then you should try starting a new Terminal window. The installer for the programmer&#8217;s software adds a file named <code>99-pololu-pavr2</code> in the <code>/etc/paths.d</code> directory to make sure the software gets added to your PATH, but the change will not take effect until you open a new Terminal window.</p> <p>The programmer&#8217;s configuration software only works on macOS 10.11 or later.</p> <h3>USB troubleshooting for macOS</h3> <p>If the programmer&#8217;s configuration software cannot connect to your programmer after you plug it into the computer via USB, the tips here can help you troubleshoot the programmer&#8217;s USB connection.</p> <p>If you have connected any electronic devices to your programmer besides the USB cable, you should disconnect them.</p> <p>You should look at the LEDs of the programmer. If the LEDs are off, then the programmer is probably not receiving power from the USB port. If the green LED is flashing very briefly once per second, then the programmer is receiving power from USB, but it is not receiving any data. These issues can be caused by using a broken USB port, using a broken USB cable, or by using a USB charging cable that does not have data wires. Using a different USB port and a different USB cable, both of which are known to work with other devices, is a good thing to try. Also, if you are connecting the programmer to your computer via a USB hub, try connecting it directly.</p> <p>If the programmer&#8217;s green LED is on all the time or flashing slowly, but you can&#8217;t connect to it in the software, then there might be something wrong with your computer. A good thing to try is to unplug the programmer from USB, reboot your computer, and then plug it in again.</p> <p>Another thing to try is to run <code>dmesg</code> right after plugging in the programmer to see if there are any messages about it.</p>

4.4. LED feedback

<table class="picture_with_caption center"><tr><td style="max-width: 500px"><a href="https://a.pololu-files.com/picture/0J8587.1200.jpg?e615d6556d0a7b9485cc4a783f1ede69" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J8587&quot;,&quot;caption&quot;:&quot;\u003cp\u003ePololu USB AVR Programmer v2.1, labeled top view.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J8587.98x98.jpg?e615d6556d0a7b9485cc4a783f1ede69&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J8587.600x480.jpg?e615d6556d0a7b9485cc4a783f1ede69&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J8587.1200.jpg?e615d6556d0a7b9485cc4a783f1ede69&quot;,&quot;longest_side&quot;:1200}]" data-picture-id="0J8587" data-picture-longest_side="1200" src="https://a.pololu-files.com/picture/0J8587.500.jpg?e615d6556d0a7b9485cc4a783f1ede69" /></a></td><p></tr><tr><th style="max-width: 500px"><p>Pololu USB AVR Programmer v2.1, labeled top view.</p></th></tr></table></p> <p>The Pololu USB AVR Programmer v2.x has four LEDs to indicate its status.</p> <p>Most of the information provided by the LEDs is also available in the programmer&#8217;s configuration software. To see the programmer&#8217;s current status, just start the Pololu USB AVR Programmer v2 Configuration Utility or run <code>pavr2cmd -s</code> from a command prompt. However, learning the LED behavior can be helpful if you want to quickly make sure that the programmer is in the right state before using it.</p> <p>The <span style="color:#227c48;font-weight:bold;">green</span> <b>LED</b> indicates the USB status of the device. When you connect the programmer to the computer via the USB cable, the green LED will start blinking slowly. The blinking continues until the programmer gets a particular message from the computer that indicates that the programmer is recognized. After the programmer gets that message, the green LED will be on, but it will flicker briefly when there is USB activity. During suspend mode (e.g. while the computer is sleeping or while USB is disconnected and the programmer is inadvertently powered through its VCC pin), the green LED will be off but blink briefly every second to indicate that the programmer is powered but sleeping.</p> <p>The <span style="color:#ff0000;font-weight:bold;">red</span> <b>LED</b> indicates an error or warning. When it is blinking, it means that the target AVR&#8217;s VCC power line is outside of the acceptable range. The red LED will blink about once per second, and the blinks will last about one half second (512&nbsp;ms). When the red LED is on solid, it means that the last attempt at programming resulted in an error. You can determine the source of the error by running the programmer&#8217;s configuration software. If the target&#8217;s VCC line goes out of the acceptable range, the red LED will go back to blinking and no longer display the previous error even if target power is restored.</p> <p>The <strong>two</strong> <span style="color:#b69f31;font-weight:bold;">yellow</span> <strong>LEDs</strong> indicate information about the programmer&#8217;s regulator mode, the current operating voltage of the programmer, and whether VCC is an output or not. More information about these settings can be found in the <a href="/docs/0J67/7">Power monitoring and regulator settings</a> section and the <a href="/docs/0J67/8">Using VCC or VBUS to supply power</a> section.</p> <p>If VCC is configured to be an <strong>input</strong> (which is the default setting), the yellow LEDs behave as described below:</p> <ul> <li><!-- AUTO_WAIT --> If the programmer&#8217;s regulator mode is Auto (which is the default and means that it will automatically switch between 3.3&nbsp;V and 5&nbsp;V), and no power is currently detected on the target&#8217;s VCC line, then both yellow LEDs will be off. This is the default state of the programmer if you just plug it into a computer without changing any settings or connecting anything else. The red LED will be blinking because the target power is not detected.</li> <li><!-- 3V3_WAIT --> If the programmer&#8217;s regulator mode is 3.3&nbsp;V (meaning that it always operates at 3.3&nbsp;V), but the power on the the target&#8217;s VCC line is not within the acceptable range, then yellow LED 1 will blink once per second. Yellow LED 1 turns on a little bit (128&nbsp;ms) after the red LED turns on, and turns off at the same time as the red LED. This blinking pattern is also used if the programmer&#8217;s regulator mode is Auto, and the programmer is currently operating at 3.3&nbsp;V, but the voltage on the target&#8217;s VCC line is above the acceptable range.</li> <li><!-- 3V3_SEEN --> If the programmer is currently operating at 3.3&nbsp;V and the target&#8217;s VCC level is within the acceptable range, then yellow LED 1 will blink briefly (64&nbsp;ms) once per second.</li> <li><!-- 5V_WAIT --> If the programmer&#8217;s regulator mode is 5&nbsp;V (meaning that it always operates at 5&nbsp;V), but the power on the target&#8217;s VCC line is not within the acceptable range, then both yellow LEDs will blink once per second. Yellow LED 1 turns on a little bit (128&nbsp;ms) after the red LED turns on. Yellow LED 2 turns on a little bit (128&nbsp;ms) after yellow LED 1. Both yellow LEDs turn off at the same time as the red LED. This blinking pattern is also used if the programmer&#8217;s regulator mode is Auto, and the programmer is currently operating at 5&nbsp;V, but the voltage on the target&#8217;s VCC line is not within the acceptable range.</li> <li><!-- 5V_SEEN --> If the programmer is currently operating at 5&nbsp;V and the target&#8217;s VCC level is within the acceptable range, then both yellow LEDs will blink briefly (64&nbsp;ms) once per second. Yellow LED 2 will blink a little bit after yellow LED 1 blinks.</li> </ul> <p>If VCC is configured to be a <strong>3.3&nbsp;V output</strong>, then yellow LED 1 will blink eight times per second to warn you. If VCC is configured to be a <strong>5&nbsp;V output</strong>, then both yellow LEDs will blink eight times per second to warn you. If you want VCC to be an output but you do not want to see the yellow LEDs blinking so fast, you can change the &#8220;VCC Output Indicator&#8221; setting from &#8220;Blinking&#8221; to &#8220;Steady&#8221; using the configuration software. This makes the yellow LEDs just stay on solid instead of blinking eight times per second.</p> <p>Note that the LED blinking patterns described above are not directly affected by measurements of the programmer&#8217;s actual operating voltage (VDD). In the descriptions above, a phrase like &#8220;operating at 3.3&nbsp;V&#8221; just means that the programmer is trying to operate at that voltage.</p> <p>To ensure that the programmer shows a complete blinking pattern instead of switching quickly between two or more patterns, the yellow LED blinking pattern is only updated once per second. So if you make a change to your system, you might have to wait for up to one second to see the LEDs respond.</p> <p>The LEDs will be noticeably brighter when the programmer is operating at 5&nbsp;V as opposed to 3.3&nbsp;V.</p> <h3>Startup blinking</h3> <p>When the programmer starts running, it tries to detect if it was reset by some special condition. You can see the cause of the last reset in the configuration software&#8217;s &#8220;Last device reset&#8221; field, so it is usually easiest to just look there to diagnose any problem you are having with the programmer getting reset. The programmer also provides LED feedback to indicate why it was reset. If the programmer was reset by anything other than a standard power-on reset (which happens whenever power is turned on), the programmer will blink the red LED and/or yellow LED 1 in a special way for a second before it starts operating. The way these LEDs blink depend on the cause of the reset:</p> <ul> <li>If a brown-out reset occurred, the red LED will blink four times while the yellow LEDs stay off. A brownout-reset can happen if VCC is configured as an output and you are trying to power a device that has too much capacitance or draws to much current, as described in <a href="#8">Section 8</a>.</li> <li>If the programmer was reset by the reset line on its microcontroller, yellow LED 1 will blink four times while the red LED stays off. This should almost never happen.</li> <li>If the programmer was reset by its watchdog timer, then the red LED and yellow LED 1 will blink together four times. This is the expected behavior if the programmer was in bootloader mode and then received the USB command to quit the bootloader and start running the firmware.</li> <li>If any other type of non-standard reset happens, then the red LED will be on solid while yellow LED 1 blinks four times.</li> </ul> <h3>Bootloader mode</h3> <p>In bootloader mode, which is used for updating the firmware of the programmer itself and should only rarely be needed, the LEDs behave differently. The green LED still indicates the USB status, but it is different: after the programmer gets a particular message from the computer that indicates that the programmer is recognized, the green LED will start doing a double blinking pattern every 1.4&nbsp;seconds. The yellow LED will usually be on solid, but it will blink quickly whenever a USB command is received. The red LED will be on if and only if there is no firmware currently loaded on the device.</p>

4.5. Determining serial port names

<p>The USB interface of the Pololu USB AVR Programmer v2.x provides two virtual serial ports: the programming port and the TTL serial port. To use either of these serial ports, you will usually have to know the name assigned to the serial port by the operating system (e.g. &#8220;COM6&#8221;).</p> <p>The easiest way to find the serial port names is to run the configuration software we provide. You can run the Pololu USB AVR Programmer v2 Configuration Utility and look in the upper left corner to see the serial port names. In a command prompt, you can run <code>pavr2cmd -s</code> to see the port names. With either of these two methods, a port name will be displayed as &#8220;(unknown)&#8221; if it cannot be determined.</p> <p>You can also run <code>pavr2cmd --prog-port</code> or <code>pavr2cmd --ttl-port</code> in a command prompt. Each of these commands simply prints the name assigned to the corresponding serial port. These commands are useful if you want to write a script that connects to one of the programmer&#8217;s serial ports but you do not know ahead of time what name it will have. These commands will print an error message on the standard error pipe if anything goes wrong.</p> <p>In <strong>Windows</strong>, you can also determine the COM port names by looking in the Device Manager. Usually, both ports will be displayed in the &#8220;Ports (COM &amp; LPT)&#8221; category. The descriptive name of the port (e.g. &#8220;Pololu USB AVR Programmer v2 Programming Port&#8221;) will be displayed, followed by the COM port name in parentheses. If the descriptive name is just &#8220;USB Serial Device&#8221; for both of the programmer&#8217;s ports, then you can identify the two ports by double-clicking on each one and looking at the &#8220;Hardware Ids&#8221; property in the &#8220;Details&#8221; tab. The programming port will have the ID <code>USB\VID_1FFB&amp;PID_00B0&amp;MI_01</code>, while the TTL serial port will have the ID <code>USB\VID_1FFB&amp;PID_00B0&amp;MI_03</code>. If you have trouble finding the ports in the Device Manager, see the USB driver troubleshooting tips in <a href="#4.1">Section 4.1</a>.</p> <p>In <strong>Linux</strong>, the programmer&#8217;s two serial ports should show up as devices with names like <code>/dev/ttyACM0</code> and <code>/dev/ttyACM1</code>. The name with the lower number usually corresponds to the programming port. You can run <code>ls /dev/ttyACM*</code> to list those ports. These serial port names are not generally reliable, because if <code>/dev/ttyACM0</code> is already in use when the programmer gets plugged in, then its ports will be assigned to higher numbers. If you want more reliable names for the serial ports, you can use the symbolic links in the <code>/dev/serial/by-id/</code> directory. The links for the programmer ending with <code>if01</code> are for the programming port, while the links ending with <code>if03</code> are for the TTL serial port. For example, the programming port of a programmer with serial number 00001234 would be something like:</p> <pre>/dev/serial/by-id/usb-Pololu_Corporation_Pololu_USB_AVR_Programmer_v2_00001234-if01</pre> <p>In <strong>Mac OS X</strong>, the programmer&#8217;s two serial ports will have names like <code>/dev/cu.usbmodem00022331</code>. The name with the lower number usually corresponds to the programming port. You can run <code>ls /dev/cu.usbmodem*</code> to list those ports. You can also find these names by running <code>ioreg -trc IOSerialBSDClient</code>. The output from this command is somewhat complicated, but you should see entries for the Pololu USB AVR Programmer <span>v2.x</span>. An entry for the programmer with <code>IOUSBHostInterface@2</code> in it corresponds to the programming port, while an entry with <code>IOUSBHostInterface@4</code> in it corresponds to the TTL serial port.</p>

5. AVR programming

5.1. Connecting an AVR for programming

<table class="picture_with_caption right"><tr><td style="max-width: 300px"><a href="https://a.pololu-files.com/picture/0J7117.1200.jpg?64a74185a24d43bd92b02346ec068956" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J7117&quot;,&quot;caption&quot;:&quot;\u003cp\u003eThe Pololu USB AVR Programmer v2 (bottom) connected to an A-Star 32U4 Prime SV for programming.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J7117.98x98.jpg?64a74185a24d43bd92b02346ec068956&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J7117.600x480.jpg?64a74185a24d43bd92b02346ec068956&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J7117.1200.jpg?64a74185a24d43bd92b02346ec068956&quot;,&quot;longest_side&quot;:1200}]" data-picture-id="0J7117" data-picture-longest_side="1200" src="https://a.pololu-files.com/picture/0J7117.300.jpg?64a74185a24d43bd92b02346ec068956" /></a></td><p></tr><tr><th style="max-width: 300px"><p>The Pololu USB AVR Programmer v2 (bottom) connected to an A-Star 32U4 Prime SV for programming.</p></th></tr></table></p> <p>This section explains how to connect the programmer to an AVR microcontroller using its in-system programming (ISP) interface, which is also known as in-circuit serial programming (ICSP), serial programming, or serial downloading.</p> <p>Many AVR boards feature a 6-pin male ISP connector. If your board has a connector like that, you can simply connect the programmer to the ISP header using the included 6-pin ISP cable. If your board does not have a shrouded ISP connector to ensure proper orientation of the cable, then you should make sure the cable is oriented so that pin 1 on the cable&#8217;s connector lines up with pin 1 on your target device. The ISP cable&#8217;s connector has a faint triangle on it that points to pin 1, and the red wire in the cable also indicates pin 1.</p> <div class="clear"></div> <p>If your AVR does not have a 6-pin ISP connector, then you will need to connect each of the six programming pins from the programmer to the corresponding pin on the AVR. The programmer&#8217;s ISP pins are labeled on the bottom of the programmer and also in the diagram below. The names we use for the pins on the AVR programmer match the names typically used for the ISP pins in AVR datasheets. For example, the ATmega328P datasheet indicates that MOSI is one of the names of pin PB3, so you would need to connect the MOSI pin on the AVR programmer to the PB3/MOSI pin on the ATmega328P. By referring to your specific AVR&#8217;s datasheet and the schematic of the circuit board the AVR is on (if applicable), you should be able to identify connection points for the AVR&#8217;s GND, MISO, MOSI, SCK, <span style="text-decoration: overline;">RST</span>, and VCC pins. You will generally need six <a href="/category/65/premium-jumper-wires">wires</a> to make all the required connections.</p> <table class="picture_with_caption center"><tr><td style="max-width: 400px"><a href="https://a.pololu-files.com/picture/0J8587.1200.jpg?e615d6556d0a7b9485cc4a783f1ede69" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J8587&quot;,&quot;caption&quot;:&quot;\u003cp\u003ePololu USB AVR Programmer v2.1, labeled top view.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J8587.98x98.jpg?e615d6556d0a7b9485cc4a783f1ede69&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J8587.600x480.jpg?e615d6556d0a7b9485cc4a783f1ede69&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J8587.1200.jpg?e615d6556d0a7b9485cc4a783f1ede69&quot;,&quot;longest_side&quot;:1200}]" data-picture-id="0J8587" data-picture-longest_side="1200" src="https://a.pololu-files.com/picture/0J8587.400.jpg?e615d6556d0a7b9485cc4a783f1ede69" /></a></td><p></tr><tr><th style="max-width: 400px"><p>Pololu USB AVR Programmer v2.1, labeled top view.</p></th></tr></table></p> <p>You will also need to make sure that the target device is powered on. The AVR microcontroller must be powered during programming, and the programmer does not supply power by default. If you do want to supply power to the target AVR from the programmer, see <a href="#8">Section 8</a>.</p>

5.2. AVR programming using Microchip Studio

<!-- TODO: would be nice to update all the screenshots here for Windows 10 and Microchip Studio 7. Icons and keyboard shortcuts have changed. --><p class="note">If you have an Orangutan or 3pi Robot or wish to use the Pololu AVR C/C++ Library for some other reason, we recommend following the <strong><a href="/docs/0J51">Pololu AVR Programming Quick Start Guide</a></strong> instead of this tutorial.</p> <p>The following tutorial covers the steps needed to program AVRs in Windows using <a href="https://www.microchip.com/en-us/tools-resources/develop/microchip-studio"><strong>Microchip Studio</strong></a> (formerly known as Atmel Studio) and a Pololu USB AVR Programmer <span>v2.x</span>. Microchip Studio is a free integrated development environment (IDE) provided by Microchip for Microsoft Windows systems.</p> <p>You will need to:</p> <ul> <li>Download and install <a href="https://www.microchip.com/en-us/tools-resources/develop/microchip-studio">Microchip Studio</a> by following the instructions on Microchip&#8217;s website. This tutorial was written for Microchip Studio 7.0.</li> <li>Install the programmer&#8217;s drivers on your computer. See <a href="#4.1">Section 4.1</a> for instructions.</li> </ul> <!-- p(note). *Windows Vista users:* You will need to use Atmel Studio 6.2 because that is the latest version of Atmel Studio that supports Windows Vista. If your device is not listed in the Device Programming window, you might need to add devices to Atmel Studio as described in the "Adding Devices to Atmel Studio 6":/docs/0J36/3.b.1 section of the user's guide for older programmer. --><p>After you have completed these prerequisites, you can create a new Microchip Studio project:</p> <ol><li>Open Microchip Studio and click <strong>New Project</strong>. In the New Project dialog, select <strong>GCC C Executable Project</strong> for the template. Enter the project name and location. In this tutorial, we will name our project &#8220;BlinkLED&#8221; and put it in the &#8220;C:\&#8221; directory, but you can choose a different name and location if you would like. Uncheck the <strong>Create directory for solution</strong> box to simplify the directory structure of your project. Click <strong>OK</strong>.</li></ol> <table class="picture_with_caption center"><tr><td style="max-width: 550px"><a href="https://a.pololu-files.com/picture/0J3709.1200.png?1b1b75c413be423088c724f2799252ed" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J3709&quot;,&quot;caption&quot;:&quot;\u003cp\u003eThe New Project dialog of Atmel Studio 6.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J3709.98x98.jpg?1b1b75c413be423088c724f2799252ed&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J3709.600x480.jpg?1b1b75c413be423088c724f2799252ed&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J3709.1200.png?1b1b75c413be423088c724f2799252ed&quot;,&quot;longest_side&quot;:800}]" data-picture-id="0J3709" data-picture-longest_side="800" src="https://a.pololu-files.com/picture/0J3709.550.jpg?1b1b75c413be423088c724f2799252ed" /></a></td><p></tr><tr><th style="max-width: 550px"><p>The New Project dialog of Atmel Studio 6.</p></th></tr></table></p> <ol><li value="2">In the Device Selection window, select the device name of your specific AVR. Click <strong>OK</strong> to create the project.</li></ol> <table class="picture_with_caption center"><tr><td style="max-width: 550px"><a href="https://a.pololu-files.com/picture/0J3710.1200.png?1985c45df53ffef1e6f083053ca50124" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J3710&quot;,&quot;caption&quot;:&quot;\u003cp\u003eThe Device Selection dialog of Atmel Studio 6.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J3710.98x98.jpg?1985c45df53ffef1e6f083053ca50124&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J3710.600x480.jpg?1985c45df53ffef1e6f083053ca50124&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J3710.1200.png?1985c45df53ffef1e6f083053ca50124&quot;,&quot;longest_side&quot;:776}]" data-picture-id="0J3710" data-picture-longest_side="776" src="https://a.pololu-files.com/picture/0J3710.550.jpg?1985c45df53ffef1e6f083053ca50124" /></a></td><p></tr><tr><th style="max-width: 550px"><p>The Device Selection dialog of Atmel Studio 6.</p></th></tr></table></p> <ol><li value="3">Remove the template code that was automatically placed in BlinkLED.c and replace it with the code below:</li></ol> <pre name="code" class="c">&#x000A;#define F_CPU 20000000 // AVR clock frequency in Hz, used by util/delay.h&#x000A;#include &lt;avr/io.h&gt;&#x000A;#include &lt;util/delay.h&gt;&#x000A;&#x000A;int main() {&#x000A; DDRD |= (1&lt;&lt;1); // set LED pin PD1 to output&#x000A; while (1) {&#x000A; PORTD |= (1&lt;&lt;1); // drive PD1 high&#x000A; _delay_ms(100); // delay 100 ms&#x000A; PORTD &amp;= ~(1&lt;&lt;1); // drive PD1 low&#x000A; _delay_ms(900); // delay 900 ms&#x000A; }&#x000A;}</pre> <p class="note"><strong>Note:</strong> The value of <strong>F_CPU</strong> should be the clock frequency of your AVR in units of Hz, so if your AVR is not running at 20&nbsp;MHz you will need to change that line. If you do not make this change, the timing of <code>_delay_ms()</code> will be off, but the LED will still blink.</p> <ol><li value="4">Click the <strong>Build Solution</strong> button on the toolbar (or press Ctrl+Shift+B) to compile the code.</li></ol> <table class="picture_with_caption center"><tr><td style="max-width: 550px"><a href="https://a.pololu-files.com/picture/0J3711.1200.png?7c8f19249a576fefacbc8553fc49bd45" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J3711&quot;,&quot;caption&quot;:&quot;\u003cp\u003eBuilding a project with Atmel Studio 6.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J3711.98x98.jpg?7c8f19249a576fefacbc8553fc49bd45&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J3711.600x480.jpg?7c8f19249a576fefacbc8553fc49bd45&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J3711.1200.png?7c8f19249a576fefacbc8553fc49bd45&quot;,&quot;longest_side&quot;:750}]" data-picture-id="0J3711" data-picture-longest_side="750" src="https://a.pololu-files.com/picture/0J3711.550.jpg?7c8f19249a576fefacbc8553fc49bd45" /></a></td><p></tr><tr><th style="max-width: 550px"><p>Building a project with Atmel Studio 6.</p></th></tr></table></p> <ol><li value="5">Make sure your programmer is connected to your computer via USB and then select <strong>Add target&#8230;</strong> from the <strong>Tools</strong> menu. Select <strong>STK500</strong> as the tool. Select the COM port that has been assigned to the programmer&#8217;s programming port, and click <strong>Apply</strong>. If you are not sure which COM port to select, run the Pololu USB AVR Programmer v2 Configuration Utility and look in the upper left corner or see <a href="#4.5">Section 4.5</a>, which has more information about determining serial port names. This step can be skipped if you have done it before.</li></ol> <table class="picture_with_caption center"><tr><td><a href="https://a.pololu-files.com/picture/0J3712.1200.png?4a6ee66573f6b40aa70bf0b480af9fb8" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J3712&quot;,&quot;caption&quot;:&quot;\u003cp\u003eThe \u0026#8220;Add target\u0026#8230;\u0026#8221; menu item in Atmel Studio 6.1.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J3712.98x98.jpg?4a6ee66573f6b40aa70bf0b480af9fb8&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J3712.600x480.jpg?4a6ee66573f6b40aa70bf0b480af9fb8&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J3712.1200.png?4a6ee66573f6b40aa70bf0b480af9fb8&quot;,&quot;longest_side&quot;:474}]" data-picture-id="0J3712" data-picture-longest_side="474" src="https://a.pololu-files.com/picture/0J3712.550.png?4a6ee66573f6b40aa70bf0b480af9fb8" /></a></td><p></tr></table> <table class="picture_with_caption center"><tr><td style="max-width: 550px"><a href="https://a.pololu-files.com/picture/0J3714.1200.png?5484c1d46a2d45d52679e34e5b502226" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J3714&quot;,&quot;caption&quot;:&quot;\u003cp\u003eThe \u0026#8220;Add target\u0026#8221; dialog box in Atmel Studio 6.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J3714.98x98.jpg?5484c1d46a2d45d52679e34e5b502226&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J3714.600x480.jpg?5484c1d46a2d45d52679e34e5b502226&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J3714.1200.png?5484c1d46a2d45d52679e34e5b502226&quot;,&quot;longest_side&quot;:510}]" data-picture-id="0J3714" data-picture-longest_side="510" src="https://a.pololu-files.com/picture/0J3714.550.png?5484c1d46a2d45d52679e34e5b502226" /></a></td></tr><tr><th style="max-width: 550px"><p>The &#8220;Add target&#8221; dialog box in Atmel Studio 6.</p></th></tr></table></p> <ol><li value="6">In the <strong>Tools</strong> menu, select <strong>Device Programming</strong>.</li> <li>This will bring up the Device Programming dialog. For the Tool, select the STK500 that you added earlier. Select the same device you selected earlier. If your device is not available in the list, we recommend upgrading to Microchip Studio 7.0 or later. For the Interface, select <strong>ISP</strong>. Click <strong>Apply</strong>.</li></ol> <table class="picture_with_caption center"><tr><td style="max-width: 367px"><a href="https://a.pololu-files.com/picture/0J3716.1200.png?77d6e5dde3f3cb96dce26b05c1387c89" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J3716&quot;,&quot;caption&quot;:&quot;\u003cp\u003eSelecting a programmer, device, and interface in the Device Programming dialog of Atmel Studio 6.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J3716.98x98.jpg?77d6e5dde3f3cb96dce26b05c1387c89&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J3716.600x480.jpg?77d6e5dde3f3cb96dce26b05c1387c89&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J3716.1200.png?77d6e5dde3f3cb96dce26b05c1387c89&quot;,&quot;longest_side&quot;:359}]" data-picture-id="0J3716" data-picture-longest_side="359" src="https://a.pololu-files.com/picture/0J3716.367.png?77d6e5dde3f3cb96dce26b05c1387c89" /></a></td><p></tr><tr><th style="max-width: 367px"><p>Selecting a programmer, device, and interface in the Device Programming dialog of Atmel Studio 6.</p></th></tr></table></p> <p>If you get an error when you click &#8220;Apply&#8221;, then it means that Microchip Studio is having trouble communicating with the programmer. You should try unplugging the programmer from everything and then plug it back in. You should also make sure you have selected the right COM port. If that does not help, see the Windows USB driver troubleshooting advice in <a href="#4.1">Section 4.1</a>.</p> <ol><li value="8">If you have not done so already, connect the programmer to the target device using the 6-pin ISP cable. Make sure the cable is oriented so that pin 1 on the connector lines up with pin 1 on your target device, and that the target device is powered on. If your device does not have an ISP header, see <a href="#5.1">Section 5.1</a> for more information about connecting the programmer. You can test the connection by clicking the <strong>Read</strong> button next to the <strong>Device Signature</strong> box. This sends a command to the target AVR asking for its signature. If everything works correctly, you should see a number in hex notation appear in the Device Signature box. If you get an error about the signature being wrong, you might have selected the wrong device. If you get a warning that says &#8220;Read voltage &#8230; is outside selected device&#8217;s operating range&#8221; then double check to make sure that your device is powered. For more help getting your connection working, see <a href="#5.6">Section 5.6</a>.</li></ol> <table class="picture_with_caption center"><tr><td style="max-width: 320px"><a href="https://a.pololu-files.com/picture/0J3717.1200.png?15552e367b66a55fcb0ee9e5372230f7" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J3717&quot;,&quot;caption&quot;:&quot;\u003cp\u003eReading the device signature of an AVR in Atmel Studio 6.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J3717.98x98.jpg?15552e367b66a55fcb0ee9e5372230f7&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J3717.600x480.jpg?15552e367b66a55fcb0ee9e5372230f7&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J3717.1200.png?15552e367b66a55fcb0ee9e5372230f7&quot;,&quot;longest_side&quot;:319}]" data-picture-id="0J3717" data-picture-longest_side="319" src="https://a.pololu-files.com/picture/0J3717.320.png?15552e367b66a55fcb0ee9e5372230f7" /></a></td><p></tr><tr><th style="max-width: 320px"><p>Reading the device signature of an AVR in Atmel Studio 6.</p></th></tr></table></p> <ol><li value="9">Now it is time to program your target device. Select the <strong>Memories</strong> section on the left. The <strong>Flash</strong> box should contain the path to the ELF file that was generated when you built your program. If it does not, you can browse for this using the <strong>&#8220;&#8230;&#8221;</strong> button to the right of the text box. If you navigate to your project&#8217;s folder, you should find it as <em>&#8220;Debug\&lt;project name&gt;.elf&#8221;</em>. Click the <strong>Program</strong> button in the Flash box.</li></ol> <table class="picture_with_caption center wide"><tr><td style="max-width: 600px"><a href="https://a.pololu-files.com/picture/0J3718.1200.png?0acb02f7aa367fc4c8baed61bd23b5f9" class="noscript-fallback"><img alt="" class="wide zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J3718&quot;,&quot;caption&quot;:&quot;\u003cp\u003eThe Memories section of the Device Programming dialog in Atmel Studio 6.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J3718.98x98.jpg?0acb02f7aa367fc4c8baed61bd23b5f9&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J3718.600x480.jpg?0acb02f7aa367fc4c8baed61bd23b5f9&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J3718.1200.png?0acb02f7aa367fc4c8baed61bd23b5f9&quot;,&quot;longest_side&quot;:640}]" data-picture-id="0J3718" data-picture-longest_side="640" src="https://a.pololu-files.com/picture/0J3718.600.jpg?0acb02f7aa367fc4c8baed61bd23b5f9" /></a></td><p></tr><tr><th style="max-width: 600px"><p>The Memories section of the Device Programming dialog in Atmel Studio 6.</p></th></tr></table></p> <p>As your programmer programs the AVR, you should see all four LEDs flicker and you should see the following text appear at the bottom of the window: <pre>Erasing device... OK&#x000A;Programming Flash...OK&#x000A;Verifying Flash...OK</pre></p> <p>If there were no problems, the LED connected to PD1 of your AVR should now be flashing! Note that if you are trying this on a 3pi robot and you have not yet soldered in the optional through-hole LEDs, the flashing LED will be on the bottom of the robot. If there was a problem, please see <a href="#5.6">Section 5.6</a> for help identifying and fixing it.</p>

5.2.1. Faster programming with F5 in Microchip Studio

<p>The Device Programming dialog in Microchip Studio is modal, which means you must close it after you are done programming in order to go back to editing your source code. It takes at least 4 clicks to open up the dialog and initiate the programming process again. This section describes a different method for programming that will allow you to compile <em>and</em> program simply by pressing <strong>F5</strong>.</p> <p>First, in the <strong>View</strong> menu, select &#8220;Available Microchip Tools&#8221;. This will bring up the &#8220;Available Tools&#8221; window. Make sure that there is one and only one STK500 in the list and make sure that the COM port number matches the COM port number of the programmer&#8217;s programming port (see <a href="#4.5">Section 4.5</a>). If there are multiple STK500 entries, right click on them and select &#8220;Remove&#8221; to remove the extra entries. You will only have to do this once.</p> <table class="picture_with_caption center wide"><tr><td><a href="https://a.pololu-files.com/picture/0J3862.1200.png?27bf17919ac6ac2922d2ce4c259de57f" class="noscript-fallback"><img alt="" class="wide zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J3862&quot;,&quot;caption&quot;:&quot;\u003cp\u003eAtmel Studio 6 \u0026#8220;Available Tools\u0026#8221; window with exactly one STK500 entry.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J3862.98x98.jpg?27bf17919ac6ac2922d2ce4c259de57f&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J3862.600x480.jpg?27bf17919ac6ac2922d2ce4c259de57f&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J3862.1200.png?27bf17919ac6ac2922d2ce4c259de57f&quot;,&quot;longest_side&quot;:350}]" data-picture-id="0J3862" data-picture-longest_side="350" src="https://a.pololu-files.com/picture/0J3862.600.png?27bf17919ac6ac2922d2ce4c259de57f" /></a></td><p></tr></table></p> <p>Next, open the project properties window by opening the <strong>Project</strong> menu and selecting the entry that has the name of your project followed by the word <strong>Properties</strong>. In the <strong>Tool</strong> tab, select <strong>STK500</strong> as the debugger/programmer, and select <strong>ISP</strong> as the interface. Set the ISP Clock frequency to 115.2 kHz by dragging the slider; this is a good default value that will work for most AVRs, but you can try increasing it later if you want the programming to be faster.</p> <table class="picture_with_caption center wide"><tr><td><a href="https://a.pololu-files.com/picture/0J3863.1200.png?fd0798d1a47052f7167f6dac5c9cf44e" class="noscript-fallback"><img alt="" class="wide zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J3863&quot;,&quot;caption&quot;:&quot;\u003cp\u003eThe Tool tab of an Atmel Studio 6 project\u0026#8217;s properties, configured to use the Pololu USB AVR Programmer.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J3863.98x98.jpg?fd0798d1a47052f7167f6dac5c9cf44e&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J3863.600x480.jpg?fd0798d1a47052f7167f6dac5c9cf44e&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J3863.1200.png?fd0798d1a47052f7167f6dac5c9cf44e&quot;,&quot;longest_side&quot;:525}]" data-picture-id="0J3863" data-picture-longest_side="525" src="https://a.pololu-files.com/picture/0J3863.600.png?fd0798d1a47052f7167f6dac5c9cf44e" /></a></td><p></tr></table></p> <p>Finally, you should be able to press <strong>F5</strong> to build your project and program the resulting HEX file onto your AVR. Alternatively you can program by selecting either &#8220;Continue&#8221; or &#8220;Start Without Debugging&#8221; from the <strong>Debug</strong> menu.</p>

5.3. AVR programming using AVR Studio 4

<p>We have not tested the Pololu USB AVR Programmer v2.x with <strong>AVR Studio 4</strong>, which is a predecessor to Microchip Studio and is no longer supported by Microchip. However, we expect the programmer to work with AVR Studio 4. We recommend using the latest version of Microchip Studio, but if you want to use AVR Studio 4 then you can probably follow the instructions in the <a href="/docs/0J36/3.c">Programming AVRs Using AVR Studio 4</a> section of the user&#8217;s guide for our older programmer.</p>

5.4. AVR programming using the Arduino IDE

<p class="note_warning"><strong>Note:</strong> 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 <a href="#6.3">Section 6.3</a>.</p> <p>The following tutorial covers the steps needed to program AVRs in Windows using the <a href="https://www.arduino.cc/en/software/"><strong>Arduino Software (IDE)</strong></a> and a Pololu USB AVR Programmer <span>v2.x</span>. 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.</p> <ol> <li>Download and install the <a href="https://www.arduino.cc/en/software/" title="IDE">Arduino Software</a>.</li> <li>Open the Arduino IDE. A new template program will automatically be generated.</li> <li>In the <strong>Tools</strong> menu, find the <strong>Programmer</strong> menu, and then select <strong>Atmel STK500 development board</strong>. If you do not see an entry for the STK500, you should update to Arduino 1.6.5 or later.</li> <li>In the <strong>Ports</strong> menu, select the port that corresponds to the programmer&#8217;s programming port. If you are not sure which of the listed serial ports is the programming port, see <a href="#4.5">Section 4.5</a>.</li> <li>In the <strong>Boards</strong> 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&nbsp;MHz, then the entry for the &#8220;Arduino/Genuino Uno&#8221; 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 &#8220;hardware/arduino/avr/boards.txt&#8221; file inside your Arduino IDE installation and editing it.</li> <li>In the <strong>Sketch</strong> menu, select <strong>Upload with Programmer</strong>. 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&#8217;s usual bootloader. It should load the default template program onto your AVR. If everything worked, the message &#8220;Done uploading.&#8221; will appear in the status bar.</li> </ol> <p>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 <strong>File</strong> menu, selected <strong>Preferences</strong>, then check the <strong>upload</strong> checkbox on the line that says <strong>Show verbose output during</strong>, and click <strong>OK</strong>. 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 &#8220;-cstk500&#8221;, uses the right COM port, and specifies the right AVR microcontroller using the &#8220;-p&#8221; option. For more help troubleshooting, see <a href="#5.6">Section 5.6</a>.</p>

5.5. AVR programming using AVRDUDE

<p class="note">If you have an Orangutan or 3pi Robot or wish to use the Pololu AVR C/C++ Library for some other reason, we recommend following the <strong><a href="/docs/0J51">Pololu AVR Programming Quick Start Guide</a></strong> instead of this tutorial.</p> <p>While it is possible to program AVRs using an integrated development environment like Microchip Studio or the Arduino IDE, you can also set up your own development environment using a collection command-line utilities. This tutorial will explain how to set up such an environment on Windows, Mac OS X, or Linux. For each of these systems, the first thing we need to do is install AVR GCC, GNU Make, and AVRDUDE. In this tutorial, the phrase &#8220;AVR GCC&#8221; means the full toolchain, including the compiler, binary utilities (binutils), and AVR Libc. The instructions for installing these prerequisites depend on the specific operating system you are using. Once you have those tools, you can write a simple Makefile that supports compiling a program and loading it onto the AVR.</p> <p>To successfully complete this tutorial, you will need to know how to use <code>cd</code> and <code>ls</code> to navigate the files on your computer. You will also need to know how to use a text editor to create and edit files.</p> <h3>Installing prerequisites in Windows</h3> <p>On a computer running Microsoft Windows, we recommend that you install the <a href="https://www.microchip.com/en-us/tools-resources/develop/microchip-studio/gcc-compilers">Microchip AVR 8-bit Toolchain for Windows</a>, which is a standalone version of AVR GCC for Windows. The installer is just a simple extractor that will extract the toolchain folder to a location you specify. We recommend specifying &#8220;C:\&#8221; as the location, which means all the tools will be installed in &#8220;C:\avr8-gnu-toolchain&#8221;. To make it easy to use the toolchain, you should add &#8220;C:\avr8-gnu-toolchain\bin\&#8221; to the end of your PATH environment variable, making sure to separate it from any other paths using a semicolon. You can edit environment variables like PATH from the Control Panel.</p> <p>To get GNU Make and AVRDUDE on Windows, we recommend using <a href="http://msys2.github.io/">MSYS2</a>, a distribution of open-source software for Windows. Be sure to follow the instructions on MSYS2&#8217;s website to update the packages that come with MSYS2. Then install AVRDUDE and make by running the following command:</p> <pre><code>pacman -S make mingw-w64-i686-avrdude&#x000A;</code></pre> <p>Next, launch MSYS2 using the &#8220;MinGW-w64 Win32 Shell&#8221; shortcut in your start menu (or by running mingw32_shell.bat). There are other ways to start MSYS2, and if you start it the wrong way, then the 32-bit version of AVRDUDE that we installed above will not be on your PATH, and you will get a &#8220;command not found&#8221; error later when you try to run AVRDUDE.</p> <p>If you have trouble using the AVR GCC provided by Microchip or the AVRDUDE provided by MSYS2, another option is to use the versions of AVR GCC and AVRDUDE provided by the Arduino IDE. You would have to add the &#8220;hardware\tools\avr\bin&#8221; folder inside your Arduino installation to your PATH environment variable.</p> <h3>Installing prerequisites on Linux</h3> <p>GNU Make is very commonly used to build software on Linux, so if you are using Linux then you might have it already. You can run &#8220;make -v&#8221; in a shell to see if you have it. If you do not have make, you should install it using your system&#8217;s package manager.</p> <p>Next, you should install the AVR toolchain and AVRDUDE. On Ubuntu, you can do this by running:</p> <pre><code>sudo apt-get install gcc-avr avr-libc avrdude&#x000A;</code></pre> <p>On Arch Linux, you can run:</p> <pre><code>sudo pacman -S avr-gcc avr-libc avrdude&#x000A;</code></pre> <p>For other Linux distributions, you should look in your distribution&#8217;s list of packages to find the relevant AVR development tools.</p> <h3>Installing prerequisites on macOS</h3> <p>To install the prerequisites on macOS, we recommend first installing <a href="https://brew.sh/">Homebrew</a>. Then run the following commands to install AVRDUDE and <a href="https://github.com/osx-cross/homebrew-avr">homebrew-avr</a>:</p> <pre>&#x000A;brew install avrdude&#x000A;xcode-select --install&#x000A;brew tap osx-cross/avr&#x000A;brew install avr-gcc</pre> <h3>Checking the prerequisites</h3> <p>After you have installed the prerequisites, you should open your terminal/shell and try running each tool to make sure it is available. Run the following commands:</p> <pre><code>avr-gcc -v&#x000A;make -v&#x000A;avrdude -v&#x000A;</code></pre> <p>If you installed the prerequisites correctly, each of the commands above should print a version number and some other information about the corresponding tool.</p> <h3>Compiling a program</h3> <p>First, create a file named <code>main.c</code> with the following contents:</p> <pre name="code" class="c">&#x000A;#define F_CPU 20000000 // AVR clock frequency in Hz, used by util/delay.h&#x000A;#include &lt;avr/io.h&gt;&#x000A;#include &lt;util/delay.h&gt;&#x000A; &#x000A;int main() {&#x000A; DDRD |= (1&lt;&lt;1); // set LED pin PD1 to output&#x000A; while (1) {&#x000A; PORTD |= (1&lt;&lt;1); // drive PD1 high&#x000A; _delay_ms(100); // delay 100 ms&#x000A; PORTD &amp;= ~(1&lt;&lt;1); // drive PD1 low&#x000A; _delay_ms(900); // delay 900 ms&#x000A; }&#x000A;}</pre> <p>The C code above attempts to blink an LED connected to pin PD1 of your AVR. If you do not have an LED connected to PD1, you should edit it to use a different pin. You should also adjust the definition of <code>F_CPU</code> so that it is equal to the clock speed of your AVR in Hz.</p> <p>Next, create a file named <code>Makefile</code> with the following contents:</p> <pre><code>MCU=atmega328p&#x000A;PORT=$(shell pavr2cmd --prog-port)&#x000A;CFLAGS=-g -Wall -mcall-prologues -mmcu=$(MCU) -Os&#x000A;LDFLAGS=-Wl,-gc-sections -Wl,-relax&#x000A;CC=avr-gcc&#x000A;TARGET=main&#x000A;&#x000A;all: $(TARGET).hex&#x000A;&#x000A;clean:&#x000A; rm -f *.o *.elf *.hex&#x000A;&#x000A;%.hex: %.elf&#x000A; avr-objcopy -R .eeprom -O ihex $&lt; $@&#x000A;&#x000A;$(TARGET).elf: $(TARGET).o&#x000A; $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@&#x000A;&#x000A;program: $(TARGET).hex&#x000A; avrdude -c stk500v2 -P "$(PORT)" -p $(MCU) -U flash:w:$&lt;:i&#x000A;</code></pre> <p>You should edit the MCU variable in the Makefile to match the part name of the AVR you are using. This will be passed as an argument to both GCC and AVRDUDE.</p> <p>If you did not install the software for the programmer, then you will not have pavr2cmd, and you should manually set the PORT variable in the Makefile to be equal to the name of the programmer&#8217;s programming port. See <a href="#4.5">Section 4.5</a> for more information about determining port names.</p> <p>You can now run <code>make</code> to build the program.</p> <p>Note that this is a simple Makefile that does not have real dependency tracking. It knows that if main.c changes, then the other files need to rebuilt, but it does not account for changes in other files you might add, such as header files.</p> <h3>Programming the AVR</h3> <p>You can run <code>make program</code> to build the code and also program it onto your target AVR using AVRDUDE. If this does not work, see <a href="#5.6">Section 5.6</a> for help troubleshooting.</p> <p class="note">AVRDUDE&#8217;s terminal mode (the <strong>-t</strong> option) is not compatible with the programmer because the programmer will exit programming mode and release the target AVR from reset if it receives no programming commands for 1500&nbsp;ms.</p>

5.6. Troubleshooting AVR programming issues

<p>This section helps solve problems you might have using the Pololu USB AVR Programmer v2.x to program AVRs.</p> <h3>If the programmer blinks its red LED and resets when you plug it into to the AVR:</h3> <p>If you are using Pololu USB AVR Programmer v2, and the programmer&#8217;s regulator mode is set to Auto or 3.3&nbsp;V, and you plug it in to a device running at 5&nbsp;V with a strong pull-up (less than 10k&Omega;) on its reset line, the programmer could experience a brown-out reset. After all the pins are connected, the programmer will indicate the brown-out by blinking its red LED four times, and then it will resume normal operation. Any programs using the programmer&#8217;s COM ports or its native USB interface might need to be restarted. You can avoid this by setting the regulator mode to 5&nbsp;V, which can be done by running <code>pavr2cmd --regulator-mode 5v</code> or using the Pololu USB AVR Programmer v2 Configuration Utility. The Pololu USB AVR Programmer v2.1 does not have this problem.</p> <p>You could also experience a brown-out reset when connecting to an AVR if you have enabled the VCC output feature and the capacitance on the target AVR board&#8217;s VCC line is too high. For more information, see <a href="#8">Section 8</a>.</p> <h3>If a motor on your Baby Orangutan or 3pi Robot runs briefly:</h3> <p>If you plug a Pololu USB AVR Programmer v2 into a Baby Orangutan or 3pi Robot, motor 2 might run as you are plugging it in. After all the pins are connected, the motor will stop running. You can avoid this by adding <code>set_motors(0, 0);</code> to the beginning of your program (e.g. the first line of <code>main</code> or <code>setup</code>) to ensure that the motor PWM pins are driven low. The Pololu USB AVR Programmer v2.1 has improved circuitry for measuring the target&#8217;s logic voltage, which limits the duty cycle of this effect to about 0.2%, so the motor won&#8217;t move (but it might make a 25&nbsp;Hz clicking sound).</p> <h3>If the computer fails to connect to the programmer:</h3> <ul> <li>Make sure that your software is configured to connect to the programmer&#8217;s programming port, and not some other serial port on your computer. You can find the name of this port by looking in the upper left corner of the Pololu USB AVR Programmer v2 Configuration Utility software, or by following the instructions in <a href="#4.5">Section 4.5</a>.</li> <li>If you are using Microchip Studio and programming with the F5 key does not work, then click <strong>View &gt; Available Microchip Tools</strong>. This will open the &#8220;Available Tools&#8221; window. Make sure that there is one and only one STK500 in the list and make sure that the COM port number matches the COM port number of the programmer&#8217;s programming port. If there are multiple STK500 entries, right click on them and select &#8220;Remove&#8221; to remove the extra entries.</li> <li>If you are in Windows, make sure you have installed the drivers the programmer needs to operate. <a href="#4.1">Section 4.1</a> describes how to install the drivers in Windows.</li> <li>Make sure your programmer is connected to your computer via a USB A to micro-B cable.</li> <li>Try closing all programs using the programmer, unplug the programmer from everything, and then plug it back into USB.</li> <li>Try using a different USB cable and a different USB port. Make sure your cable is not a charging-only cable.</li> <li>Is the programmer&#8217;s green USB status LED on? This is the LED next to the USB connector. If this LED is blinking slowly, then your drivers are not properly installed.</li> <li>If you are in Windows, can you see your programmer listed in the Device Manager? The Device Manager should show three devices: under &#8220;Universal Serial Bus devices&#8221; should be &#8220;Pololu USB AVR Programmer v2.1&#8221; (or v2), and under &#8220;Ports (COM &amp; LPT)&#8221; should be &#8220;Pololu USB AVR Programmer v2.1 Programming Port&#8221; and &#8220;Pololu USB AVR Programmer v2.1 TTL Serial Port&#8221; (or v2) and there should be no error symbols on the icons representing these devices.</li> <li>On Windows, your computer will only let one program at a time have a given COM port open. If you are connected to your programmer&#8217;s programming port using another program, such as a terminal or a second instance of Microchip Studio, you will not be able to connect to that same COM port with your programming software. Please make sure you do not have any terminal programs connected to your programmer&#8217;s programming port. If you have multiple versions of Microchip Studio running, make sure that you have closed the Device Programming dialogs in all of them. When the Device Programming dialog is open and the Apply button at the top is grayed out, that instance of Microchip Studio has an open connection to your programmer&#8217;s programming port.</li> <li>See <a href="#4.1">Section 4.1</a> for some tips on USB troubleshooting for Windows.</li> <li>See <a href="#4.2">Section 4.2</a> for some tips on USB troubleshooting for Linux.</li> <li>See <a href="#4.3">Section 4.3</a> for some tips on USB troubleshooting for macOS.</li> </ul> <h3>If the programmer has problems connecting to the target AVR:</h3> <ul> <li>A common cause for this problem is an incorrect connection between your programmer and your target device. See <a href="#5.1">Section 5.1</a> for information on how to properly connect an AVR to the programmer.</li> <li>The target AVR must be powered for programming to work. Please make sure that your target device has power and is turned on. You can get a reading of the AVR&#8217;s VCC voltage by running <code>pavr2cmd -s</code> or looking in the Pololu USB AVR Programmer v2 Configuration Utility. If you are using Microchip Studio, you can get a reading of the AVR&#8217;s VCC voltage by clicking the &#8220;Read&#8221; button next to the Target Voltage box in the upper right corner of the Device Programming dialog.</li> <li>Your programmer&#8217;s ISP frequency must be less than a quarter of your target AVR&#8217;s clock frequency, but frequencies that are too low can result in timeouts. The default frequency of 114&nbsp;kHz should work for most AVRs. Try setting the ISP frequency to 114&nbsp;kHz using the programmer&#8217;s configuration utility, or by supplying the <code>-B 5</code> option to AVRDUDE. You can also set the frequency using the Device Programming dialog in Microchip Studio, in the &#8220;Interface settings&#8221; section. If you are programming in Microchip Studio with F5, go to the &#8220;Tool&#8221; section of your project&#8217;s properties and set the frequency to 115.2 kHz by dragging the slider.</li> <li>If the red error LED is on solid after a programming attempt, then run the programmer&#8217;s configuration utility or run <code>pavr2cmd -s</code> to determine the cause of the error.</li> <li>There may be a problem with the target device. It is possible to kill a device with a static shock, by incorrectly connecting power, or by programming the fuses incorrectly. There could also be a short or cut trace somewhere on your target device. The ideal way to test for this is to try programming a different device with your programmer, or try using a different programmer to program the target device. If this is not an option, try verifying that the target device is still functional and perform some continuity tests to check for shorts or disconnections on the ISP programming lines. Don&#8217;t forget to check the 6-pin ISP cable for shorts as well.</li> <li>If you are programming by pressing F5 in Microchip Studio, try using the &#8220;Device Programming&#8221; dialog instead. You can find it in &#8220;Tools&#8221; menu.</li> <li>It is possible that the AVR&#8217;s SPIEN fuse has been set to 1, meaning that the ISP interface is disabled. This could potentially happen if you used the AVR&#8217;s debugWIRE interface to program it. The debugWIRE interface is a different interface that is not supported by the Pololu USB AVR Programmer <span>v2.x</span>. To fix this problem, you should use the debugWIRE interface to set the SPIEN fuse to 0.</li> <li>There could be additional hardware connected to one of your AVR&#8217;s programming pins that interferes with its function. For example, the programmer does <ins>not</ins>&nbsp;work with the Arduino Nano due to the 1&nbsp;kΩ pull-up resistor on its reset line, which is too strong compared to the 470&nbsp;Ω series resistor on the signal from the programmer.</li> </ul> <h3>If the verification step fails for flash programming:</h3> <ul> <li>Check the lock bits on your AVR to make sure you do not have any type of code protection or memory lock enabled. Since those settings would prevent the programmer from reading from your AVR&#8217;s flash, they would cause verification to fail.</li> </ul> <h3>If the verification step fails for fuses or lock bits:</h3> <ul> <li>Verification of fuses or lock bits in AVRDUDE can fail because unimplemented fuse bits are read as an arbitrary, constant value that might be different from the value you tried to program into them. Consult the datasheet of your AVR to find out which fuse bits are unimplemented and then change those bits in your AVRDUDE command to match what AVRDUDE is actually reading from the chip. Be very careful whenever you are changing fuses!</li> </ul> <h3>Still need help?</h3> <p>If none of the above troubleshooting suggestions solve your problem, please <a href="/support">contact us for support</a>.</p>

5.7. Programming faster

<p>If you are developing code for an AVR microcontroller, you might need to program it dozens or hundreds of times before the code is good. This section gives tips on how to program your AVR quickly so that you can be more productive.</p> <p>If you are programming from Microchip Studio, you should try using the F5 key as described in <a href="#5.2.1">Section 5.2.1</a>. Then you can just press the F5 key to save, build, and program.</p> <p>If you are using AVRDUDE or GNU Make from the command line, you should know that most shells allow you to press the up arrow to go back to the last command you ran. So you can press up arrow followed by Enter to very quickly run the last command. You should also learn the shortcut key for saving a file in your text editor (often Ctrl+S), and learn your operating system&#8217;s shortcut key for switching Windows (often Alt+Tab). Then you can just press a quick sequence of keystrokes to save, switch to the terminal, program the AVR, and switch back.</p> <h3>Setting the ISP frequency</h3> <p>You should make sure to set the ISP Frequency setting on your programmer to the highest value that the AVR can handle. The ISP Frequency setting has a large effect on how fast the programmer sends commands to the AVR. The rest of this section talks about how to determine a good frequency and configure your programmer to use it.</p> <p>For most or all AVRs:</p> <ul> <li>The ISP Frequency should be less than <strong>1/4</strong> of the target clock frequency if the target clock frequency is less than 12&nbsp;MHz.</li> <li>The ISP Frequency should be less than <strong>1/6</strong> of the target clock frequency if the target clock frequency is greater than or equal to 12&nbsp;MHz.</li> </ul> <p>These rules apply to most or all AVRs with an ISP interface. If you want to, you can check to see if these rules apply to your AVR by looking for information about the minimum low and high periods for the serial clock (SCK) input in the &#8220;Serial Downloading&#8221; or &#8220;Serial Uploading&#8221; section of your AVR&#8217;s datasheet.</p> <p>Here are some recommended values for typical setups:</p> <table class="active_controller_comparison"> <tr> <th style="text-align:center;">AVR<br/>Clock Frequency </th> <th style="text-align:center;">ISP Frequency </th> <th style="text-align:center;">Microchip Studio<br/>Setting </th> <th style="text-align:center;">AVRDUDE<br/>Option<sup>(1)</sup></th> </tr> <tr> <td style="text-align:right;">20&nbsp;MHz </td> <td style="text-align:right;">3000&nbsp;kHz<sup>(2)</sup> </td> <td style="text-align:right;">1.843&nbsp;MHz </td> <td style="text-align:right;">-B 0.5</td> </tr> <tr> <td style="text-align:right;">16&nbsp;MHz </td> <td style="text-align:right;">2400&nbsp;kHz<sup>(2)</sup> </td> <td style="text-align:right;">1.843&nbsp;MHz </td> <td style="text-align:right;">-B 0.5</td> </tr> <tr> <td style="text-align:right;">12&nbsp;MHz </td> <td style="text-align:right;">1714&nbsp;kHz<sup>(2)</sup> </td> <td style="text-align:right;">1.843&nbsp;MHz </td> <td style="text-align:right;">-B 0.5</td> </tr> <tr> <td style="text-align:right;">8&nbsp;MHz </td> <td style="text-align:right;">1714&nbsp;kHz<sup>(2)</sup> </td> <td style="text-align:right;">1.843&nbsp;MHz </td> <td style="text-align:right;">-B 0.5</td> </tr> <tr> <td style="text-align:right;">4&nbsp;MHz </td> <td style="text-align:right;">750&nbsp;kHz<sup>(2)</sup> </td> <td style="text-align:right;">1.843&nbsp;MHz </td> <td style="text-align:right;">-B 0.5</td> </tr> <tr> <td style="text-align:right;">1&nbsp;MHz </td> <td style="text-align:right;">114&nbsp;kHz<sup>(3)</sup> </td> <td style="text-align:right;">115.2&nbsp;kHz </td> <td style="text-align:right;">-B 4</td> </tr> <tr> <td style="text-align:right;">32.768&nbsp;kHz </td> <td style="text-align:right;">6.98&nbsp;kHz<sup>(3)</sup> </td> <td style="text-align:right;">7.008&nbsp;kHz </td> <td style="text-align:right;">-B 123</td> </tr> </table> <p><sup>(1)</sup>: If the programmer is already configured to use the specified ISP Frequency, you do not need to supply this option to AVRDUDE, but you probably should just in case.<br/> <sup>(2)</sup>: You should select this frequency using the programmer&#8217;s configuration software, so that the programmer will use it instead of the 1.843 MHz frequency requested by Microchip Studio and AVRDUDE.<br/> <sup>(3)</sup>: Optional setting: the Microchip Studio and AVRDUDE settings will configure the programmer to use this frequency or a nearby frequency that will also work.</p> <p>The Pololu USB AVR Programmer v2.x emulates the STK500 programmer from Microchip, which supports 255 different frequencies. Microchip Studio and AVRDUDE only know about those 255 frequencies, and their user interfaces allow you to select one. The fastest frequency the STK500 supports is 1.843&nbsp;MHz. If you try to select that frequency in AVRDUDE or Microchip Studio, then the programmer will actually use its <strong>Max ISP Frequency</strong>, a configurable setting which defaults to 1714&nbsp;kHz.</p> <p>The <strong>ISP Frequency</strong> column above lists ISP frequencies supported by the Pololu USB AVR Programmer v2.x which are appropriate for programming an AVR with the specified clock frequency. You can select these ISP frequencies using the <code>--freq</code> option to <code>pavr2cmd</code> or you can select them in the configuration utility. Just click the arrow on the &#8220;ISP Frequency&#8221; input, select the frequency you want to use, and then click &#8220;Apply Settings&#8221; to apply the settings to the device.</p> <p>The <strong>Microchip Studio Setting</strong> column above shows the frequency you should select in Microchip Studio if you are using Microchip Studio to program. Microchip Studio will always set the ISP frequency of the programmer, whether you are using the F5 key to program, or using the Device Programming dialog. If you are using F5 to program, you should check the &#8220;Tool&#8221; section of your project&#8217;s properties and set the ISP Clock to the value listed above. If you are using the Device Programming dialog, you should set the ISP Clock using the &#8220;Interface settings&#8221; section of the dialog.</p> <p>The <strong>AVRDUDE Option</strong> column above shows the command-line arguments you should supply when running AVRDUDE. The &#8220;-B&#8221; option to AVRDUDE takes one argument, which is a number. The argument specifies the minimum allowed ISP period (one divided by the maximum allowed ISP Frequency) in units of microseconds.</p> <p>Any change to the programmer&#8217;s frequency&mdash;whether it comes from the programmer&#8217;s software, or Microchip Studio, or AVRDUDE&mdash;is stored in the programmer&#8217;s non-volatile memory, so it will persist even if the programmer is unplugged and powered off.</p> <p>You can change the ISP Frequency and Max ISP Frequency settings using the programmer&#8217;s configuration software. The Max ISP Frequency must always be equal to the ISP Frequency if the ISP Frequency is 462&nbsp;kHz or higher. If you set the ISP Frequency to anything higher than 462&nbsp;kHz, the programmer&#8217;s software automatically sets the Max ISP Frequency setting as well.</p> <p>The programmer itself runs at 12&nbsp;MHz, so each possible value for the ISP Frequency and Max ISP Frequency settings is equal to 12000&nbsp;kHz divided by some whole number.</p> <p>If you have any issues related to the frequency settings, you can use the configuration software to set them back to their default values of 114&nbsp;kHz for the ISP Frequency and 1714&nbsp;kHz for the Max ISP Frequency, respectively. You can also try resetting <strong>all</strong> of the programmer&#8217;s settings to their factory defaults by running <code>pavr2cmd --restore-defaults</code> or selecting &#8220;Restore Default Settings&#8221; from the &#8220;Device&#8221; menu of the configuration utility.</p>

5.8. Reading and writing from EEPROM and flash

<p>The Pololu USB AVR Programmer v2.x supports reading and writing from an AVR&#8217;s EEPROM and flash memories.</p> <p>If you are using Atmel Studio, you can use the &#8220;Memories&#8221; section of the &#8220;Device Programming&#8221; dialog to read and write from EEPROM and flash.</p> <p>If you are using AVRDUDE, you can use the &#8220;-U&#8221; option:</p> <ul> <li>To read from flash and save the contents to a HEX file, use something like <code>-U flash:r:filename.hex:i</code></li> <li>To write a HEX file to flash, use something like <code>-U flash:w:filename.hex:i</code> (and see <a href="#5.5">Section 5.5</a>)</li> <li>To read from EEPROM and save the contents to a HEX file, use something like <code>-U eeprom:r:filename.hex:i</code></li> <li>To write a HEX file to EEPROM, use something like <code>-U eeprom:w:filename.hex:i</code></li> </ul> <p>In the examples above, <i>filename.hex</i> should be changed to actual name of the file you want to use.</p> <p>Don&#8217;t forget to pass the other required options to AVRDUDE. A complete AVRDUDE command to read from EEPROM would look something like this:</p> <pre>avrdude -c stk500v2 -P COM6 -p atmega328p -U eeprom:r:filename.hex:i</pre> <p>You&#8217;ll need to change &#8220;COM6&#8221; to the actual name of the programmer&#8217;s programming port, which you can find by running <code>pavr2cmd --prog-port</code> or by following the instructions in <a href="#4.5">Section 4.5</a>.</p> <p>More information is available in the AVRDUDE manual, which you can see by running <code>man avrdude</code>.</p> <p class="note"><strong>Note:</strong> Many AVRs have lock bits which might prevent you from reading the EEPROM or flash without first performing a full chip erase.</p>

5.9. Setting fuses and lock bits

<p class="note_warning"><strong>Warning:</strong> Modifying an AVR&#8217;s fuses can leave it an unusable state. In particular, if you select an invalid clock setting, then the AVR&#8217;s clock will not work and you won&#8217;t be able to program it. You should make sure you know what you are doing and be very careful when setting the fuses!</p> <p>The Pololu USB AVR Programmer v2.x supports reading and writing an AVR&#8217;s fuses and lock bits.</p> <p>If you have Windows, the safest and easiest way to set the fuse bits is to use Microchip Studio&#8217;s graphical user interface for it, which can be found in the &#8220;Fuses&#8221; and &#8220;Lock bits&#8221; section of the &#8220;Device Programming&#8221; dialog. In case &#8220;Auto read&#8221; is turned off, click the &#8220;Read&#8221; button to read your device&#8217;s settings. Then make any changes you want to make and click &#8220;Program&#8221;.</p> <p>The fuses and lock bits can also be set using AVRDUDE. Here is an example command:</p> <pre>avrdude -c stk500v2 -P COM6 -p m32u4 -U lock:w:0xHH:m \&#x000A; -U efuse:w:0xHH:m -U hfuse:w:0xHH:m -U lfuse:w:0xHH:m</pre> <p>To make the command above work, you would need to replace each <em>H</em> with a hexadecimal digit. Refer to the your AVR&#8217;s datasheet to figure out the right values for each configuration byte.</p> <p>You&#8217;ll also need to change &#8220;COM6&#8221; to the actual name of the programmer&#8217;s programming port, which you can find by running <code>pavr2cmd --prog-port</code> or by following the instructions in <a href="#4.5">Section 4.5</a>.</p>

5.10. Using the clock output to revive AVRs

<p>It is possible to disable an AVR if you accidentally set its clock-related fuses to something invalid. The clock settings must be valid for any kind of programming to work. If you are having trouble programming an AVR and think it might be due to invalid clock settings, you can try the steps below to supply a 100&nbsp;kHz clock signal to the AVR and revive it.</p> <ol> <li>Connect the AVR to the programmer in the usual way as described in <a href="#5.1">Section 5.1</a>.</li> <li>Configure the programmer&#8217;s B pin to be a 100&nbsp;kHz clock output by running <code>pavr2cmd --line-b clock</code> or by opening the Pololu USB AVR Programmer v2 Configuration Utility, changing &#8220;Line B function&#8221; to &#8220;Clock (output)&#8221;, and clicking &#8220;Apply Settings&#8221;.</li> <li>Set the programmer&#8217;s ISP Frequency to 1.465&nbsp;kHz by running <code>pavr2cmd --freq 1.465</code> or by using the configuration utility.</li> <li>Connect a wire from the programmer&#8217;s B pin to the AVR&#8217;s XTAL2 pin.</li> <li>Perform a full chip erase. In Microchip Studio, you can use the &#8220;Erase now&#8221; button in the &#8220;Memories&#8221; section of the &#8220;Device Programming&#8221; dialog. If you are using AVRDUDE, you can take a command you would normally use for programming, and replace the &#8220;-U&#8221; option and its arguments with &#8220;-e&#8221;.</li> <li>If the chip erase did not work, connect the B pin to XTAL1 and try again.</li> <li>If you still cannot get the chip erase to work, read the troubleshooting advice in <a href="#5.6">Section 5.6</a>. If you change anything, be sure to try both XTAL1 and XTAL2 again.</li> <li>If you <em>still</em> cannot get the chip erase to work, then there is probably something wrong with the AVR besides its clock settings, and you will not be able to revive it using these steps.</li> <li>Reprogram your chip&#8217;s fuses to appropriate values. The easiest way to do this is to use Microchip Studio&#8217;s user interface, but you can also use AVRDUDE as described in <a href="#5.9">Section 5.9</a>.</li> <li>Disconnect the clock signal from the programmer, and set the programmer&#8217;s ISP frequency back to a reasonable value like 114&nbsp;kHz.</li> <li>Try programming to ensure that everything is working as expected. If this works, then you have successfully revived the AVR!</li> </ol>

6. USB-to-TTL serial adapter

6.1. Asynchronous serial communication

<p>One bonus feature of the Pololu USB AVR Programmer v2.x is the USB-to-TTL-serial adapter, which can be used for connecting microcontroller projects to a personal computer. The USB-to-TTL-serial adapter looks like a standard serial port to the operating system, allowing you to use existing terminal programs and software designed to use serial ports. This feature is similar to our <a href="/product/1308">CP2104 USB-to-Serial Adapter Carrier</a>.</p> <p>The <strong>TX</strong> and <strong>RX</strong> lines of the programmer are used to perform asynchronous serial communication. When the programmer receives a byte from the computer via USB, it will transmit that byte on the <strong>TX</strong> line. When the programmer receives a byte on the <strong>RX</strong> input line, it will send that byte back to the computer via USB.</p> <p>The bytes are sent and received eight bits at a time, with the least significant bit first, with no parity and one stop bit. This coding is sometimes abbreviated 8N1. The bits must be <em>non-inverted</em>, meaning that a zero is sent as low voltage, and a one is sent as high voltage. All devices involved in asynchronous serial communication need to agree ahead of time on the duration of one bit (the baud rate), so all devices must be independently configured to run at the same baud rate before they will be able to communicate with each other. The programmer supports all integer baud rates from 300 to 115200 bits per second. The following figure is an example of an 8N1 TTL serial byte transmitted at 5&nbsp;V:</p> <table class="picture_with_caption center"><tr><td><img alt="" class="" data-gallery-pictures="[{&quot;id&quot;:&quot;0J1360&quot;,&quot;caption&quot;:&quot;\u003cp\u003eAsynchronous, non-inverted serial communication with 8 data bits, no parity, and one stop bit.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J1360.98x98.jpg?ebeacb7ab0730155f81feb5d60455d83&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J1360.600x480.jpg?ebeacb7ab0730155f81feb5d60455d83&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J1360.1200.gif?ebeacb7ab0730155f81feb5d60455d83&quot;,&quot;longest_side&quot;:539}]" data-picture-id="0J1360" data-picture-longest_side="539" src="https://a.pololu-files.com/picture/0J1360.350.jpg?ebeacb7ab0730155f81feb5d60455d83" /></td><p></tr></table></p> <p>To make a working serial connection between the programmer and another device, you should make sure to run the programmer at a voltage that is equal to or close to the voltage of the other device. The programmer&#8217;s voltage regulator controls what voltage it will be using, and the regulator settings are described in <a href="#7">Section 7</a>.</p> <p>To use the USB-to-TTL-serial adapter, you must determine what port name the operating system has assigned it. You can look in the upper left corner of the Pololu USB AVR Programmer v2 Configuration Utility, or you can run <code>pavr2cmd --ttl-port</code>, or you can follow the instructions in <a href="#4.5">Section 4.5</a>.</p> <p>After determining the port name, you can use any serial port software to communicate on that port. There are many free terminal programs available, including <a href="https://www.chiark.greenend.org.uk/~sgtatham/putty/">PuTTY</a> (Windows or Linux), <a href="https://teratermproject.github.io/index-en.html">Tera Term</a> (Windows), <a href="https://sites.google.com/site/terminalbpp/">Br@y Terminal</a> (Windows), and <a href="http://linux.die.net/man/1/screen">screen</a> (Linux or Mac OS X). Advanced users developing scripted applications might prefer the free terminal program <a href="http://www.columbia.edu/kermit/">kermit</a>. To use any of these terminal programs with the USB-to-TTL-serial adapter, you must specify the port name determined above and your desired baud rate. The characters you type will be transmitted on the programmer&#8217;s <strong>TX</strong> line. Bytes received by the programmer on the <strong>RX</strong> line will be displayed on the screen by the terminal program.</p> <p>If you need to send and receive non-ASCII bytes, you can use the <a href="/docs/0J23">Pololu Serial Transmitter Utility for Windows</a>.</p> <p>You can also write your own computer program to use the serial port. Windows, Linux, and Mac OS X all provide C APIs for serial port communication. The Microsoft .NET framework supports serial port communication with the <em>System.IO.Ports.SerialPort</em> class. The Qt framework provides the <em>QSerialPort</em> class. Java programs can use the RXTX library.</p>

6.2. Serial control lines

<p>In addition to transmitting bytes on the <strong>TX</strong> line and receiving bytes on the <strong>RX</strong> line, the USB-to-TTL-serial adapter can use programmer pins <strong>A</strong> and <strong>B</strong> as serial handshaking lines of your choosing. Each pin can be configured as an input or an output by identifying it with a serial handshaking line. By default, A is an unused pin that is pulled high, and B is DTR. To change the functions of A and B, you can use the <code>--line-a</code> and <code>--line-b</code> options of <code>pavr2cmd</code> or you can configure the lines in the Pololu USB AVR Programmer v2 Configuration Utility.</p> <p>The following options are available for those lines:</p> <ul> <li><strong>(none)</strong>: The pin will not be used as a serial handshaking line. It will be an input that is pulled high.</li> <li><strong>CD (input)</strong>: The pin will be an input that is pulled high, and the input&#8217;s value will be relayed to the computer as the CD signal.</li> <li><strong>DSR (input)</strong>: The pin will be an input that is pulled high, and the input&#8217;s value will be relayed to the computer as the DSR signal.</li> <li><strong>DTR (output)</strong>: The pin will be an output that reflects the value of the DTR signal from the computer.</li> <li><strong>RTS (output)</strong>: The pin will be an output that reflects the value of the RTS signal from the computer.</li> <li><strong>Clock (output)</strong>: The pin will be an output that sends a 100&nbsp;kHz clock signal. This option is only available for pin B.</li> <li><strong>DTR reset (output)</strong>: The pin will normally be floating, but it will drive low for about 1&nbsp;ms whenever the computer changes the DTR signal from 0 to 1.</li> </ul> <p>(CTS is not available.)</p> <p>The serial handshaking lines are inverted: unless otherwise specified, a voltage of 0 V corresponds to a logical 1, while a voltage of high voltage (VDD) corresponds to a logical 0.</p> <p>You can read input lines and/or set output lines by either using a terminal program that supports control signals (such as <a href="https://sites.google.com/site/terminalbpp/">Br@y Terminal</a>) or by writing a computer program. The Microsoft .NET framework contains a <em>System.IO.Ports.SerialPort</em> class that makes it easy to read and write bytes from a serial port as well as set and read the control signals.</p>

6.3. Connecting to a serial bootloader

<table class="picture_with_caption center"><tr><td style="max-width: 300px"><a href="https://a.pololu-files.com/picture/0J7118.1200.jpg?9b8e69703646ca39c798cbbe1055caf0" class="noscript-fallback"><img alt="" class="zoomable" data-gallery-pictures="[{&quot;id&quot;:&quot;0J7118&quot;,&quot;caption&quot;:&quot;\u003cp\u003eThe Pololu USB AVR Programmer v2 (top) connected to an Adafruit Pro Trinket for programming.\u003c/p\u003e&quot;,&quot;url_tiny&quot;:&quot;https://a.pololu-files.com/picture/0J7118.98x98.jpg?9b8e69703646ca39c798cbbe1055caf0&quot;,&quot;url_medium&quot;:&quot;https://a.pololu-files.com/picture/0J7118.600x480.jpg?9b8e69703646ca39c798cbbe1055caf0&quot;,&quot;url_full&quot;:&quot;https://a.pololu-files.com/picture/0J7118.1200.jpg?9b8e69703646ca39c798cbbe1055caf0&quot;,&quot;longest_side&quot;:1793}]" data-picture-id="0J7118" data-picture-longest_side="1793" src="https://a.pololu-files.com/picture/0J7118.300.jpg?9b8e69703646ca39c798cbbe1055caf0" /></a></td><p></tr><tr><th style="max-width: 300px"><p>The Pololu USB AVR Programmer v2 (top) connected to an Adafruit Pro Trinket for programming.</p></th></tr></table></p> <p>The six pins on the serial header (GND, A, VCC, TX, RX, and B) are arranged to be similar to the pinout of commonly-available FTDI USB-to-serial cables and breakout boards. In the default configuration, pin B is used as the DTR output (and pin A is an unused input). By default, the programmer&#8217;s regulator mode is Auto, which means the programmer will operate at 3.3&nbsp;V when it starts up, but it will change to 5&nbsp;V if you plug it into a 5&nbsp;V device.</p> <p>In this default configuration, the programmer can often be used in place of an FTDI cable: you can plug it directly into various Arduino-compatible boards and use it to upload sketches via a serial bootloader. The rest of this section explains the details of how this works.</p> <p>When you click the &#8220;Upload&#8221; button in the Arduino IDE to program an Arduino such as the Arduino Uno, the IDE will run AVRDUDE with a command like this:</p> <pre>&#x000A;avrdude -patmega328p -carduino -PCOM6 -b115200 -D -Uflash:w:Sketch.ino.hex:i </pre> <p>The <code>-carduino</code> option specifies that AVRDUDE is going to talk to an Arduino-style serial bootloader. This means that after AVRDUDE opens up the specified serial port (COM6 in this case), it will set the DTR and RTS signals on that port to 0, and then set them to 1. Typical serial terminal programs will also set DTR and RTS to 1. When the signals change from 0 to 1, the programmer&#8217;s DTR line will change from a high voltage (VDD) to low (GND). The board with the AVR on it will usually have a simple circuit with a capacitor so that when DTR changes from high to low, the reset line of the board&#8217;s AVR sees a low pulse, making it reset.. This feature is called &#8220;auto-reset&#8221;. Resetting the AVR like this causes its bootloader to run, and AVRDUDE will attempt to talk to the bootloader using the programmer&#8217;s RX and TX lines in order to upload the specified HEX file.</p> <p>Using the programmer&#8217;s configuration software, you can change pin A or B to be the <strong>DTR reset</strong> signal. This is an output that is designed specifically for the auto-reset feature. Whenever DTR changes from 0 to 1, the programmer will drive <strong>DTR reset</strong> low for 1&nbsp;ms. You can plug the <strong>DTR reset</strong> signal directly into an AVR microcontroller&#8217;s <span style="text-decoration:overline;">RST</span> line without needing to use a capacitor.</p>

7. Power settings and status

<p>The Pololu USB AVR Programmer v2.x has several settings that affect how power is regulated, distributed, and monitored. These settings can be seen and changed in the Pololu USB AVR Programmer v2 Configuration Utility or from the command-line utility pavr2cmd. These settings are stored in the programmer&#8217;s non-volatile memory, so they will persist while the programmer is unpowered.</p> <p>The <strong>Regulator mode</strong> setting determines what voltage the programmer will operate at, and it has three options:</p> <ul> <li><strong>Auto</strong> (default): In this mode, the programmer will operate at 3.3&nbsp;V when it starts up, and it will switch to 5&nbsp;V if the voltage on VCC rises above 4096&nbsp;mV. The programmer will switch back to 3.3&nbsp;V if the voltage on VCC falls below 3712&nbsp;mV.</li> <li><strong>5 V</strong>: The programmer will operate at 5&nbsp;V during normal operation. It will still be running at 3.3&nbsp;V briefly when power is first applied, and it will still run at 3.3&nbsp;V when it is in bootloader mode (which is used for firmware updates).</li> <li><strong>3.3 V</strong>: The programmer will always operate at 3.3&nbsp;V.</li> </ul> <p>The <strong>VCC output</strong> setting determines whether the VCC pin (which is on both the ISP connector and the serial header) will be an input or an output. By default, the VCC output is disabled, so the VCC pin will be an input. If you set the VCC pin to be an output, you must also set the regulator mode to either <strong>5 V</strong> or <strong>3.3 V</strong>: that setting specifies both the voltage that the programmer will operate at and the voltage that it will supply to the VCC pin. Using the VCC pin as an output can be useful for powering low-current systems from USB. See <a href="#8">Section 8</a> for more details.</p> <p>If VCC is configured to be an output, then one or both of the yellow LEDs will blink eight times per second to warn you, as described in <a href="#4.4">Section 4.4</a>. If you do not want the LEDs to be blink so fast, you can change the <strong>VCC Output Indicator</strong> setting from &#8220;Blinking&#8221; (the default) to &#8220;Steady&#8221; using the configuration software. This makes the yellow LEDs just stay on solid instead of blinking eight times per second.</p> <p>There are several settings that define what voltage levels on the programmer&#8217;s VDD line and the target AVR&#8217;s VCC line are acceptable. Each of these settings can only be set to a value that is a multiple of 32&nbsp;mV.</p> <p>The <strong>VCC/VDD maximum range</strong> setting, which is 896&nbsp;mV by default, defines the maximum allowed difference between the highest measurement and the lowest measurement for both the programmer&#8217;s VDD line and the target AVR&#8217;s VCC line. If the VCC or VDD varies by more than this amount during programming, then the programmer will abort the current programming session.</p> <p>The <strong>VCC 3.3 V minimum</strong> and <strong>VCC 3.3 V maximum</strong> settings, which are 2720&nbsp;mV and 3872&nbsp;mV by default, define the acceptable voltages for the target&#8217;s VCC line when the programmer&#8217;s regulator is set to 3.3&nbsp;V. If the VCC measurement ever returns a value outside of this range, the programmer will abort the current programming session.</p> <p>Similarly, the <strong>VCC 5 V minimum</strong> and <strong>VCC 5 V maximum</strong> settings, which are 4128&nbsp;mV and 5856&nbsp;mV by default, define the acceptable voltages for the target&#8217;s VCC line when the programmer&#8217;s regulator is set to 5&nbsp;V.</p> <p>The programmer also measures its own VDD voltage during programming. If the regulator is set to 3.3&nbsp;V, the programmer expects the VDD measurements it to be no less than 2912&nbsp;mV. It also expects the VDD measurements to either be no more than 3712&nbsp;mV, or to be no more than 256&nbsp;mV higher than the target&#8217;s VCC power. If the regulator is set to 5&nbsp;V, the programmer expects the VDD measurements to be between 3584&nbsp;mV and 5792&nbsp;mV.</p> <h3>Power status information</h3> <p>You can see a lot of information about the programmer&#8217;s power status in the Pololu USB AVR Programmer v2 Configuration Utility and the command-line utility pavr2cmd. If you are using the configuration utility, these variables are updated each second while the utility is connected to the programmer. In the &#8220;Current status&#8221; box, you can see the latest measurements of the programmer&#8217;s VDD voltage and the target&#8217;s VCC voltage. You can also see the VDD regulator set point, which is the voltage that the programmer is currently setting the regulator to (3.3&nbsp;V or 5&nbsp;V).</p> <p>After any programming attempt, the minimum and maximum measurements for both the programmer&#8217;s VDD and the target&#8217;s VCC are shown in the &#8220;Results from last programming&#8221; box.</p>

8. Using VCC or VBUS to supply power

<p>Generally, when you are programming an AVR or using the programmer&#8217;s USB-to-TTL serial header, the device you are interfacing with should be powered from its own power supply. The programmer does not supply any power on its VCC pins by default. However, if you want to power a low-current and low-capacitance load, you can configure VCC to be an output using the progammer&#8217;s configuration software. When VCC is an output, its voltage will either be 3.3&nbsp;V or 5&nbsp;V, and that is determined by the programmer&#8217;s &#8220;Regulator mode&#8221; setting.</p> <p>If your target board has too much capacitance on VCC, then it could cause the programmer to brown-out or it could cause disruptions in the USB communication. The Pololu USB AVR Programmer v2 cannot handle more than a few &micro;F of capacitance on VCC. The Pololu USB AVR Programmer v2.1 has an improved power switch with a controlled slew rate, so it can power target boards with up to about 33&nbsp;&micro;F on VCC. The Pololu USB AVR Programmer v2.1 still might experience a brown-out reset when you connect it to a target with more than a few &micro;F of capacitance, but after browning out once it is often able to recover and supply power to the target.</p> <p>You should not connect VCC to the output of any other device, since that could cause a short circuit. You should not draw more than 80&nbsp;mA of current from VCC.</p> <p>Alternatively, you can use the programmer&#8217;s VBUS pin to power external devices. This pin is connected directly to the power line of the USB cable. As with the VCC output, you should not draw more than 80&nbsp;mA, and you should not have too much capacitance.</p> <p>It is generally safer to use the VCC output than to use VBUS. The power supplied to the VCC output goes through a diode, which prevents current from flowing back into the USB port, and the programmer&#8217;s linear regulator, which has current limiting. The VBUS pin provides no protections, so there is a higher risk that you would accidentally damage something.</p>

9. Upgrading firmware

<p>The <em>firmware</em> of the Pololu USB AVR Programmer v2.x is the program that runs inside the programmer itself. The programmer has field-upgradeable firmware that can be updated when bug fixes or new features are available.</p> <p>Most users should not need to upgrade the firmware. We only recommend upgrading the firmware if you know that your programmer has an old version of the firmware and that a newer version of the firmware has a specific change that you want.</p> <h3>Firmware versions</h3> <ul> <li><strong>Version 1.00</strong>: This is the original version.</li> <li><strong>Version 1.01</strong>, released on 2016 Jun 20: This version makes the measurements of the voltage on VDD and VCC more accurate.</li> <li><strong>Version 1.02</strong>, released on 2018 Mar 23: This version adds support the new Pololu USB AVR Programmer v2.1. This version contains no important changes for the Pololu USB AVR Programmer v2, so we do not provide a download for it.</li> </ul> <h3>Checking your firmware version</h3> <p>To determine which firmware version you are currently using, connect your programmer to your computer via USB and run the Pololu USB AVR Programmer v2 Configuration Utility. The firmware version is displayed in upper left corner. Alternatively, you can run <code>pavr2cmd -s</code>.</p> <h3>Upgrade instructions</h3> <p>To upgrade the firmware, follow these steps:</p> <ol> <li>If you have not done so already, you will need to install the Pololu USB Bootloader Utility, a command-line utility that supports firmware upgrades for several Pololu products. This program is also known as &#8220;p-load&#8221; because that is the command used to run it from a command prompt. Use the links below to download and install p-load: <ul> <li><strong>Windows</strong>: Download and install the <a href="/file/0J1125/p-load-2.3.0-win.msi"><strong>Pololu USB Bootloader Utility (p-load) for Windows</strong></a> (1MB msi).</li> <li><strong>Mac OS X</strong>: Download and install the <a href="/file/0J1126/p-load-2.3.1-mac.pkg"><strong>Pololu USB Bootloader Utility (p-load) for Mac OS X</strong></a> (87k pkg).</li> <li><strong>Linux</strong>: Download the <a href="/file/0J1380/p-load-2.3.1-linux-x86.tar.xz"><strong>Pololu USB Bootloader Utility (p-load) for Linux (x86)</strong></a> (478k xz) (which works on 32-bit and 64-bit systems) or the <a href="/file/0J1380/p-load-2.3.1-linux-x86.tar.xz"><strong>Pololu USB Bootloader Utility (p-load) for Linux (Raspberry Pi)</strong></a> (478k xz).</li> </ul></li> <li>Download the latest version of the firmware here: <ul> <li><a href="/file/0J1178/pgm04a-v1.01.fmi">Firmware version 1.01 for the Pololu USB AVR Programmer v2</a> (38k fmi)</li> </ul></li> <li>If you changed any of the programmer&#8217;s settings in the configuration utility or with <code>pavr2cmd</code>, record your current settings because the firmware upgrade process will reset the settings.</li> <li>Close the Pololu USB AVR Programmer v2 Configuration Utility and any other programs that might be using the programmer.</li> <li>Open a command prompt and run the following command, replacing <i>filename</i> with the full path to the firmware file that you downloaded: <pre style="margin-left: 1em;">p-load -w &quot;<i>filename</i>&quot;</pre> For example, if you are using Windows, and your username is Casey, and you saved the firmware to your Downloads folder, then you could run: <pre style="margin-left: 1em;">p-load -w &quot;C:\Users\Casey\Downloads\pgm04a-v1.01.fmi&quot;</pre></li> <li>When you run the command above, the Pololu USB Bootloader Utility should take care of everything needed to upgrade the programmer&#8217;s firmware.</li> </ol> <p>If you run into problems during a firmware upgrade, please <a href="/contact">contact us</a> for assistance.</p>

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