6. Getting Started Using Linux

Recent 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.

  1. gcc-avr: the GNU C compiler, ported to the AVR architecture
  2. avr-libc: a library giving access to special functions of the AVR
  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. 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 or Baby Orangutan blink.

Download the archive that is appropriate for your device’s microcontroller:

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. Additionally, if you are using an original Orangutan mega168 (instead of a Baby Orangutan, Orangutan SV-xx8, Orangutan LV-168, or 3pi robot), you might want to edit BlinkLED.c by uncommenting line 2 and commenting out line 3 to account for the Orangutan’s lower 8 MHz 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 make.

You should see output like this:

    /usr/bin/avr-gcc -g -Os -Wall -mcall-prologues -mmcu=atmega168   -c -o BlinkLED.o BlinkLED.c
    /usr/bin/avr-gcc -g -Os -Wall -mcall-prologues -mmcu=atmega168 BlinkLED.o -o BlinkLED.obj
    /usr/bin/avr-objcopy  -R .eeprom -O ihex BlinkLED.obj BlinkLED.hex
    /usr/bin/avrdude -c avrispv2 -p m168 -P /dev/ttyUSB0 -e
    
    avrdude: AVR device initialized and ready to accept instructions
    
    Reading | ################################################## | 100% 0.02s
    
    avrdude: Device signature = 0x1e9406
    avrdude: erasing chip
    
    avrdude: safemode: Fuses OK
    
    avrdude done.  Thank you.
    
    /usr/bin/avrdude -c avrispv2 -p m168 -P /dev/ttyUSB0 -U flash:w:BlinkLED.hex
    
    avrdude: AVR device initialized and ready to accept instructions
    
    Reading | ################################################## | 100% 0.02s
    
    avrdude: Device signature = 0x1e9406
    avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.
    avrdude: erasing chip
    avrdude: reading input file "BlinkLED.hex"
    avrdude: input file BlinkLED.hex auto detected as Intel Hex
    avrdude: writing flash (160 bytes):
    
    Writing | ################################################## | 100% 0.07s
    
    avrdude: 148 bytes of flash written
    avrdude: verifying flash memory against BlinkLED.hex:
    avrdude: load data flash data from input file BlinkLED.hex:
    avrdude: input file BlinkLED.hex auto detected as Intel Hex
    avrdude: input file BlinkLED.hex contains 160 bytes
    avrdude: reading on-chip flash data:
    
    Reading | ################################################## | 100% 0.05s
    
    avrdude: verifying ...
    avrdude: 160 bytes of flash verified
    
    avrdude: safemode: Fuses OK
    
    avrdude done.  Thank you.
    
    rm BlinkLED.o BlinkLED.obj

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).

Related Products

Baby Orangutan B-168 + USB Programmer Combo
Baby Orangutan B-48 + USB Programmer Combo
Orangutan + USB Programmer Combo
Baby Orangutan B-328 + USB Programmer Combo
3pi Robot + USB Programmer + Cable Combo
Orangutan LV-168 + USB Programmer Combo
Orangutan SV-168 + USB Programmer Combo
Orangutan SV-328 + USB Programmer Combo
Orangutan USB Programmer
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