background image

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.

The SLO-scope client is written for Windows, and there is no Linux version; Linux users are
unable to use the SLO-scope at this time.

If you would like to write a configuration utility or SLO-scope application for Linux, you can

contact us

[http://www.pololu.com/contact]

for information.

4.a. Linux Driver

No driver installation is necessary to use the Pololu USB AVR Programmer in Linux. The
Linux Kernel comes with a USB-to-serial driver (the cdc_acm module) that automatically
works with the programmer. (The source code for this driver is in the kernel source under

drivers/usb/class/cdc-acm.c

.)

When you plug your programmer in to a Linux computer, the CDC ACM driver should
automatically detect it and create two serial port devices. Unless you have other devices
plugged in that use the CDC ACM driver, the names of these two serial port devices should
be

/dev/ttyACM0

for the programming port and

/dev/ttyACM1

for the USB-to-TTL-serial

adapter.

If the programmer is plugged in, but you do not see these devices, please see
Troubleshooting (

Section 7

) for help identifying and fixing the problem.

4.b. Programming AVRs in Linux

To program AVRs in Linux using the Pololu USB AVR Programmer, you will need to install
four software packages, which can be downloaded from their respective websites. In 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. These hex files can be loaded on to your AVR using avrdude and a
programmer.

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 the USB AVR Programmer to
make an LED connected to PD1 of an AVR blink. On any of the Orangutan

robot

controllers

[http://www.pololu.com/catalog/category/8]

and

the

3pi

Robot

[http://www.pololu.com/catalog/product/975]

this program will blink the red user LED. If

Pololu USB AVR Programmer User's Guide

© 2001–2010 Pololu Corporation

4. Getting Started in Linux

Page 21 of 36

Содержание USB AVR

Страница 1: ...ing AVR Studio 11 3 b 1 Using Advanced Features of AVR Studio 16 3 c Programming AVRs Using AVRDUDE 17 3 d Configuring the Programmer 17 4 Getting Started in Linux 21 4 a Linux Driver 21 4 b Programmi...

Страница 2: ...ser s guide here http www pololu com docs 0J6 Important Safety Warning and Handling Procedures The USB AVR programmer is not intended for young children Younger users should use this product only unde...

Страница 3: ...on the target VDD line is high When it is on solid it means that the SLO scope is enabled and lines A and B are used for the SLO scope instead of the USB to TTL serial adapter The red LED indicates a...

Страница 4: ...about target VDD monitoring The VDD line is not used to power the programmer the programmer is powered from the USB This line cannot be used to power the target device the target device must be indepe...

Страница 5: ...amming software exists for all operating systems The programer s configuration utility works only in Windows but this should not be a big problem for Linux users because all the options that can be se...

Страница 6: ...rojects 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 Tell us what we did well what we...

Страница 7: ...alog product 740 you will need to install the drivers specific to that device Before you connect your Pololu USB AVR programmer to a computer running Microsoft Windows you must install its drivers 1 D...

Страница 8: ...R 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...

Страница 9: ...that another wizard will pop up You will see a total of three wizards when plugging in the programmer Follow steps 6 9 for each wizard If you use Windows XP and experience problems installing the ser...

Страница 10: ...rentheses 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 Windows XP device man...

Страница 11: ...f the Orangutan robot controllers http www pololu com catalog category 8 and the 3pi Robot http www pololu com catalog product 975 this program will blink the red user LED If you want to program an AV...

Страница 12: ...either be ATmega48 ATmega168 or ATmega328P depending on which chip your Orangutan or 3pi Robot has Click Finish Creating a new AVR Studio project step 2 3 Write your program in BlinkLED c as seen in t...

Страница 13: ...selecting Program AVR Connect Connecting to the programmer with AVR Studio 5 This will bring up a programmer selection dialog Select AVRISP as the platform The USB AVR programmer uses AVR ISP version...

Страница 14: ...ither be ATmega48 ATmega168 or ATmega328P Selecting the device for ISP programming in AVR Studio 7 If you have not done so already connect the programmer to the target device using the 6 pin ISP cable...

Страница 15: ...nd it as default project name hex Click the Program button make sure you click the one in the Flash section not one in the EEPROM or ELF Production File Format sections AVR Studio s Program ISP tab As...

Страница 16: ...ease see the Atmel s AVR Studio documentation for more detailed descriptions of these features ISP Frequency In the ISP window under the Main tab the Programming Mode and Target Settings section lets...

Страница 17: ...programmed chip 3 c Programming AVRs Using AVRDUDE It is possible to program AVRs in Windows using AVRDUDE http www bsdhome com avrdude AVRDUDE is free and included in the WinAVR http winavr sourcefor...

Страница 18: ...illivolts When the programmer recieves an ISP programming request it starts keeping track of the maximum and minimum measurements of the AVR s VDD If the difference between the maximum and minimum exc...

Страница 19: ...V 168 Baby Orangutan and 3pi robot can be programmed at 2000 kHz 1 845 MHz in AVR Studio which is the fastest setting An AVR running at 8 MHz or higher e g the original Orangutan can be programmed at...

Страница 20: ...VR Studio expects then it brings up a dialog asking if you want to upgrade or downgrade your programmer s firmware the Pololu AVR USB programmer does not support this method of firmware upgrading so t...

Страница 21: ...erial port devices should be dev ttyACM0 for the programming port and dev ttyACM1 for the USB to TTL serial adapter If the programmer is plugged in but you do not see these devices please see Troubles...

Страница 22: ...our 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 At this po...

Страница 23: ...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 The LED con...

Страница 24: ...one stop bit This coding is sometimes abbreviated 8N1 The bits must be non inverted meaning that a zero is sent as low voltage and a one is sent as high voltage All devices involved in asynchronous se...

Страница 25: ...t port There are many free terminal programs available including PuTTY http www chiark greenend org uk sgtatham putty Windows or Linux Tera Term http hp vector co jp authors VA002416 teraterm html Win...

Страница 26: ...receiving bytes on the RX line the USB to TTL serial adapter can use programmer pins A and B as serial handshaking lines of your choosing Each pin can be configured as an input or an output by identif...

Страница 27: ...a serial port as well as set and read the control signals Here is some example C NET code that uses a serial port in this way Choose the port name and the baud rate System IO Ports SerialPort port ne...

Страница 28: ...se their serial handshaking line associations while the SLO scope is active but these associations are restored once the SLO scope is disabled You can disable the SLO scope via the SLO scope applicati...

Страница 29: ...signal but it should not exceed 100 k or so Installing and Runing the Pololu SLO scope Application The SLO scope application for Windows comes with the Windows drivers Section 3 a and can be installed...

Страница 30: ...his is approximately 10 seconds 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 p...

Страница 31: ...e vertical position of the 0V level of a channel click and drag that channel s corresponding 0V indicator triangle on the left side of the lower pane While the SLO scope is running lines A and B do no...

Страница 32: ...nal programs connected to your programmer s programming port If you have multiple versions of AVR Studio running make sure that you have closed the ISP programming dialogs in all of them When the ISP...

Страница 33: ...ux 2 6 24 drivers usb class cdc acm c This device cannot do calls on its own It is no modem 26 413542 cdc_acm 2 1 1 2 ttyACM1 USB ACM device 26 421314 usbcore registered new interface driver cdc_acm 2...

Страница 34: ...p If none of the above troubleshooting suggestions help please contact us http www pololu com contact for support Pololu USB AVR Programmer User s Guide 2001 2010 Pololu Corporation 7 Troubleshooting...

Страница 35: ...s below to determine the programmer s revision code To determine the programmer s revision code in Windows 1 Open up the Device Manager 2 Double click on the Pololu USB AVR Programmer entry in the Pol...

Страница 36: ...dmesg You can use any baud rate 6 Type the following lower case letters in to your terminal program to send them to the bootloader fwbootload After each letter is sent the bootloader should echo back...

Отзывы: