Documents »Pololu Orangutan USB Programmer User's GuideView document on multiple pages.
1. OverviewThe Orangutan USB Programmer is a compact solution for programming our Orangutan robot controllers or 3pi robot through a USB port. Our programmer incorporates a USB-to-serial adapter and emulates an AVR ISP programmer so that you can program your Orangutans or 3pi with any software that can talk through a serial port to an AVR ISP. The unit also doubles as a USB-to-serial adapter (TX and RX only), allowing you to communicate with your Orangutan, 3pi, or any other microcontroller, through a terminal program. Unlike some other AVR programmers, the Orangutan USB programmer does not recieve its power from the circuit to be programmed. Instead, it receives its power via the USB A to mini-B cable that connects it to a personal computer. This cable is not included with your programmer; if you do not already have one, you can purchase it separately from our web site. The 6-pin ISP programming cable that connects the programmer to your target device is included. Note: The Orangutan USB programmer should be able to program all AVR microcontrollers that support paged program and EEPROM memory, but we can only support Orangutan and 3pi programming at this time. This product is not needed for the Orangutan X2, which has its own built-in AVR ISP programmer. 2. Contacting PololuYou can check the Orangutan USB Programmer page for additional information. We would be delighted to hear from you about any of your projects and about your experience with the Orangutan USB programmer. You can contact us directly or post on our forum. 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! 3. Module Pinout and Components
USB-to-Serial Adapter Mode: Programmer Mode: Revision Number: LEDs: The red and green programming status LEDs near the center of the board will give you feedback when the Orangutan USB programmer is being used in programming mode. The green LED will flash every time the programmer receives a valid AVR ISP command packet from the personal computer to which it is connected. The red LED will flash every time the programmer sends information over the 6-pin ISP cable to the device being programmed. These LEDs do not do anything when the Orangutan USB programmer is in USB-to-serial mode. If you have programmer version PGM02B, you will have additional LED feedback. Every time your programmer powers up (i.e. when you connect it to your computer), the red and green status LEDs will both light for five seconds. During this period, the programmer is receptive to firmware updates; you should avoid trying to program until the initial five seconds have elapsed and the two status LEDs have turned off. Additionally, if your programmer is not connected to a target device or if your target device is not powered, the programmer’s red LED will flash once per second to indicate that it will not let you program. Connecting to Your 3pi Robot:
The Orangutan USB programmer connects to your 3pi robot via the included 6-pin ISP cable, which plugs into the 3pi’s keyed ISP port located just behind the right wheel as shown above. Connecting to Your Orangutan:
The Orangutan USB programmer connects to your Orangutan or Baby Orangutan via the included 6-pin ISP cable. The cable must be oriented so that the programmer’s ISP header pin 1 connects to your (Baby) Orangutan’s ISP header pin 1. Unlike the Orangutan and Orangutan LV-168, the Baby Orangutan does not come with a shrouded header to enforce correct cable orientation; the red wire and arrow mark on the cable’s ISP connector should be lined up with the arrow to pin 1 on the Baby Orangutan PCB. You will only be able to achieve this alignment by connecting to the top side of the Baby Orangutan PCB, so be very careful not to solder your 6-pin ISP header onto the wrong side of your Baby Orangutan! Note: The programmer does not deliver power to the device it is programming, so your Orangutan must be turned on to be programmed. If you are using programmer version PGM02A, attempting to program an unpowered device will have unpredictable results; this might randomly change the fuse settings, which can in turn permanently disable your Orangutan (see Fuses in Section 5.b). If your programmer version is PGM02B, the programmer will not let you program an unpowered device (you will see the red status LED blink once per second if your target device is not powered). 4. USB-to-Serial DriversBefore you connect your Orangutan USB programmer to your computer, you must install the driver for the programmer’s CP2102 USB-to-UART bridge. Once you have successfully installed your this driver, you should see the green USB status LED near the mini-B connector lit whenever it is connected to your computer. 5. Getting Started Using WindowsAfter you’ve installed the necessary drivers, the next step is to download and install a compiler. WinAVR, located at http://winavr.sourceforge.net/, is an open source suite of software development tools for the Atmel AVR series of microcontrollers. It includes the GNU GCC compiler for C and C++. Follow the installation instructions they provide. WinAVR alone will give you all the tools you need to start programming your Orangutan or 3pi robot, but Atmel offers AVR Studio, a free integrated development environment that works with the GCC C/C++ compiler. AVR Studio includes a simulator and other useful tools, and supports the AVR ISP protocol used by the Orangutan USB programmer. You can download AVR Studio from http://www.atmel.com/avrstudio/. Follow Atmel’s installation instructions. Note that newer versions of AVR Studio might not work with older versions of WinAVR, so we recommend you upgrade to the newest version WinAVR every time you get a new version of AVR Studio. 5.a. Using AVR StudioNote: The instructions in this section were written for AVR Studio version 4.13, build 528. The most recent version of AVR Studio at the time of this update is version 4.13 Service Pack 2, build 571. The AVRISP dialog has changed slightly in this newer version, so the screen shots you see in this section may differ from what you see when you run AVR Studio. Here we will show you step by step how to use AVR Studio make the red user LED blink on your Orangutan, Orangutan LV-168, Baby Orangutan, or 3pi robot. If you want to skip the steps that setup the LED-blinker code and jump straight into using your Orangutan USB programmer, you can download the AVR Studio project these steps would help you create—BlinkLED.zip (14k zip)—and proceed straight to step 4. Please note that this BlinkLED program will not work on the Orangutan X2.
5.b. AVR Studio in More DetailThis section provides a brief overview of the the other tabs in the AVRISP dialog. It’s rare that you’ll want to use anything other than the Program tab, but it’s useful to know what the other tabs let you do for the rare occasions when you’ll need them.
Note: You can permanently disable your Orangutan by setting the fuses incorrectly. Only advanced users who know precisely what they are doing should change these fuse settings!
The Oscillator and ISP Clock section lets you set the frequency of the clock used when programming the target device. This frequency must be less than a quarter of your target’s clock. It is important to note that the frequencies in the ISP Freq list are not correct when you are using the Orangutan USB programmer. Here is how the listed frequencies relate to the actual frequencies:
Note: In the latest version of AVR Studio, the interface for setting your programmer’s ISP frequency has moved to the Main tab.
5.c. Configuring Your Programmer for AVR StudioConfiguring your programmer’s version numbers is purely optional. Your programmer will still function with incorrect or mismatched version numbers. When AVR Studio connects to your programmer, it requests the programmer’s hardware and software version numbers. If these versions don’t match what AVR Studio is expecting, it will bring up a dialog box asking if you want to upgrade (or, if you have an old version of AVR Studio, downgrade) your programmer’s firmware as shown below. In the example screen shot below, our Orangutan USB programmer has a software version of 02.07 and AVR Studio is expecting a software version of 02.0A:
The Orangutan USB programmer does not support AVR Studio’s firmware upgrade/downgrade system, so this dialog is nothing more than an annoyance that we will have to dismiss every time we try to bring up the AVRISP dialog. Pressing OK will result in AVR Studio’s attempting (and failing) to upgrade our programmer’s firmware, so the proper response is to press Cancel to proceed to the AVRISP dialog. The warning can be safely ignored, so to stop AVR Studio from issuing it we can configure the programmer’s software and version hardware numbers to match what AVR Studio is expecting. The first step in the configuration process is to determine the COM port of your Orangutan USB programmer. One way to do this is to bring up your computer’s Device Manager, expand the “Ports (COM & LPT)” list, and note the COM port associated with “Pololu USB-to-serial adapter”. Use your favorite terminal program to connect to this port at 115,200 baud with 8-bit characters, no parity and one stop bit. This is occasionally represented as 115200-8-N-1. In the screen shots below we use Hyper Terminal for this. Once the connection is made, type “config” in all lowercase to get into configuration mode. As you type the letters you should see the programmer echo them back to your terminal. If you make a mistake entering the string, you will see a “ here we have transmitted: config Once the versions are transmitted the programmer waits for a configuration command. The two valid commands are “s”, for software version configuration, and “h”, for hardware version configuration. The screen shots below show us configuring our programmer’s software version to be 2.0A, which will match what our AVR Studio expects. here we have transmitted: s here we have transmitted: 2.0a After the final character of the software version is sent, the programmer will echo back its new software version. If you have sent the version correctly, the version echoed should be what you sent. If you have not sent it correctly, the version echoed should be the software version it had before you started the configuration. 5.d. Using AVRDUDEIt is also possible to program your Orangutan using AVRDUDE, which is included in the WinAVR package. To send the blinking LED program to your Orangutan, you would type something similar to following into a command console:
avrdude -p m168 -P COM2 -c avrispv2 -e -U flash:w:BlinkLED.hex The argument following the -p is the part number and should be either m168 or m48. The argument following the -P is the port; you can use your computer’s Device Manager to figure out the COM port of your Orangutan USB programmer. The programmer ID is specified using the -c option and should be avrispv2. The -e option results in a chip erase and the -U option is used for writing, reading, or verifying flash, EEPROM, fuses, or lock bits. In this example we are using -U to write BlinkLED.hex to flash. Please see the AVRDUDE documentation in WinAVR\doc\avrdude\ for more detailed information. 6. Getting Started Using LinuxRecent versions of the linux kernel include support for the Pololu Orangutan USB Programmer as part of the usb-serial driver. We have tested the following instructions under Ubuntu Linux 7.04; if you experience any problems, we recommend you upgrade to the most recent version of your distribution. To begin working with AVRs under linux, you will need to install four software packages, which can be downloaded from their respective websites. Under Ubuntu Linux, these packages are provided in the “Universe” repository.
Once these packages are installed, you will be able to compile C programs for the AVR with gcc to produce hex files. We will not go into the details of writing C programs for the AVR here, but, as an example, we will show you how to use your linux computer and Orangutan USB programmer to make the user LED on your Orangutan, Orangutan LV-168, or Baby Orangutan blink. Download the archive BlinkLED.zip (14k zip) and unpack it on your linux computer. Copy the file BlinkLED/linux/Makefile into the BlinkLED/ directory. It may be necessary for you to edit this file, changing the settings at the beginning to reflect the locations where the AVR utilities were installed. In addition, the line
should be changed to
if you are using a Baby Orangutan with an ATmega48 processor. Lastly, if you are using an Orangutan (instead of a Baby Orangutan or Orangutan LV-168), you might want to edit BlinkLED.c by uncommenting line 2 and commenting out line 3 to account for the Orangutan’s lower clock frequency. At this point, you should be ready to compile the example program and load it onto the Orangutan. Plug in the programmer and type
You should see output like this:
This output indicates the Orangutan was successfully programmed, and the LED on the board should begin to blink. If programming was not successful, please take a look at our troubleshooting advice (Section 7). 7. TroubleshootingIf Your Computer Fails to Connect to the Programmer
If Your Programmer Has Problems Connecting to Your Target Device
If none of the above troubleshooting suggestions help, please contact us for support. 8. Updating Your Programmer's FirmwareNote: Only programmer revision PGM02B supports firmware upgrades. If you have revision PGM02A, this section does not apply to your product. On August 20, 2008 we released a firmware update (firmware version 1.4) for the Orangutan USB programmer revision PGM02B that fixes a bug where the programmer could be left trying to drive some of its programming lines high if programming failed. On July 31, 2008 we released a firmware update (firmware version 1.3) for the Orangutan USB Programmer revision PGM02B that causes the programmer to immediately abort if the target device loses power while programming is in progress, which makes it much less likely for the AVR to be corrupted. It also allows the programmer to work better with our Orangutan LV-168, Baby Orangutan B, and 3pi robot, which all have motor driver control lines that double as programming lines. Version 1.2 could cause motors connected to these devices to briefly kick during programming. Version 1.3 will not drive motors during programming. Note that version 1.2 (and hence also version 1.3) fixed a serious bug in the programmer’s version 1.1 firmware. This bug causes the programmer to pull too much current while connected to the target device, which in turn can damage the programmer. You can determine your firmware version number by following the steps listed in Section 5.c (Configuring Your Programmer for AVR Studio). The programmer used in the following screen shot has firmware version 1.0 (“Fw: 1.0”): From this step, you can type x to exit without changing any version numbers. If you have firmware version 1.1, 1.2, or 1.3, please download this file: pgm02b_firmware_v1.4.pgm (47k pgm) and follow the firmware update procedure detailed in the rest of this section. 8.a. Upgrade Preparations1. Install a suitable terminal programTo perform the firmware update, you will need a terminal program capable of sending binary files. We recommend Tera Term Pro v2.3, available for free at http://hp.vector.co.jp/authors/VA002416/teraterm.html. Installation instructions are included in the downloaded .zip file. 2. Close any programmer serial port connectionsClose any existing COM port connections you have that might interfere with the upgrading process. For example, if you have AVR Studio open, make sure the AVRISP programming window is closed as this window ties up the COM port your programmer is using. 3. Determine your COM port
Connect your programmer to your computer and bring up your computer’s device manager. One way to accomplish this is through the hardware tab of the System control panel. Another way is to right-click on “My Computer” and select “manage,” which should bring up a window like the one shown above. Select “Device Manager” on the left and then expand the “Ports (COM & LPT)” list on the right. Make note of the COM port associated with “Pololu USB-to-serial adapter”. (If you have another Pololu device that uses the CP2102 USB adapter, you might see a different device description.) In our example below you can see the port is COM6. If your port is COM4 or less, or if your terminal program can use higher port numbers, please move on to Section 8.b otherwise, continue with the following step. 4. Make sure your port is COM1 through COM4 (TeraTerm only)Tera Term cannot connect to COM6, so we need to change the COM port number. Right-click the “Pololu USB-to-serial adapter (COMx)” and select “Properties”. Select the “Port Settings” tab of the resulting dialog box and click the “Advanced…” button. At the bottom of the next dialog box is a drop-down list labeled “COM Port Number”. When you select this list you can see all the ports available to you. You need to select a port from COM1 to COM4 that is not marked as “(in use)”. In the example below, valid choices would be COM2 or COM4; we select COM2. If COM1 through COM4 are all in use, you have three options: 1) find a way to free up one of those ports by disconnecting something 2) find another terminal program that will let you send binary files to ports greater than COM4 3) reassign your programmer to an “in use” port that you know nothing is currently connected to. Note that if you choose option 3, you might run into problems in the future if you ever simultaneously connect your programmer and the other device that is configured to use that port. Once you have chosen your new port, click OK on both the Advanced and Properties windows and close the Computer Management window. If you re-open Computer Management window, you should see your serial adapter mapped to your newly selected port. 8.b. Uploading the New Firmware1. Run Tera Term Pro v2.3You will be greeted by a “TeraTerm: New connection” dialog box. Click cancel, then go to the “Setup” menu and select “Serial port…”. Configure the settings as shown below, substituting your own COM port. The baud rate should be 115200 with 8-bit data, no parity, one stop bit, and no flow control. You do not need any transmit delays. The only settings you should have to change from their default values are the port and the baud rate. Do not click OK yet. 2. Enter the programmer’s firmware update modeWhen you connect your programmer to your computer via the USB cable, you should see both the red and green status LEDs light for approximately five seconds. During this time, the programmer is waiting for the proper input sequence that will put it into firmware update mode. The procedure for entering firmware update mode is as follows:
3. Loading the new firmwareFrom the “File” menu, select “Send file….” Navigate to the directory that has the .pgm file you wish to upload and select the file. Before you click “Open,” make sure you have checked the binary checkbox option in the lower left part of the window. If you fail to check this box, the upload will fail. When you click “Open”, you should see periods streaming across your terminal window . Each period represents the successful transmission of a packet. You should also see the red status LED below the reset button flickering as the firmware update progresses. When the upload is complete, the programmer will transmit *SUCCESS to indicate success. If there is a problem, the programmer will transmit either STARTERR or CHKSUMERR, most likely followed by a stream of *’s and a few c’s. The most likely cause for such a problem would be the failure to transmit the firmware upgrade file as a binary file. If repeating the steps in this section again do not lead to a successful firmware update, please see Section 2 for information on how to contact us for support. |
|
Home
|
Contact
|
About
|
Forum
|
US toll free: 1-877-7-POLOLU |