Pololu 1300 User Manual

Usb avr programmer

Advertisement

Quick Links

Pololu USB AVR Programmer User's Guide
© 2001–2019 Pololu Corporation
Pololu USB AVR Programmer
User's Guide
https://www.pololu.com/docs/0J36/all
Page 1 of 64

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 1300 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Pololu 1300

  • Page 1 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation Pololu USB AVR Programmer User’s Guide https://www.pololu.com/docs/0J36/all Page 1 of 64...
  • Page 2: Table Of Contents

    2. Contacting Pololu ........
  • Page 3: Overview

    The USB AVR programmer is not intended for young children! Younger users should use this product only under adult supervision. By using this product, you agree not to hold Pololu liable for any injury or damage related to the use or to the performance of this product. This product is not designed for, and should not be used in, applications where the malfunction of the product could cause injury or damage.
  • Page 4: Module Pinout And Components

    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, and it connects to the target device via an included...
  • Page 5 The A and B lines can be used as serial control/handshaking lines for the USB-to-TTL-serial adapter (see Section 6.a) or as analog voltage inputs for the SLO-scope (see Section Pololu USB AVR programmer bottom view with dimensions. 1. Overview Page 5 of 64...
  • Page 6: Supported Microcontrollers

    5 V (note that the programmer does not deliver power to the target device). 1.c. Supported Operating Systems We support using the Pololu USB AVR Programmer on Windows Vista, Windows 7, Windows 8, Windows 10, Linux, and Mac OS X.
  • Page 7 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation use the TX and RX USB-to-TTL-serial adapter pins. The SLO-scope application works only in Windows. The programmer is compatible with a variety of AVR programming utilities for Windows, Linux and Mac OS, including AVRDUDE, AVR Studio 4, AVR Studio 5, and Atmel Studio.
  • Page 8: Contacting Pololu

    Pololu USB AVR programmer page for additional information. We [https://www.pololu.com/product/1300] 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 [https://www.pololu.com/contact] directly or post on our forum .
  • Page 9: Getting Started In Windows

    Service Pack 3, so we recommend Service Pack 3 over the hotfix. Please note that these drivers will only work for the USB AVR programmer; if you have Pololu’s original Orangutan USB programmer , you will need to install the drivers [https://www.pololu.com/product/740]...
  • Page 10 Pololu USB AVR programmer, in which case no further action from you is required. Windows XP users: After the installation has finished, follow steps 3-7 for each new Pololu USB AVR programmer you connect to your computer.
  • Page 11 Pololu USB AVR Programmer User’s Guide © 2001–2019 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.
  • Page 12 “Pololu USB AVR Programmer TTL Serial Port”. In parentheses after these names, you will see the name of the port (e.g. “COM3” or “COM4”). If you expand the “Pololu USB Devices” list you should see an entry for the Pololu USB AVR programmer.
  • Page 13 Windows XP device manager showing the Pololu USB AVR Programmer Windows 8 device manager showing the Pololu USB AVR Programmer The COM ports in the Device Manager might actually be named “USB Serial Device” instead of having a descriptive name as shown in the screenshots above. 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.
  • Page 14: Programming Avrs Using Atmel Studio

    Section 7 for usage instructions. 3.b. Programming AVRs using Atmel Studio 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 instead of this tutorial.
  • Page 15 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation After you have completed these prerequisites, you can create a new Atmel Studio project: 1. Open Atmel Studio and click New Project. In the New Project dialog, select GCC C Executable Project for the template.
  • Page 16 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation 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 // AVR clock frequency in Hz, used by util/delay.h #include <avr/io.h>...
  • Page 17 Pololu USB AVR Programmer User’s Guide © 2001–2019 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.
  • Page 18 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation The “Add target” dialog box in Atmel Studio 6. 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.
  • Page 19 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation Selecting a programmer, device, and interface in the Device Programming dialog of Atmel Studio 6. If you got an error that says “Unable to connect to tool STK500” and you see an error message in the Output pane in the main window that says “The signature of the attached tool is AVRISP_2, which...
  • Page 20: Adding Devices To Atmel Studio 6

    Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation Click the Program button in the Flash box. The Memories section of the Device Programming dialog in Atmel Studio 6. 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...
  • Page 21 5. Restart Atmel Studio. A new entry for your device should now be visible in the Device drop down box of the Device Programming dialog. This should allow you to program HEX files onto that device from Atmel Studio using the Pololu USB AVR Programmer. 3. Getting Started in Windows...
  • Page 22: Using Advanced Features Of Atmel Studio

    Click Read to read the frequency from the programmer and click Write to write the selected frequency to the programmer. It is important to note that the actual frequency values displayed in Atmel Studio not correct when you are using the Pololu USB AVR programmer. See Section 3.e for a list of the actual frequencies and more information about selecting the ISP frequency.
  • Page 23 Pololu USB AVR Programmer User’s Guide © 2001–2019 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.
  • Page 24: Faster Programming With F5 In Atmel Studio

    It is a good idea to set the frequency to something between 80 and 90 kHz (which will result in 200 kHz on the Pololu AVR Programmer) at first and to try increasing it later once F5 programming is working.
  • Page 25: Programming Avrs Using Avr Studio 4

    Pololu USB AVR Programmer User’s Guide © 2001–2019 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”...
  • Page 26 © 2001–2019 Pololu Corporation a Pololu USB AVR programmer. Specifically, we will write a simple program to blink an LED connected to pin PD1 of an AVR. If you want to program an AVR that does not have an LED connected to pin PD1, the code in this tutorial may need to be modified.
  • Page 27 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation Creating a new AVR Studio 4 project, step 1 2. Select AVR Simulator as the debug platform and then select the appropriate device for your target AVR. For an Orangutan or 3pi Robot, this will either be ATmega48, ATmega168, ATmega328P, ATmega324PA, ATmega644P, or ATmega1284P depending on which chip your Orangutan or 3pi Robot has.
  • Page 28 Pololu USB AVR Programmer User’s Guide © 2001–2019 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).
  • Page 29 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation Building a project with AVR Studio 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.
  • Page 30 Auto and AVR Studio will try all the ports until it detects the programmer. You can determine your programmer’s port name by looking in the “Ports (COM & LPT)” list of your Device Manager for “Pololu USB AVR Programmer Programming Port”. Click “Connect…” to bring up the ISP window.
  • Page 31 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation 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.
  • Page 32 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation Reading the device signature in AVR Studio’s Main ISP tab 8. Now it is time to program your target device. Select the Program tab. Your Input HEX File in the Flash section needs to be the hex file that was generated when you built your program.
  • Page 33 Pololu USB AVR Programmer User’s Guide © 2001–2019 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..
  • Page 34: Using Advanced Features Of Avr Studio 4

    Write to write the selected frequency to the programmer. It is important to note that the frequencies in the ISP Freq list are not correct when you are using the Pololu USB AVR programmer. Section 3.e for a list of the actual frequencies and more information about selecting the ISP frequency.
  • Page 35 Pololu USB AVR Programmer User’s Guide © 2001–2019 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.
  • Page 36: Programming Avrs Using Avrdude

    • The argument following the -P is the port name. You can determine your programmer’s port name by looking in the “Ports (COM & LPT)” list of your Device Manager for “Pololu USB AVR Programmer Programming Port”. Using will also usually work.
  • Page 37: Configuring The Programmer

    Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation 3.e. Configuring the Programmer The Pololu USB AVR programmer can be configured using the Pololu USB AVR Programmer Configuration Utility for Windows. The utility comes with the Windows drivers (Section 3.a).
  • Page 38 3.b.2) as well as in the Configuration Utility, but the frequencies listed in the Atmel Studio user interface do not match the actual frequencies used by the Pololu USB AVR programmer. The correspondence is shown below: 3. Getting Started in Windows...
  • Page 39 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation Frequency Listed Allowed Target Actual Frequency in Atmel Studio Frequency 1.843 MHz 2000 kHz > 8 MHz 460.8 kHz 1500 kHz > 6 MHz 115.2 kHz 750 kHz > 3 MHz 57.6 kHz...
  • Page 40 © 2001–2019 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.
  • Page 41: Getting Started In Linux

    © 2001–2019 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 USB-to-TTL-serial adapter. The configuration utility is written for Windows; there is no Linux version. All of the parameters that can be set in the configuration utility are stored in persistent memory, so Linux users only have to use Windows when they want to change those parameters, which should not be too often.
  • Page 42 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation 3. binutils-avr: tools for converting object code into hex files 4. avrdude: the software to drive the programmer Once these packages are installed, you will be able to compile C programs for the AVR with gcc to produce hex files.
  • Page 43 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation Reading | ################################################## | 100% 0.08s avrdude: Device signature = 0x1e9406 avrdude: erasing chip avrdude: safemode: Fuses OK avrdude done. Thank you. /usr/bin/avrdude -c avrispv2 -p m168 -P /dev/ttyACM0 -U flash:w:BlinkLED.hex...
  • Page 44: Getting Started In Mac Os X

    Pololu USB AVR Programmer User’s Guide © 2001–2019 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 If you want to use the programmer with Mac OS X 10.11 (El Capitan) or later, you will need to upgrade...
  • Page 45 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation Installing CrossPack To program AVRs in Mac OS X, you will need the free avr-gcc compiler, avr-libc, AVRDUDE, and other associated tools. 1. Download the CrossPack for AVR Development [http://www.obdev.at/products/crosspack] which is packaged as a .dmg file.
  • Page 46 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation avrdude: 3392 bytes of flash written avrdude: verifying flash memory against test.hex: avrdude: load data flash data from input file test.hex: avrdude: input file test.hex auto detected as Intel Hex avrdude: input file test.hex contains 3392 bytes...
  • Page 47: Communicating Via The Usb-To-Ttl-Serial Adapter

    To determine the port name in Microsoft Windows, open the Device Manager, expand the “Ports (COM & LPT)” list, and look for the “Pololu USB AVR Programmer TTL Serial Port” entry. The port name will be at the end of this line in parentheses (e.g. “COM4”). In Windows, a given device will always be...
  • Page 48 Pololu USB AVR Programmer User’s Guide © 2001–2019 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 . The port name will be one of the devices ls /dev/ttyACM* listed there.
  • Page 49: Communicating Via The Serial Control Lines

    Pololu USB AVR Programmer User’s Guide © 2001–2019 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...
  • Page 50 By default, pins A and B are high-impedance inputs that are not identified with any handshaking line. To use pins A and/or B, you must configure them to be serial handshaking lines using the Pololu USB AVR Programmer Configuration Utility (see Section 3.e).
  • Page 51 0 V corresponds to a logical 1, while a voltage of 1 V corresponds to a logical 0. 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.
  • Page 52 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation // Choose the port name and the baud rate. System.IO.Ports.SerialPort port = System.IO.Ports.SerialPort("COM4", 115200); // Connect to the port. port.Open(); // Assuming that line A is identified with RTS, and your firmware version is 1.04 // or greater, this drives line A low (0 V).
  • Page 53: Measuring Voltages Using The Slo-Scope

    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.
  • Page 54 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation code (56k zip) [https://www.pololu.com/file/0J335/sloscope_client_100330.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.
  • Page 55 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation of data when running at 10 kHz and 5 seconds of data when running at 20 kHz. To review the captured data in detail, click the Stop button (in the same place that the Run previously occupied).
  • Page 56: Troubleshooting

    © 2001–2019 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.
  • Page 57 COM port. You can do this by opening the properties dialog of the “Pololu USB AVR Programming Port” (found in the “Ports (COM & LPT)” section of the Device Manager) and clicking the “Advanced…” button under the “Port Settings”...
  • Page 58 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation • 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.
  • Page 59 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation Try comparing the outputs on your system to the outputs above to determine what went wrong. Still need help? If none of the above troubleshooting suggestions help, please contact us [https://www.pololu.com/...
  • Page 60: Upgrading Firmware

    • 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.01, released on 2009-12-17: This version contains two bug fixes related to the programmer’s TTL serial port.
  • Page 61 1. Double click on the “Pololu USB AVR Programmer” entry in the “Pololu USB Devices” list. 2. In the Details tab, select the “Hardware Ids” property in the dropdown box.
  • Page 62 © 2001–2019 Pololu Corporation 1. Run the following command: ioreg -p IOUSB -n "Pololu USB AVR Programmer" | grep bcdDevice 2. This should output a line that has a number on it. If the number is 1 then you have firmware version 1.00.
  • Page 63 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation The Pololu USB AVR Programmer’s bootloader pads. 4. Once the programmer is in bootloader mode, it will appear to your computer as a new device called “Pololu pgm03a Bootloader”. ◦ Windows 10, Windows 8, Windows 7, Vista, Linux, and Mac OS X: The driver for the bootloader will automatically be installed and you can proceed to the next step.
  • Page 64 Pololu USB AVR Programmer User’s Guide © 2001–2019 Pololu Corporation 10. While the file is being sent, the bootloader will send back period characters (“….”). This process will take about 5 seconds. When the firmware upgrade is complete, the bootloader should send back a pipe character (“|”) and turn the red LED on.

Table of Contents