background image

This software package also contains the installation files for the Pololu SLO-scope
application for Windows. Please see

Section 6

for installation and usage instructions.

3.b. Programming AVRs Using AVR Studio

After you’ve installed the necessary drivers, the next step is to download and install a
compiler.

WinAVR

[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++. Please follow the installation instructions they provide.

WinAVR alone will give you all the tools you need to start programming AVRs with the
USB AVR programmer, but Atmel offers

AVR Studio

[http://www.atmel.com/avrstudio/]

a free

integrated development environment (IDE) designed to work with the WinAVR 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. Please 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.

The following tutorial covers the steps needed to program AVRs using AVR Studio and
a Pololu USB AVR programmer. Specifically, we will write a simple program to blink
an LED connected to pin PD1 of an AVR. 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

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 you have an Orangutan or 3pi and want to jump straight in to using your USB AVR
programmer, you can skip steps 1-3 by downloading the AVR Studio project these steps
would create. Determine the microcontroller on your device, download the corresponding
file below, extract all the files to a directory, open the AVR Studio project file (BlinkLED.aps),
and proceed to step 4.

• mega48:

BlinkLED_m48.zip

[http://www.pololu.com/file/download/

BlinkLED_m48.zip?file_id=0J188]

(9k zip)

• mega168:

BlinkLED_m168.zip

[http://www.pololu.com/file/download/

BlinkLED_m168.zip?file_id=0J189]

(9k zip)

• mega328:

BlinkLED_m328.zip

[http://www.pololu.com/file/download/

BlinkLED_m328.zip?file_id=0J190]

(9k zip)

1.
Open AVR Studio and click

New Project

. Select

AVR GCC

for the project type. Enter

the project name and initial file name. In the screenshot below, we named our project
“BlinkLED” and elected to have a folder called “C:\BlinkLED” created containing the
blank file “BlinkLED.c”. Click

Next >>

. DO NOT click “Finish” yet. If you do accidentally

click “Finish”, you will not be able to perform step 2 and will instead have to set the
device by going to the “Project” menu and selecting “Configuration Options”.

Pololu USB AVR Programmer User's Guide

© 2001–2010 Pololu Corporation

3. Getting Started in Windows

Page 11 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...

Отзывы: