Home

Section 4.2 - Florida Gulf Coast University

image

Contents

1. host Shared Folders truth324 On My Mac File Edit Search View Project Tools Settings Help Bee Boc 53 CodewWizardavR Shift FZ2 l Debugger shift F3 Me l Chip Programmer Shift F4 fs Code Navigator 7 X Terminal Shift F5 host Sm CodeVisionAVR Configure ples i Project stk500_daq_t I prow mg wad Ful akas LOL ha sree aim Figure 4 24 Screenshot of how to access the CodeVisionAVR Programmer tool 4 2 2 5 Select the desired MCU from the Chip drop down menu within the CodeVisionAVR Chip Programmer window Also select the appropriate SCK Freq Vincent A Rosa Florida Gulf Coast University Page 8 of 11 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor i e the appropriate SPI Bus Serial Clock Frequency which is the speed for the Serial Peripheral Interface SPI In this example the target MCU is the ATmega8s515L which has a default SCK frequency of 230400 Hz 15 as shown in Figure 4 25 The ATmega8515 L Datasheet 4 further explains how to calculate this frequency with respect to different settings e g SCK with respect to Oscillator Frequency in the subsection SPI Control Register SPCR of section Serial Peripheral Interface SPI CodeVisionAVR Chip Programmer STK500 AVRISP File Edit Program Read Compare Help Chip ATmega8515L ov Prooram All CB Reset Chip SCK Frea 230400 v Hz F
2. 4 15 Screenshot of accessing the Figure 4 16 Screenshot of the Windows Run Windows Run utility from the Start menu utility Vincent A Rosa Florida Gulf Coast University Page 3 of 11 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor GY C WINDOWS system32 cmd exe o x Microsoft Windows AF Version 5 1 2600 C Copyright 1985 2001 Microsoft Corp C Documents and Settings Administrator cd C stkS _example gt stkSHA_example gt 4 F Figure 4 17 Screenshot of a CMD session where the directory has been changed This concludes how to program the STK500 using the Windows command line utility The error shown in Figure 4 18 will appear if the board is not powered on or has an incorrect hardware setup If this is the case be sure the board 1s powered on and is set up as directed in section 2 1 of this document The error shown in Figure 4 19 will appear if the referenced HEX file 1s not within the specified location Simply correct this by referencing the correct location or by adding the referenced HEX file into the same location as the Stk500 exe program Figure 4 20 shows the board was successfully programmed after fixing the two previously listed errors Appendix section A 3 Troubleshooting addresses some of the common errors encountered in this section and provide some techniques on how to resolve them Vincent A Rosa Florida Gulf Coast University Page 4 of 11 Spring
3. gt _ gt Figure 4 20 Screenshot of a CMD session where programming an STK500 was successful 4 2 2 Using CodeVisionA VR Evaluation to Program the STK500 The following procedure instructs the user how to program one of the AVR devices installed in a target socket on the STK500 PCB The AVR device being programmed within this procedure is the ATmega8515L MCU If CodeVisionAVR is not already opened refer to instruction 4 1 1 1 to open the CodeVisionAVR Evaluation IDE 4 2 2 1 Ifa project is not already opened within the CodeVisionAVR IDE go to the File menu select Open go to the desired directory that contains a CodeVisionAVR project file prj and open this project as in Figure 4 21 Be sure that all project files have already been built as in instruction 4 1 1 12 Otherwise skip this step Vincent A Rosa Florida Gulf Coast University Page 6 of 11 Spring 2009 Communicating with a User Manual Atmel AVR STK500 Host PC and Temperature Sensor SK CodeVisionAVR Open Leg File Edit Search View Project Look in O STK500_DAQ_Temp hd a E gt fie Ty New Ctrl N exe i Z Open Ctrl O LD Clinker My Recent CD List Reopen Documents obj G stk500_daq temp prj Desktop hy Tees Page Setup PE My Computer amp File name stk500_daq_ temp pr ae ei Exit My Network Files of type Project files prj Figure 4 21 Screenshot of how to open an existing CodeVisionAVR project
4. i Start Lock Biks 5 h i Fuse Bitis Check al Figure 4 26 Screenshot of how to access the Erase Chip program command from the Code VisionAVR Chip Programmer 4 2 2 7 Goto the Program menu within the CodeVisionAVR Chip Programmer window and select FLASH as seen in Figure 4 27 This will program the flash memory of the target MCU Vincent A Rosa Florida Gulf Coast University Page 10 of 11 Spring 2009 Atmel AVR STK500 Communicating with a Host PC and Temperature Sensor User Manual S CodeVisionAVR Chip Programme File Edit Program Read Compare Help WC Erase Chip Chip X Blank Check v los SCK F Si FLASH Hz ve Ty EEPROM Start a Lock Bits 5 h SS Fuse Bitis eck all ii Pee eee ee ee eee Ch Figure 4 27 Screenshot of how to access the FLASH program command from the Code VisionAVR Chip Programmer 4 2 2 8 Click on the X in the top right corner of the CodeVisionA VR Chip Programmer window as seen in Figure 4 25 to exit the CodeVisionAVR Chip Programmer 4 2 2 9 Click on the X in the top right corner of the CodeVisionA VR window as seen in Figure 4 13 to exit the entire CodeVisionAVR IDE If any changes have been made to any files without saving them a pop up window will appear confirming whether the files should be saved Select Yes to save the changes and exit select No to just exit or select Cancel to not exit and return to the program This concludes how to use the Co
5. 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor C WINDOWS system32 cmd exe Microsoft Windows XP Version 5 1 2600 lt C gt Copyright 1985 2081 Microsoft Corp C Documents and SettingssAdministrator cd C stkSH _example C stk5S _example gt stk5S dAaTmega 5i5 ms e pf uf ifstk5S 6_prog hex ccom4 I KS 4 command line programmer v 2 2 Atmel Corp lt 9 2084 2065 Could not connect to STK5S66 U2 on com4 C2sstk5 0_example gt E E gt Figure 4 18 Screenshot of a CMD session where an error occurred programming an STK500 CAWINDOWS system32 cmd exe o x Microsoft Windows AP Version 5 1 2600 KO Copyright 1985 2081 Microsoft Corp C Documents and Settings Administrator gt cd C stkSh _example C stk5 _example gt stk5a dATmega85i5 ms e pf uf ifstkS 6_prog hex ccom4 STKS66 command line programmer v 2 2 Atmel Corp C gt 20604 2005 Could not connect to STK580 U2 on com4 C2sstk560_example stk506 dATmega 515 ms e pf vf ifstk566_prog hex ccom4 STKS command line programmer v 2 2 Atmel Corp CG 2684 2085 Connected to STKS 4 U2 on port com4 Device parameters loaded Programming mode entered Device erased Could not read FLASH input File Programming mode left Connection to STKS686 VZ closed WARNING One or more operations failed Please examine the output log abovet C zNstk5 _example gt x a Figure 4 19 Sc
6. Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor 4 Application Programming 4 2 Uploading an Application Programming the Board It is important to remember that the target microcontroller installed on the STK500 is what is actually being programmed Only HEX file programs can be uploaded to the flash memory of the target MCU and only HEX or ROM file programs can be uploaded to the EEPROM memory of the target MCU The flash memory of AVR microcontrollers is typically what is programmed because of its available space and relatively unlimited read and write life cycles EEPROM memory has a limited write life cycle so only programs that will be used frequently and remain relatively unchanged are reserved for EEPROM 10 This project focuses on the use of the flash memory only The STK500 PCB has a specific RS 232 communication protocol that requires data to be received for in system programming using eight data bits one stop bit and no parity at 115 2 kbps i e at a rate of 115200 baud 14 The following subsections describe two ways of using this protocol to upload an application to an STK500 board 4 2 1 Using a Command Line Utility to Program the STK500 The microcontroller installed on an STK500 can be programmed using the Windows command line utility CMD The CMD session must be in the same directory as the Stk500 exe program which is located in C Program Files Atmel AVR Tools STK500 when AV
7. LASH EEPROM Start 0 h End 345 h Start 0 h End 1FF h Checksum 1920h Checksum FEQOh Chip Programming Options FLASH Lock Bits Program Fuse Bitfs No Protection Et cs Programming disabled mr Programming and Verification disabled a C BODEN 0 Boot Lock Bit 0 Boot Lock Bit 1 _ BODLEVEL 0 po 1B02 1 6111 1812 BOOTAST 0 B01 0 BO2 1 B11 0812 1 C BOOTSZ1 0 C E EESAVE 0 BO1 0 BO2 0 B11 0812 0 7 CKOPT 0 Opoi 1B02 0 Opit 1B120 YETONAO i Check Signature V Check Erasure Preserve EEPROM Verify Figure 4 25 Screenshot of the CodeVisionAVR Chip Programmer tool Vincent A Rosa Florida Gulf Coast University Page 9 of 11 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor 4 2 2 6 Goto the Program menu within the CodeVisionAVR Chip Programmer window and select Erase Chip as seen in Figure 4 26 This will erase the flash memory of the target AVR device in this case the ATmega8515L It is good practice in AVR development to always erase the target memory before programming it Sometimes erasing the memory is a required action to ensure data consistency between the amount of utilized i e programmed memory and the size of the program being uploaded to memory CodeVisionAVR C hip Programme File Edit Program Read Compare Help 4 Erase Chip Chip E Blank Check v f SCK F Si FLASH ly Hz T EEPROM l rLasi w
8. R Studio is installed in its default directory The Stk500 exe program is an STK500 DOS programmer provided by Atmel It can be copied and pasted to any desired location after AVR Studio is installed The HEX file that will be programmed to the board must either be in the same location as the Stk500 exe program or its directory must be provided in the command line used to program the board the preceding option is recommended and is used for the sample DAQ project provided in this document Any pre existing HEX file can have its name changed without it losing its functionality A list of all applicable commands is given in the STK500 User Guide 1 Being able to use CMD allows for a batch file bat to be created that automatically programs the board when the file is opened A batch file is simply a text file that contains CMD commands that will be executed line by line within a CMD session as soon as the file is opened The batch file given in Vincent A Rosa Florida Gulf Coast University Page 1 of 11 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor Appendix section A 2 2 3 provides an example of how the command utility can be used to program the STK500 The following list of commands and how they are used accompany the instructions that provided an example of how to use the CMD to program an ATmega8515L MCU when it is installed in a target socket on an STK500 Before performing the following instructi
9. deVisionAVR IDE to program an AVR device using an existing CodeVisionAVR project Appendix section A 3 Troubleshooting addresses some of the common errors encountered during this procedure and explains how to resolve them Vincent A Rosa Florida Gulf Coast University Page 11 of 11 Spring 2009
10. from the CodeVisionAVR IDE 4 2 2 2 Goto the Settings menu and select Programmer as seen in Figure 4 22 to establish the appropriate AVR board with which the CodeVisionA VR Chip Programmer will be communicating i CodeVisionAVR host Shared Folders truth 3 24 File Edit Search view Project Tools Settings Help bes Haganas gt Set Debugger gh pi By o ih HP AE AXE B 9 Programmer E Code Navigator RE ce gE Terminal fu ee ee ee oe rt LcAam Jo Lo Figure 4 23 Screenshot of how to access the CodeVisionAVR Programmer settings 4 2 2 3 Select the desired AVR board under the AVR Chip Programmer Type drop down menu within the Programmer Settings pop up window Also select the COM Vincent A Rosa Florida Gulf Coast University Page 7 of 11 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor port to which the serial USB cable is attached from the AVR board in use In this example an AVR STK500 evaluation board is connected to the host PC at COM3 as seen in Figure 4 23 Click OK to proceed amp Programmer Settines wR Chip Frogrammer Type Atmel STK500 AVRISP Communication Port coma We ATmegal69 CKDIVS Fuse Warning Figure 4 23 Screenshot of the CodeVisionAVR Programmer Settings pop up window 4 2 2 4 Goto the Tools menu within the CodeVisionAVR IDE and select Chip Programmer as seen in Figure 4 24 ise CodeVisionAVR
11. lorida Gulf Coast University Page 2 of 11 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor 4 2 1 2 Goto Start and select Run as shown in Figure 4 15 4 2 1 3 Type cmd into the text field of the Run utility that pops up as shown in Figure 4 16 and click OK This will start a new instance of a CMD shell session 4 2 1 4 Change the directory using the cd command followed by the location designated in step 4 2 1 e g enter cd C stk500_example as shown in Figure 4 17 4 2 1 5 Enter the following line into the current CMD session stk500 dATmega8515 ms e pf vf ifstk500_prog hex ccom4 Administrator Internet __ My Documents Internet Explorer S TE My Recent Documents y E mail ahoo Mail i D My Pictures S Microsoft Update i bey My Music f r My Computer p a Notepad gt t My Network Places CV Codevisin YR C Compiler Evaluati AVR Evauation o Control Panel b ge Microsoft Visual Studio 2008 Cay Set Program Access and ra Defaults Fun E HenerTerminel E Printers and Faxes es 2 n on Type the name of a program Folder document or WE aa i Help and Support ES Microsoft Office Word 200 Internet resource and Windows will open it For you pe Search Wine Open cmd v s 7 Run E O p All Programs gt gt r Log OFF Turn OFF Computer Cancel Browse 2 Start eM Figure
12. ons be sure to establish the hardware setup described in the Hardware Connectivity section 2 1 and then power on the board using the switch shown in Figure 2 3 The Troubleshooting section of the appendix section A 3 provides some common techniques used to be sure the board is properly powered on and is ready to be used Commands Summary d device_name m programming_mode e optional_memory_device p memory_device v memory_device if HEX_file c com_port Executed Commands dATmega8515 gt get the protocols to program the Atmega8515 ms gt serial programming mode e gt erase all memory devices before programming pf gt program the flash memory VE gt verify the flash memory ifstk500_prog hex gt use the HEX file stk500_prog hex to program the flash ccom4 gt use com4 as the communication port 4 2 1 1 Copy and paste both the Stk500 exe program and the desired HEX file into a designated location which is C stk500_example for this procedure Create this directory if it does not exist CodeVisionAVR stores the HEX file built from an application in a folder labeled Exe within the directory assigned for this application Use the HEX file located in C stk500_example STK500_TestProg Exe created from section 4 1 1 to better follow this example Copy and paste this file into C stk500_example and rename the pasted file to stk500_prog hex Vincent A Rosa F
13. reenshot of a CMD session where an error occurred programming an STK500 Vincent A Rosa Florida Gulf Coast University Page 5 of 11 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor C WINDOWS system32 cmd exe Jof x icrosoft Windows KP Uersion 5 1 2600 a lt C gt Copyright 1985 2661 Microsoft Corp Documents and Settings Administrator gt cd C stk566_example stk566_example gt stk566 dATmega8515 ms e pf uf ifstkS 6_prog hex ccom4 STKS6 command line programmer v 2 2 Atmel Corp CG 2664 26065 ould not connect to STKS6 U2 on com4 stk566_example gt stk566 dATmega8515 ms e pf uf ifstkS56 _prog hex ccom4 STK56 6 command line programmer v 2 2 Atmel Corp CG 2664 2065 onnected to STK5 U2 on port com4 Device parameters loaded Programming mode entered Device erased ould not read FLASH input file Programming mode left onnection to STKS66 U2 closed ARNING One or more operations failed Please examine the output log above stk5 _example gt stk566 dATmega8515 ms e pf uf ifstk5 _prog hex ccom4 STK506 command line programmer v 2 2 Atmel Corp O 2004 2005 onnected to STKS6 6 U2 on port com4 Device parameters loaded Programming mode entered Device erased FLASH input file read Programming FLASH FLASH programmed Reading FLASH FLASH read FLASH verified successfully Programming mode left onnection to STK566 U2 closed stk560_example

Download Pdf Manuals

image

Related Search

Related Contents

Lymph 12 Pro User Manual  Product datasheet    Marantz DV-18mkII DVD Player  MANUAL DE OPERAÇÕES    Microsoft Computer Hardware mainboard User's Manual  PP119 - Servicenter.cl  HC1 Quick Start Guide [English] (P/N 72-165008  THALASSA DINARD - Novotel Dinard Thalassa Hotel  

Copyright © All rights reserved.
Failed to retrieve file