Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation Pololu USB AVR Programmer User's Guide http://www.pololu.
Pololu USB AVR Programmer User's Guide 1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.a. Module Pinout and Components . . . . . . . . . . . . . 1.b. Supported Microcontrollers . . . . . . . . . . . . . . . . 1.c. Supported Operating Systems . . . . . . . . . . . . . . . 2. Contacting Pololu . . . . . . . . . . . . . . . . . . . . . . . . . 3. Getting Started in Windows . . . . . . . . . . . . . . . . . . . 3.a. Installing Windows Drivers and Software . . . . . . . . 3.b.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 1. Overview The Pololu USB AVR programmer [http://www.pololu.com/product/1300] is a programmer for Atmel’s AVR microcontrollers and controller boards based on these MCUs, such as Pololu Orangutan robot controllers [http://www.pololu.com/category/8/robot-controllers] and the 3pi robot [http://www.pololu.com/product/975].
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 1.a. Module Pinout and Components Pololu USB AVR programmer, labeled top view. The Pololu USB AVR programmer connects to a computer’s USB port via an included USB A to mini-B cable [http://www.pololu.com/product/1129], and it connects to the target device via an included 6-pin ISP programming cable [http://www.pololu.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation The GND line provides direct access to the grounded line on the USB cable (and ground on the programmer). The TX and RX lines are the TTL serial port for the USB-to-TTL-serial adapter. They are labeled from the computer’s perspective: TX is an output that connects to your target’s serial receive pin and RX is an input that connects to your target’s serial transmit pin.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation and the 3pi Robot [http://www.pololu.com/product/975]. The programmer features upgradable firmware, allowing updates for future devices. It does not currently work with Atmel’s XMega line of microcontrollers. robot-controllers] The programmer is powered by the 5V USB power bus, and it is intended for programming AVRs that are running at close to 5 V (note that the programmer does not deliver power to the target device). 1.c.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 2. Contacting Pololu You can check the Pololu USB AVR programmer page for additional information. We would be delighted to hear from you about any of your projects and about your experience with the Pololu USB AVR Programmer. You can contact us [http://www.pololu.com/contact] directly or post on our forum [http://forum.pololu.com/].
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 3. Getting Started in Windows The Pololu USB AVR programmer works in Windows XP, Windows Vista, and Windows 7. 3.a. Installing Windows Drivers and Software If you use Windows XP, you will need to have either Service Pack 3 [http://www.microsoft.com/downloads/ details.aspx?FamilyId=68C48DAD-BC34-40BE-8D85-6BB4F56F5110] or Hotfix KB918365 installed before installing the drivers for the Pololu USB AVR programmer.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 3. Connect the USB AVR programmer to your computer’s USB port. The programmer is actually three devices in one so your XP computer will detect all three of those new devices and display the “Found New Hardware Wizard” three times. Each time the “Found New Hardware Wizard” pops up, follow steps 4-7. 4. When the “Found New Hardware Wizard” is displayed, select “No, not this time” and click “Next”. 5.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 6. Windows XP will warn you again that the driver has not been tested by Microsoft and recommend that you stop the installation. Click “Continue Anyway”. 7. When you have finished the “Found New Hardware Wizard”, click “Finish”. After that, another wizard will pop up. You will see a total of three wizards when plugging in the programmer. Follow steps 4-7 for each wizard. 3.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation If you use Windows XP and experience problems installing the serial port drivers, the cause of your problems might be a bug in older versions of Microsoft’s usb-to-serial driver usbser.sys. Versions of this driver prior to version 5.1.2600.2930 will not work with the USB AVR programmer. You can check what version of this driver you have by looking in the “Details” tab of the “Properties” window for C:\Windows\System32\drivers\usbser.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation Windows XP device manager showing the Pololu USB AVR Programmer Windows 8 device manager showing the Pololu USB AVR Programmer Some software will not allow connection to higher COM port numbers. In particular, AVR Studio and early versions of Atmel Studio cannot connect to ports higher than COM9. If you need to change the COM port number assigned to your programmer, you can do so using the Device Manager.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 3.b. Programming AVRs Using Atmel Studio 6 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 Pololu AVR Programming Quick Start Guide [http://www.pololu.com/docs/0J51] instead of this tutorial. The following tutorial covers the steps needed to program AVRs in Windows using Atmel Studio 6 [http://www.atmel.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 2. In the Device Selection window, select the device name of your specific AVR. Click OK to create the project. The Device Selection dialog of Atmel Studio 6. 3. Remove the template code that was automatically placed in BlinkLED.c and replace it with the code below: #define F_CPU 20000000 #include #include // AVR clock frequency in Hz, used by util/delay.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation Building a project with Atmel Studio 6. 5. Make sure your USB AVR programmer is connected to your computer via its USB A to mini-B cable and then select Add target… from the Tools menu. Select STK500 as the tool. Select the COM port that has been assigned to the programmer’s programming port, and click Apply. If you are not sure which COM port to select, look in the Device Manager under the “Ports (COM & LPT)” list.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation The “Add target” dialog box in Atmel Studio 6.1. 6. Click the Device Programming button on the toolbar. You can also select Device Programming from the Tools menu. 7. 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 in the list, you will need to add it to the list by following the instructions in Section 3.b.1.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 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. You can test the connection by clicking the Read button next to the Device Signature box. This sends a command to the target AVR asking for its signature.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation As your USB AVR Programmer programs the AVR, you should see all three LEDs flicker and you should see the following text appear at the bottom of the window: Erasing device... OK Programming Flash...OK Verifying Flash...
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation The ATmega328P has been successfully added to the device selection box of Atmel Studio 6. 3.b.2. Using Advanced Features of Atmel Studio 6 This section provides a brief overview of the features of Atmel Studio 6’s Device Programming dialog that were not covered in Section 3.b. You will not typically need to use these advanced features, but it is good to know about them for the rare occasions when you will need them.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation Atmel Studio 6’s interface for setting the ISP frequency. Fuses (proceed with caution!) Selecting Fuses in the Device Programming dialog automatically causes the programmer to read the fuse settings of the target AVR. If the programmer is not connected to the target AVR when you select this tab, Atmel Studio displays an error message.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation the programming process again. This section describes a different method for programming that will allow you to compile and program simply by pressing F5. First, in the View menu, select “Available Atmel Tools”. This will bring up the “Available Tools” window.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation Finally, you should be able to press F5 to build your project and program the resulting HEX file onto your AVR! Alternatively you can program by selecting either “Continue” or “Start Without Debugging” from the Debug menu. 3.c. Programming AVRs Using AVR Studio 4 This tutorial covers the older AVR Studio 4, which is no longer supported by Atmel. For a tutorial on the newer Atmel Studio 6 see Section 3.b.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 1. The Pololu USB AVR Programmer’s drivers (see Section 3.a). 2. WinAVR [http://winavr.sourceforge.net/]: WinAVR is a free, open-source suite of development tools for the AVR family of microcontrollers, including the GNU C/C++ compiler for AVRs (avr-gcc). 3. AVR Studio 4 [http://www.atmel.com/tools/STUDIOARCHIVE.aspx]: AVR Studio 4 is a free integrated development environment (IDE) for programming AVRs offered by Atmel.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation Creating a new AVR Studio 4 project, step 2 3. Write your program in BlinkLED.c as seen in the screen shot below and click the Build button on the toolbar (or press F7). Building a project with AVR Studio 3.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation Note: You will probably want to customize this program slightly if the clock frequency of your AVR is not 20 MHz. F_CPU should be defined as the clock frequency of your AVR in units of Hz. If you do not make this change, the timing of delayms() will be off, but the LED will still blink. 4.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation AVR Studio 4’s programmer-selection dialog If the ISP window does not appear when you click “Connect…”, your computer cannot detect the programmer. Please see Troubleshooting (Section 8) for help identifying and fixing the problem. If AVR Studio brings up a dialog asking if you want to upgrade (or downgrade) your programmer’s firmware, click Cancel to ignore the message and use your programmer.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation test the connection by going to the Main tab and clicking the Read Signature button. This sends a command to the target AVR asking for its device signature. If everything works correctly, you should see “Signature matches selected device”. If the signature does not match the selected device, you probably have the wrong device selected (or possibly your target device is turned off).
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation AVR Studio’s Program ISP tab As your USB AVR programmer programs the AVR, you should see all three LEDs flicker and you should see the following text appear at the bottom of the window: Reading FLASH input file.. OK Setting mode and device parameters.. OK! Entering programming mode.. OK! Erasing device.. OK! Programming FLASH .. OK! Reading FLASH .. OK! FLASH contents is equal to file.. OK Leaving programming mode..
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation be on the bottom of the robot. If there was a problem, please see Troubleshooting (Section 8) for help identifying and fixing it. 3.c.1. Using Advanced Features of AVR Studio 4 This section provides a brief overview of the programming features of AVR Studio 4 that were not covered in Section 3.c. You will not typically need to use these advanced features, but it is good to know about them for the rare occasions when you will need them.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation AVR Studio’s interface for setting the ISP frequency. Fuses (proceed with caution!) Clicking on the Fuses tab automatically causes the programmer to read the fuse settings of the target AVR. If the programmer is not connected to the target AVR when you select this tab, AVR Studio displays an error message.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation Lock Bits Clicking on the Lock Bits tab automatically causes the programmer to read the lock bits of the target AVR. If the programmer is not connected to the target AVR when you select this tab, AVR Studio displays an error message. Lock bits allow you to secure your AVR by preventing further flash writing or reading. The lock bits can be reset to a fully unlocked state by performing a chip erase (i.e.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation Pololu USB AVR programmer configuration utility for Windows. Target VDD Monitor The USB AVR programmer monitors the voltage of the target AVR while it is being programmed to ensure that ISP commands are only sent when the AVR’s VDD is at a safe level, since attempting to program an underpowered AVR can permanently disable it.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation Error From Last Programming When an error or unexpected condition causes the programmer to leave programming mode, or fail to enter programming mode, then the programmer turns on the red LED and records the error code. A description of the error can be found here. See Troubleshooting (Section 8) for details on specific error messages.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation Serial Number This is a unique identifier assigned to this programmer by Pololu. This number can not be changed. TTL Serial Port This section is used to identify pins A and B with serial handshaking lines so that they can be used as general purpose user I/O lines. See Section 6.a. AVR ISP Emulation This section is used to change the hardware and software version numbers of the programmer.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 4. Getting Started in Linux The Pololu USB AVR programmer can be used in Linux to program AVRs and to send and receive bytes on the USBto-TTL-serial adapter. The configuration utility is written for Windows; there is no Linux version.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation [http://www.pololu.com/product/975], this program will blink the red user LED. If you want to program an AVR that does not have an LED connected to pin PD1, the LED-blinker code in this tutorial will have no visible effect. If your device is an ATmega48, ATmega168, or ATmega328P, download the corresponding archive below: • mega48: BlinkLED_m48.zip [http://www.pololu.com/file/download/BlinkLED_m48.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation avrdude: reading on-chip flash data: Reading | ################################################## | 100% 0.05s avrdude: verifying ... avrdude: 224 bytes of flash verified avrdude: safemode: Fuses OK avrdude done. Thank you. rm BlinkLED.o BlinkLED.obj This output indicates the AVR was successfully programmed.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 5. Getting Started in Mac OS X The Pololu USB AVR Programmer can be used to program AVR microcontrollers, using Mac OS X as the development environment. 5.a. Firmware Support for Mac OS X Mac OS X compatibility: we have confirmed that the programmer works on Mac OS X and we can assist with advanced technical issues, but most of our tech support staff does not use Macs, so basic support for Mac OS X is limited.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation If you are using Mac OS X 10.7 or later and have not changed the programmer’s firmware, there should be two new /dev/tty.usb* entries. The entry with the lower number is your programmer’s Programming Port, and later you will need to pass its name as a parameter to AVRDUDE.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation avrdude -p m328p -c avrisp2 -P /dev/cu.usbmodem00022331 -U flash:w:test.hex If all goes well, the output should look something like this: avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 6. Communicating via the USB-to-TTL-Serial Adapter One bonus feature of the Pololu USB AVR programmer is the USB-to-TTL-serial adapter, which can be used for connecting microcontroller projects to a personal computer. The programmer’s drivers make the USB-to-TTL-serial adapter look like a standard serial port to the operating system, allowing you to use existing terminal programs and software that are designed to use serial ports.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation In Windows, the Device Manager shows which port name is assigned to the Pololu USB AVR Programmer’s USB-to-TTL-serial adapter. To determine the port name in Linux, type ls /dev/ttyACM*. The port name will be one of the devices listed there. If there are only two ports, then the USB-to-TTL-serial adapter will be /dev/ttyACM1 (and the programming port will be /dev/ttyACM0).
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation PuTTY is a free Windows terminal program that can send and receive bytes on a serial port. If you need to send and receive non-ASCII bytes, you can use the Pololu Serial Transmitter Utility for Windows [http://www.pololu.com/docs/0J23]. You can also write a computer program to use the serial port. The freely available Microsoft .NET framework contains a SerialPort class that makes it easy to read and write bytes from a serial port.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation input or an output by identifying it with a serial handshaking line. The table below shows which handshaking lines are available (CTS is not available because there is no provision for it in the USB CDC ACM subclass). Direction Name .NET System.IO.Ports.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation For example, if you wanted to connect your Pololu USB AVR Programmer to an AVR running the Arduino bootloader, you could configure pin A to be DTR and then connect pin A to the AVR’s reset line. When the Arduino software sets DTR to 1, the programmer will drive the line A low, which puts the AVR in reset mode.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 7. Measuring Voltages Using the SLO-scope A second bonus feature of the Pololu USB AVR programmer is the severely limited oscilloscope (SLO-scope), which uses lines A and B as inputs to measure TTL-level voltages at a sample rate of up to 20 kHz.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation The SLO-scope application was written as a Visual C# 2008 project: SLO-scope client C# source code [http://www.pololu.com/file/download/sloscope_client_100330.zip?file_id=0J335] (56k zip) Using the Pololu SLO-scope Application This application connects to the programmer, streams data from the SLO-scope, and provides the basic functionality of a 10 or 20 kHz oscilloscope. Pololu SLO-scope client for Windows.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation by hovering over it with your cursor. A purple rectangle highlights the portion of the upper pane is visible in the lower pane. You can adjust the vertical scaling of a channel’s data by changing its volts-per-division parameter, and you can adjust the amount of data that is shown in the lower pane by changing the SLO-scope’s milliseconds-per-division (horizontal scale) parameter.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 8. Troubleshooting This section helps solve problems you might have using the Pololu USB AVR programmer. If the computer fails to connect to the programmer: • If you are using AVR Studio 5 or Atmel Studio, make sure that your programmer has firmware version 1.07 or later. Using a firmware version prior to 1.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation able to communicate. Please make sure that the ISP pins as numbered in Section 1.a are correctly connected between your AVR and your programmer (i.e. 1 goes to 1, 2 goes to 2, etc.). • The target AVR must be powered for programming to work. Please make sure that your target device has power and is turned on.
Pololu USB AVR Programmer User's Guide E: E: I:* E: I:* E: E: I:* E: Ad=02(O) Atr=02(Bulk) Ad=82(I) Atr=02(Bulk) If#= 2 Alt= 0 #EPs= 1 Ad=83(I) Atr=03(Int.) If#= 3 Alt= 0 #EPs= 2 Ad=04(O) Atr=02(Bulk) Ad=84(I) Atr=02(Bulk) If#= 4 Alt= 0 #EPs= 1 Ad=85(I) Atr=03(Int.) © 2001–2014 Pololu Corporation MxPS= 8 Ivl=0ms MxPS= 8 Ivl=0ms Cls=02(comm.) Sub=02 Prot=01 Driver=cdc_acm MxPS= 10 Ivl=1ms Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm MxPS= 8 Ivl=0ms MxPS= 8 Ivl=0ms Cls=ff(vend.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 9. Upgrading Firmware The program that runs on the USB AVR Programmer (the firmware) can be upgraded with bug fixes or new features. Firmware Versions • Version 1.00, released 2009-06-02: This is the original firmware for the programmer. All programmers that shipped from Pololu before 2009-12-17 were shipped with this version. • Version 1.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 2. In the Details tab, select the “Hardware Ids” property in the dropdown box. 3. The first value displayed should be something like USB\VID_1FFB&PID_0081&REV_0101&MI_04. The number after the REV_ is your revision code. If the revision code is “0001” then you have firmware version 1.00. Otherwise, your firmware version is determined by inserting a period in the middle of the revision code.
Pololu USB AVR Programmer User's Guide © 2001–2014 Pololu Corporation 4. Once the programmer is in bootloader mode, it will appear to your computer as a new device called “Pololu pgm03a Bootloader”. ◦ Windows 8, Windows 7, Vista and Linux: The driver for the bootloader will automatically be installed and you can proceed to the next step. ◦ Windows XP: When the “Found New Hardware Wizard” is displayed, follow steps 4–6 in Section 3.a to get the driver working. 5.