Et-avr-jtag-manual

  • April 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Et-avr-jtag-manual as PDF for free.

More details

  • Words: 2,891
  • Pages: 40
คูมือการใชงาน ET-AVR JTAG USB V1.0

ET-AVR JTAG USB V1.0 ET-AVR JTAG USB V1.0 is a board that is designed to download Hex File and debug for AVR MCU of ATMEL through JTAG Interface. It can be used with MCU that has Module JTAG Interface only and it must be used with Program AVR Studio 4.XX

Specifications of ET-AVR JTAG USB V1.0 1. Its specifications are equivalent to AVR JTAG ICE of ATMEL 2. Support Debugger as Real Time 3. Program and Debug MCU that has Module JTAG Interface 4. Can upgrade Firmware directly through Program AVR Studio 4 without using external programmer, so we can use new MCU numbers. This Firmware is attached with Program AVR Studio 4. 5. Can be used with Power Supply from 2.7V to 5.5V 6. Communication through Port USB 7. Signal Clock to supply to MUC if Fuse bit selects Signal Clock wrongly 8. LED to display state operation of Power, Activity and USB

Numbers of AVR Microcontroller that can be used with ET-AVR JTAG USB V1.0 (AVR Studio 4.12)

ATmega16 , ATmega16L ATmega162 , ATmega162L ATmega169 , ATmega169L , ATmega169V ATmega32 , ATmega32L ATmega323 , ATmega323L ATmega64 , ATmega64L ATmega128 , ATmega128L AT90CAN128

ETT CO.,LTD

-1-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0 Proceeding to install Driver of ET-JTAG AVR USB V1.0 1. Interface ET-AVR JTAG USB V1.0 with computer through USB Port without interfacing Target Board and windows will search new Hardware as shown in the picture below.

2. It will display window “Found New Hardware Wizard”, select “Install from a list or specific location (Advanced)” and then click Next.

3. Select values as shown in the picture below and then click Button Browse to specify location that stores Driver and then click OK.

ETT CO.,LTD

-2-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

4. Click Button Next after we successfully selected values and windows will search Hardware to install Driver.

ETT CO.,LTD

-3-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

5. It will display window “Hardware Installation” and declare that Hardware fails to test by windows. Click “Continue Anyway” and windows will install Driver of ET-AVR JTAG USB V1.0.

ETT CO.,LTD

-4-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

6. Click Finish when it displays windows and declares that installation is completely.

ETT CO.,LTD

-5-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

7. For a moment, Driver will create Serial Port and display window to install Driver of USB Serial Port as shown in the picture below. Select values as same as the previous step and then click Next.

8. Select location of Driver; in this case, we can click Next instantly because it usually remembers

ETT CO.,LTD

-6-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0 the old value. Then windows will search Hardware to install Driver.

9. It will display window “Hardware Installation” and declares that Hardware fails to test by windows. Click “Continue Anyway” and windows will install Driver of ET-AVR JTAG USB V1.0.

ETT CO.,LTD

-7-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

10. Click Finish when it displays windows declares that installation is complete.

ETT CO.,LTD

-8-

and

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

11. We can check Drive Installation of ET-AVR JTAG USB V1.0, click Control Panel System select Tab Hardware and select Device Manager and we will see lists of Hardware ET-AVR JTAG USB V1.0 as shown in the picture below.

ETT CO.,LTD

-9-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0 12. Double click ET-AVR JTAG USB V1.0 in the part of Port(COM&LPT) and it will display window Properties as shown in the picture below; select Port Setting and then click Button Advanced…

13. Set Receive(Bytes) and Transmit(Bytes) as shown in the picture below and then click OK to confirm the modification. Then restart computer or scan new Hardware.

ETT CO.,LTD

-10-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0 The connection Microcontroller

between

ET-AVR

JTAG

and

AVR

Picture displays the connection between ET-AVR JTAG and AVR Microcontroller. We must use only cables; TCK, TDO, TMS, TDI, VCC, and GND; in this case, we do not use VTref PIN because circuit of ET-AVR JTAG USB V1.0 has already interfaced with VCC. We must supply power to Target Board separately because it can not use Power Supply from ETAVR JTAG USB V1.0 and we must shift Switch Mode to be NORMAL mode only.

Picture displays Pin Position of ET-AVR JTAG USB V1.0 from bottom view.

ETT CO.,LTD

-11-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

Picture displays the connection between ET-AVR JTAG and ET-AVR START KIT V1.0/EXP.

ETT CO.,LTD

-12-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0 Applications of ET-AVR JTAG USB V1.0 in Program Mode We can use Program mode to set Security Bits and Configuration Bits as same as Program PonyProg2000 as mentioned below; 1. Open Program AVR Studio, it will display window “Welcome to AVR Studio”, click Cancel to close this window.

2. Select Menu Tools Program shown in the picture below.

ETT CO.,LTD

-13-

AVR Connect… as

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0 3. It will display window “Select AVR Programmer” as shown in the picture below, select Platform to be JTAG ICE and Port that ET-AVR JTAG USB V1.0 is interfaced and then click Button Connect…

4. If Program USB V1.0 “JTAG ICE” MCU number select MCU

AVR Studio can connect with ET-AVR JTAG successfully, it will display window as shown in the picture below, select from the Device blank; in this case, we number to be ATmega64.

5. Go to Tab Advance to select Baud Rate to be 115200 that is the maximum high speed to communicate with ET-AVR JTAG USB V1.0.

ETT CO.,LTD

-14-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

6. Open File for programming to CPU, select file in the blank of Input HEX File and specify name and location of HEX File for programming. Select value in the blank of Programming mode to be Erase Device Before Programming to erase the old data before programming and select Verify Device After Programming to verify data after programming.

ETT CO.,LTD

-15-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

7. If we do not want to modify any Fuses and LockBits, we can press Button Program to program Hex File into MCU instantly because Fuses and LockBits still be the old value after it is programmed for a once, it is not erased with program. If we want to modify value, we can program later because it does not effect on program.

8. When we successfully programmed HEX File into MCU without any error, it will display message as shown in the picture below.

ETT CO.,LTD

-16-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

9. If we want to modify Fuses and LockBits, we can select Fuses and LockBits to set values and program later as shown in the picture below. NOTE: Do not take away JTAG Interface Enabled’ [JTAGEN=0] because we can not communicate through JTAG.

ETT CO.,LTD

-17-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

NOTE: If using Board to test, it is necessary to program this LOckBits because this value is used to protect reading and overwriting MCU.

ETT CO.,LTD

-18-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0 Applications of ET-AVR JTAG USB V1.0 in Debug Mode This Debug Mode is used to see state operation of MCU. We can debug step by step type or automatic type. While debugging, values of MCU will be changed follow program, so we can see its results instantly. It can debug by both Assembly Language and C Language; for example; if we write program of running light, we will see light running follow state of debugging. Proceeding of application Debug Mode is mentioned below that is example of 1 running light because it is easy to see its result.

Example of debugging by Assembly Language 1. Open Program AVR Studio, it will display window “Welcome to AVR Studio”, click New Project to create new project as shown in the picture below.

2. Select Project type to be Atmel AVR Assembler to write Assembly Language Program, identify its name in the blank of Project name, select the blank Create initial file to create file Assembly and create file project, select the blank Create folder to create folder and save file project, and then select directory to save file project and finally click Button Next as shown in the picture below.

ETT CO.,LTD

-19-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

3. Select Debug platform to be JTAG ICE and select Device to be ATmega64 and then click Button Finish as shown in the picture below.

4. It will display window Text Editor program as shown in the picture below.

ETT CO.,LTD

-20-

to

write

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

5. Type example Assembly Language Program as shown below; in this case, program does not use Time Delay because it is easy to see debug proceeding in time.

ETT CO.,LTD

-21-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0 ;******************************************************* ;* Examples Program For "ET-AVR STAMP ATmega64" Board * ;* Target MCU : Atmel ATmega16 * ;* Frequency : X-TAL : 16 MHz * ;* Compiler : AVR Studio 4.12 (AVR Assembler 2) * ;* Create By : ADISAK CHOOCHAN (WWW.ETT.CO.TH) * ;* Last Update : 1/September/2005 * ;* Description : Example LED Blink on Portb.0 * ;******************************************************* ;Connect PB0 to LED1 .include "m64def.inc" ;************************ ; Define Register ;************************ .def TEMP = R16 ;*********************** ; Define I/O Port,Pin ;*********************** .equ LED = 0 ;******************* ; Main Program ;******************* .CSEG .ORG 0 RJMP RESET

;Reset Handle

RESET:

MAIN:

LDI OUT LDI OUT

TEMP,LOW(RAMEND) SPL,TEMP TEMP,HIGH(RAMEND) SPH,TEMP

;Initial Stack Pointer

SBI

DDRB,LED

;Config Portb.0 as output

SBI PORTB,LED CBI PORTB,LED RJMP MAIN

;LED Off ;LED On ;Loop

6. Compile the written program, click MENU Build Build. It will display message 0 errors 0 warning if it successfully compiled program without any error.

ETT CO.,LTD

-22-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

7. Click Menu Debug picture below.

Start Debugging as shown in the

8. Then program will download data into MCU and enter to debug. There’s sign to show the beginning of program as shown in the picture below. On the right hand, it displays window I/O View to show Register values of MCU.

ETT CO.,LTD

-23-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

9. We can adjust speed for debugging, select Menu Debug JTAG ICE Options. We can adjust frequency of Port JTAG but it does not over than ¼ of the used frequency.

10. Select type of debugging both Auto Step or Step by Step at Tool Bar as shown in the picture below; in this case, we select Step by Step.

ETT CO.,LTD

-24-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

11.

program debugs through command SBI PORTB,LED that is command setting PORTB.0 to be LOGIC 1 and LED that is at PORTB.0 is in status OFF because circuit of board configure LED running with LOGIC 0. We click Button Step Info again when it runs through command CBI PORTB,LED, it makes LED is in status ON and values in window I/O View will be changed follow program.

ETT CO.,LTD

When

-25-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0 Example of Debugging by C Language Program AVR Studio can debug Software that is written by Assembly Language and C Language. This example below is debugging by C Language and using Program CodeVisionAVR C Compiler and Program AVRStudio for debugging. 1. Open Program CodeVisionAVR C Compiler and then click Menu File New as shown in the picture below.

2. Select File Type to be Source to create new C Language File and then click OK as shown in the picture below.

3. It will display window Editor to write program as shown in the picture below.

ETT CO.,LTD

-26-

example

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0 //**********************************************/; //*Hardware : ET-AVR STAMP (ATmega64 ) */; //*CPU : ATMEL-ATmega64 */; //* X-TAL : 16.00 MHz */; //* Filename : Main.C */; //*Complier : CodeVisionAVR V1.24.7d */; //* Last Update : 9-12-2005 (ETT CO.,LTD) */; //* : WWW.ETT.CO.TH */; //*Description : Example LED Blink on Portb.0 */; //**********************************************/; //*CodeVisionAVR Complier Option Setting */; //* Chip type : ATmega64 */; //* Program type : Application */; //*Clock frequency : 16.000000MHz */; //* Memory model : Small */; //*External SRAM size : 0 */; //* Data Stack size : 1024 */; //**********************************************/; #include <mega64.h> #include <delay.h>

// ATmega64 MCU // Delay functions

void main(void) { PORTB=0x00; DDRB=0x01;

// PB7..0 = 0 // PB0 = Output

//Loop Blink LED on PB0 while (1) { PORTB |= 0x01; PORTB &= 0XFE; } }

// PB0 = 1 (OFF LED) // PB0 = 0 (ON LED)

4. Save the written C Language Program, select Menu File Save and identify its name and then click Save as shown in the picture below.

ETT CO.,LTD

-27-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

5. Select Menu File New and select File Type to be Project to create new project and then click OK as shown in the picture below.

6. Click No to refuse project (CodeWizard).

to

use

Help

for

creating

7. Identify Project name as required and then click Button Save as shown in the picture below.

ETT CO.,LTD

-28-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

8. Click Button Add as shown in the picture below, to add C Language File that is written previously into Project.

ETT CO.,LTD

-29-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

9. When everything is complete, click OK as shown in the picture below.

ETT CO.,LTD

-30-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0 10. Set values of project, click Menu Project Configure then specify MCU number to be ATmega64, Crystal Frequency is 16.000000 MHz and File Output Format(s) to be COF ROM HEX EEP.

ETT CO.,LTD

-31-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0 11. Compile the written program, click Menu Project Make, it will display message No errors, No warnings as shown in the picture below if it is successfully compiled without any error.

12. Click Menu Tools Debugger to enter to Debug Mode, then program CodeVisionAVR will open Program AVR Studio as shown in the picture below, click Button Open.

ETT CO.,LTD

-32-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

13. Select File COFF symbolic debug file from compiling program that is in the created project as shown in the picture below.

ETT CO.,LTD

-33-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

14.

Click Button Save to save the project file.

15. Select Debug platform to be JTAG ICE and select Device to be ATmega64 and then click Button Finish as shown in the picture below.

ETT CO.,LTD

-34-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

16. When everything is complete, Program AVR Studio will download the written C Language Program. Next, we can debug values of C Language as same as debug values by Assembly Language.

ETT CO.,LTD

-35-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0 Proceeding to Upgrade Firmware of ET-AVR JTAG USB V1.0 To upgrade Firmware makes ET-AVR JTAG USB V1.0 can be used with new MCU numbers and this Firmware is attached with Program AVR Studio. When it connects ETAVR JTAG USB V1.0 with Program AVR Studio and there’s new Firmware, it will display warning message to upgrade new Firmware as shown in the picture below. In this case, click Cancel.

The method to upgrade Firmware is described below; 1. First of all, we must check position of ET-AVR JTAG USB V1.0 that must be in position of COM1COM4 only because Program AVR Prog can support only COM1-COM4.

ETT CO.,LTD

-36-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0 2. From the picture, we suppose that ET-AVR JTAG USB V1.0 is in position of COM8, so it is necessary to modify value to be in the range of COM1-COM4. In this example, we change value from COM8 to be COM3, double click ET-AVR JTAG USB V1.0 and it will display window Properties as shown in the picture below, so click Button Advanced…

3. Change COM Receive(Bytes) picture below modification. Hardware.

ETT CO.,LTD

Port Number to be COM3, and Transmit(Bytes) as shown in and then click OK to confirm Then restart computer or scan

-37-

set the the new

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

4. Shift Switch of ET-AVR JTAG USB V1.0 to position UPGRADE. 5. Call Program AVR Prog, select Menu Tools AVR Prog… then click Button Browse to select File Upgrade.ebn. Normally, it is in directory C:\Program Files\Atmel\AVR Tools\JTAGICE (normally, it is selected by program automatically) and then click Button Program to start upgrading as shown in the picture below.

ETT CO.,LTD

-38-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0 6. It will display window as shown in the picture below when it successfully upgraded.

7. First of all, click Button Exit… to close Program AVR Prog when it successfully programmed. Next, take off USB cable and JTAG cable from ET-AVR JTAG USB V1.0 to reset ET-AVR JTAG USB V1.0 and then shift Switch of ET-AVR JTAG USB V1.0 to NORMAL position. Now, new Firmware is successfully upgraded and it is ready to apply.

NOTE: If upgrading is error because JTAG cable of Target Board is interfacing with other circuit, so we must take off JTAG Cable from Target Board and then interface 5VDC Power Supply to ET-AVR JTAG USB V1.0 directly as shown in the picture below and start upgrading as same as the previous proceeding.

ETT CO.,LTD

-39-

WWW.ETT.CO.TH

คูมือการใชงาน ET-AVR JTAG USB V1.0

ETT CO.,LTD

-40-

WWW.ETT.CO.TH