ATMEL AVR067 User Manual

http://www.BDTIC.com/ATMEL
AVR067: JTAGICE mkII
Communication Protocol

Features

Commands sent from AVR Studio to JTAGICE mkII
Replies sent from JTAGICE mkII to AVR Studio
Different Memory Types
Special Characters and Packet Formats for Packet Synchronization and
Error Control
Break Point Handling in JTAGICE mkII (tinyAVR / megaAVR devices only)

1 Introduction

This document describes the communication protocol used between AVR Studio and JTAGICE mkII. The purpose of this document is to enable third party vendors to design their own front-end to the JTAGICE mkII.
8-bit Microcontrollers
Application Note
Rev. 2587D-AVR-11/09
http://www.BDTIC.com/ATMEL

2 Theory of operation

The communication protocol operates in a master – slave environment, AVR Studio being the master and JTAGICE mkII being the slave.
The JTAGICE mkII slave is always operating in one of three states (with enumeration):
1. STOPPED
2. RUNNING
3. PROGRAMMING Some commands can only be executed while the slave is in STOPPED mode, others
may be allowed in all modes. The details are described for each different command. Events are messages sent from the slave with no prior commands given from the
master. Serial communication is asynchronous by nature, so is the JTAGICE mkII protocol. All
commands and responses have tokens and CRC checks included enabling the receiver to verify the validity of the received message.
This transport protocol guarantees that every packet that is received is verified correctly, but it does not guarantee that every packet is received. Retransmission and lost packets are to be handled by the application layer, not the transmission layer. When USB is used, the hardware layer handles retransmission automatically. This is not the case with RS232.
The protocol is “Little Endean”, LSB is always transferred first in memory addresses.

2.1 USB and RS-232 Connection

The JTAGICE mkII has both a USB and an RS-232 interface for connecting to a host computer. They share the same message format (see section 3).
USB is preferred due to speed.
2.1.1 RS-232 Connection
The RS-232 connection’s power-on settings are 19,200 bps, 8N1, no handshake. However, using the Set Parameter command and the Baud rate parameter, the baud rate can be changed.
2.1.2 USB Connection
The JTAGICE mkII has a USB port capable of USB full-speed connection (12Mbps). In addition to data transfer, the USB cable can also supply power to the emulator, so
no external power is required. After enumeration, the emulator can draw up to 500mA from the USB hub.
2.1.3 USB Configuration
The JTAGICE mkII has one configuration with one interface containing two bulk transfer endpoints. The USB descriptors can be found in section 7.
The JTAGICE mkII messages are transferred through the bulk endpoints. Maximum packet size is shown in the endpoint descriptors.
2
AVR067
2587D-AVR-11/09

3 Message Format

http://www.BDTIC.com/ATMEL
In addition to the framing mechanisms supplied by the JTAGICE mkII frame format, the emulator uses short packets (both IN and OUT endpoints) to indicate which USB packet is the last one in a JTAGEICE mkII frame. The host driver must also support short packets.
All commands, responses and events share a common message format: <MESSAGE_START, SEQUENCE_NUMBER, MESSAGE_SIZE, TOKEN,
MESSAGE_BODY, CRC>
Table 3-1. Parameters of messages.
Parameter Name Usage Format
MESSAGE_START ASCII 27 (ESC character) [BYTE] SEQUENCE_NUMBER
MESSAGE_SIZE Size of the message body in bytes [BYTE]*4, LSB first TOKEN
MESSAGE_BODY Message body [BYTE]*MESSAGE_SIZE CRC
First byte of the message body is always the MESSAGE_ID. The size of the MESSAGE_BODY is at least 1 byte.
Incremented by one for each message sent. Wraps to zero after 0xFFFE. 0xFFFF is reserved for (asynchronous) EVENTS.
ASCII 14, making the protocol more robust.
Uses all characters in message including MESSAGE_START and MESSAGE_BODY.
[BYTE]*2, LSB first.
[BYTE]
[BYTE]*2
AVR067

4 Message parsing

4.1 Introduction

2587D-AVR-11/09
Messages use MESSAGE_ID in the range from 0x01 to 0x3F
Success responses use MESSAGE_ID in the range from 0x80 to 0x9F
Failure responses use MESSAGE_ID in the range from 0xA0 to 0xBF
Events use MESSAGE_ID in the range from 0xE0 to 0xFF
Message start is ASCII 27 (0x1B), not to be changed.
Token is ASCII 14 (0x0E), not to be changed.
Messages either way should be read as a byte stream by a state machine. Every time a MESSAGE_START character occurs, the state machine starts to decode the message, either completing the message or falling out of the byte stream if a message rule is violated.
Messages can come in any order and there is no specific timing regarding required timeframes between commands. The emulator implements a message queue, when the state machine has parsed and verified a complete message it is serialized and put on a message queue. The emulator executes the messages in the sequence found
3
http://www.BDTIC.com/ATMEL
on the queue. Responses to the messages are given when they are processed by the emulator.
The same state machine is used for both RS232 and USB transmission. An interrupt routine on the communication control processor in the JTAGICE mkII reads the appropriate UART and puts the incoming data in a FIFO implemented in SRAM. The state machine reads and parses the data from the FIFO.

4.2 Common State Machine Implementation

Figure 4-1. State Diagram
Char < > A S CII 27
E: CRC byte 0
C: nmb char ==
MESSAGE_SIZE
E: New char
C: nmb char <
MESSAGE_SIZE
CRC
E: New char
Get D a ta
E: CR C b yte 1
C: CRC illegal A: Clear buffers update statistics
E: CR C b yte 1
C: CRC legal
A: Store complete
message in queue.
E: Legal Token C: Message Size > 0 A: Start timeout timer
Start
E: Illegal Token
A: Clear message
buffer, update illegal
message statistics
Get Token
E: Cha r = = A SCII27
A: Start timeout timer
A: Send Timeout
response to master
E: Timeout
A: Send Timeout
Response to Master
E: Message Size
Complete
A: Start Timeout Timer
E: Timeout
Get
Message
Size
Read bytes 0-2
Get
Sequence
Number
Read bytes 0-1
E: Message ID read
A: Start Timeout Timer
4
AVR067
2587D-AVR-11/09
http://www.BDTIC.com/ATMEL
AVR067
Table 4-1. State table. Gray fields represent “message failed”, non grayed fields are “message valid”.
Current State Event Condition Action Next State
Start
Get Sequence Number
Get Message Size
Get Token
Get Data
Get CRC
Read character from inbuf Char == ASCII 27 Start timeout timer
Read character from inbuf Char <> ASCII 27 None Start Read character from inbuf
Read character from inbuf
Timeout None Update message statistics Start Read character from inbuf
Read character from inbuf
Timeout None Update message statistics Start Read character from inbuf Char == ASCII 14 Start timeout timer
Read character from inbuf Char <> ASCII 14 Update message statistics
Timeout None Update message statistics Start Read character from inbuf
Read character from inbuf
Timeout None Update message statistics Start Read character from inbuf CRC Byte Count == 2
Read character from inbuf CRC Byte Count == 2
Read character from inbuf CRC Byte Count < 2 Start timeout timer Get CRC Timeout None Update message statistics Start
Sequence Number Byte Counter == 2
Sequence Number Byte Counter < 2
Message Size Byte Counter < 4
Message Size Byte Counter ==4
Nmb char read == MESSAGE_SIZE
Nmb char read < MESSAGE_SIZE
CRC OK
CRC NOT OK
Start timeout timer
Start timeout timer
Start timeout timer Get Message Size
Start timeout timer Calculate MESSAGE_SIZE
Stop timeout timer
Start timeout timer Get CRC
Start timeout timer Get Data
Calculate CRC Update message statistics Execute command Stop timeout timer
Calculate CRC Update message statistics Stop timeout timer
Get Sequence Number
Get Message Size
Get Sequence Number
Get Token
Get Data
Start
Start
Start

5 Commands and responses

5.1 Master Commands

5.1.1 Sign off (CMND_SIGN_OFF: 0x00)
The master issues this command when it terminates a debugging session. Slave state: All states.
2587D-AVR-11/09
5
http://www.BDTIC.com/ATMEL
Table 5-1. Message Format
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character) SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE 0x01 TOKEN ASCII 14 MESSAGE_BODY None CRC 2-byte CRC.
The MESSAGE_BODY consists of: <MESSAGE_ID>
Table 5-2. Parameters
Parameter Name Usage Format
MESSAGE_ID 0x00 (CMND_SIGN_OFF) [BYTE]
Table 5-3. Response
Parameter Name Description
RSP_OK The command was executed. RSP_FAILED
The JTAGICE mkII is there, but it did not understand the command.
6
AVR067
2587D-AVR-11/09
http://www.BDTIC.com/ATMEL
5.1.2 Check if Emulator is present (CMND_GET_SIGN_ON: 0x01)
The master uses this command to see if an emulator is attached and alive. Slave state: All states.
Table 5-4. Message Format.
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character) SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE 0x01 TOKEN ASCII 14 MESSAGE_BODY None CRC 2-byte CRC.
The MESSAGE_BODY consists of: <MESSAGE_ID>
AVR067
Table 5-5. Parameters.
Parameter Name Usage Format
MESSAGE_ID 0x01 (CMND_GET_SIGN_ON) [BYTE]
Table 5-6. Response.
Parameter Name Description
RSP_SIGN_ON
RSP_FAILED
TIMEOUT
Garbage
Contains sign on string for JTAGICE mkII. Compatibility issues with other emulators must be resolved.
Sign on (RSP_SIGN_ON : 0x86) The JTAGICE mkII is there, but it did not understand
the command. No slave response within the defined timeout time.
The slave is either not there, or it is not turned on. If serial communication is used, HW error UART
configuration error (wrong baud rate, parity bit setting etc)
If USB communication is used, HW error.
2587D-AVR-11/09
7
http://www.BDTIC.com/ATMEL
5.1.3 Write Emulator Parameter (CMND_SET_PARAMETER: 0x02)
The emulator hosts a number of set-up parameters. This command is used to write all parameters. The parameter ID identifies the parameter written.
Slave state: Depending on the parameter.
Table 5-7. Message Format.
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character) SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE The size of the MESSAGE_BODY in bytes. TOKEN ASCII 14 MESSAGE_BODY See below CRC 2-byte CRC.
The message body consists of: <MESSAGE_ID, PARAMETER_ID, PARAMETER_VALUE>
Table 5-8. Parameters.
Parameter Name Usage Format
MESSAGE_ID 0x02 (CMND_SET_PARAMETER) [BYTE] PARAMETER_ID Parameter ID [BYTE] PARAMETER_VALUE Parameter value, can be of any size
[BYTE] * N, LSB first if applicable.
Table 5-9. Response.
Parameter Name Description
RSP_OK The parameter is written OK. RSP_FAILED
RSP_ILLEGAL_PARAMETER
RSP_ILLEGAL_VALUE The given value was invalid or out or range RSP_ILLEGAL_EMULATOR_MODE
Timeout No response from the slave within the timeout time.
The command was not understood by the JTAGICE mkII
The JTAGICE mkII does not support the selected parameter (AVR Studio 4 – JTAGICE mkII FW incompatibility).
The operation cannot be performed in this emulator mode. (JTAG / debugWire).
The parameter description is found in a later section in this document.
8
AVR067
2587D-AVR-11/09
5.1.4 Read Emulator Parameter (CMND_GET_PARAMETER: 0x03)
http://www.BDTIC.com/ATMEL
Reads emulator set-up parameters back to AVR Studio. Parameter descriptions found in a later section in this document.
Slave state: Depending on the parameter.
Table 5-10. Message Format.
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character) SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE 0x02 TOKEN ASCII 14 MESSAGE_BODY Defined below CRC 2-byte CRC.
The MESSAGE_BODY consists of: <MESSAGE_ID, PARAMETER_ID>
Table 5-11. Parameters.
Parameter Name Usage Format
MESSAGE_ID 0x03 (CMND_GET_PARAMETER) [BYTE] PARAMETER_ID The requested emulator parameter [BYTE]
AVR067
Table 5-12. Response.
Parameter Name Description
RSP_PARAMETER Returns the requested parameter.
RSP_FAILED
RSP_ILLEGAL_PARAMETER
RSP_ILLEGAL_EMULATOR_MODE
Timeout No response from the slave within the timeout time.
5.1.5 Write Memory (CMND_WRITE_MEMORY: 0x04)
Write a memory block to any address in any memory area. Slave state: STOPPED.
Table 5-13. Message Format.
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character) SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE The size of the MESSAGE_BODY in bytes.
Parameter return (RSP_PARAMETER : 0x81) The command was not understood by the JTAGICE
mkII The JTAGICE mkII does not support the selected
parameter (AVR Studio 4 – JTAGICE mkII FW incompatibility).
The operation cannot be performed in this emulator mode. (JTAG / debugWire).
2587D-AVR-11/09
9
http://www.BDTIC.com/ATMEL
Parameter Name Description
TOKEN ASCII 14 MESSAGE_BODY See below CRC 2-byte CRC.
The MESSAGE_BODY consists of: <MESSAGE_ID, MEMORY_TYPE, BYTE_COUNT, START_ADDRESS, DATA>
Table 5-14. Parameters.
Parameter Name Usage Format
MESSAGE_ID 0x04 (CMND_WRITE_MEMORY) [BYTE] MEMORY_TYPE
BYTE_COUNT Number of bytes to be written
START_ADDRESS Start memory address
DATA The data
Memory type (Flash, SRAM, EEPROM...)
[BYTE]
[BYTE]*4 LSB first
[BYTE]*4 LSB first
[BYTE] * BYTE_COUNT
Definitions and parameter values of the different memory types are found in the Memory Types section.
Table 5-15. Response.
Parameter Name Description
RSP_OK The memory is written OK. RSP_FAILED
RSP_ILLEGAL_MEMORY_TYPE
RSP_ILLEGAL_MEMORY_RANGE
RSP_ILLEGAL_EMULATOR_MODE
RSP_ILLEGAL_MCU_STATE
Timeout No response from the slave within the timeout time.
The command was not understood by the JTAGICE mkII
The JTAGICE mkII does not support the selected memory.
The memory write was outside the bounds of the selected memory area.
The operation cannot be performed in this emulator mode. (JTAG / debugWire).
The operation cannot be performed with the target MCU in its current state.
10
AVR067
2587D-AVR-11/09
http://www.BDTIC.com/ATMEL
5.1.6 Read Memory (CMND_READ_MEMORY: 0x05)
Read a memory block from any address in any memory area. Slave state: STOPPED
Table 5-16. Message Format.
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character) SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE 10 bytes. TOKEN ASCII 14 MESSAGE_BODY See below CRC 2-byte CRC.
The MESSAGE_BODY consists of: <MEMORY_TYPE, BYTE_COUNT, START_ADDRESS>
AVR067
Table 5-17. Parameters.
Parameter Name Usage Format
MESSAGE_ID 0x05 (CMND_READ_MEMORY) [BYTE] MEMORY_TYPE
BYTE_COUNT Number of bytes to be read
START_ADDRESS Start memory address
Memory type (Flash, SRAM, EEPROM...)
[BYTE]
[BYTE]*4 LSB first
[BYTE]*4 LSB first
Definitions and parameter values of the different memory types are found in the Memory Types section.
Table 5-18. Response.
Parameter Name Description
RSP_MEMORY The memory is read OK.
Memory read (RSP_MEMORY : 0x82)
RSP_FAILED
RSP_ILLEGAL_MEMORY_TYPE
RSP_ILLEGAL_MEMORY_RANGE
RSP_ILLEGAL_EMULATOR_MODE
The command was not understood by the JTAGICE mkII
The JTAGICE mkII does not support the selected memory.
The memory write was outside the bounds of the selected memory area.
The operation cannot be performed in this emulator mode. (JTAG / debugWire).
2587D-AVR-11/09
11
http://www.BDTIC.com/ATMEL
Parameter Name Description
RSP_ILLEGAL_MCU_STATE
Timeout No response from the slave within the timeout time.
5.1.7 Write Program Counter (CMND_WRITE_PC: 0x06)
Writes the AVR Program Counter. Slave state: STOPPED.
Table 5-19. Message Format.
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character) SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE 5 TOKEN ASCII 14 MESSAGE_BODY See below. CRC 2-byte CRC.
The operation cannot be performed with the target MCU in its current state.
The MESSAGE_BODY consists of: <MESSAGE_ID, PROGRAM_COUNTER>
Table 5-20. Parameters.
Parameter Name Usage Format
MESSAGE_ID 0x06 (CMND_WRITE_PC) [BYTE] PROGRAM_COUNTER Program Counter
[BYTE]*4 LSB first.
Table 5-21. Response.
Parameter Name Description
RSP_OK The program counter was written OK. RSP_FAILED
RSP_ILLEGAL_EMULATOR_MODE
RSP_ILLEGAL_MCU_STATE
Timeout No response from the slave within the timeout time.
The command was not understood by the JTAGICE mkII
The operation cannot be performed in this emulator mode. (JTAG / debugWire).
The operation cannot be performed with the target MCU in its current state.
5.1.8 Read Program Counter (CMND_READ_PC: 0x07)
Reads the AVR Program Counter.
12
AVR067
2587D-AVR-11/09
http://www.BDTIC.com/ATMEL
AVR067
Slave state: STOPPED.
Table 5-22. Message Format.
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character) SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE 1 TOKEN ASCII 14 MESSAGE_BODY See below. CRC 2-byte CRC.
The MESSAGE_BODY consists of: <MESSAGE_ID>
Table 5-23. Parameters.
Parameter Name Usage Format
MESSAGE_ID 0x07 (CMND_READ_PC) [BYTE]
Table 5-24. Response.
Parameter Name Description
RSP_PC The program counter is returned.
Program Counter Read (RSP_PC : 0x84)
RSP_FAILED
RSP_ILLEGAL_EMULATOR_MODE
RSP_ILLEGAL_MCU_STATE
Timeout No response from the slave within the timeout time.
The command was not understood by the JTAGICE mkII
The operation cannot be performed in this emulator mode. (JTAG / debugWire).
The operation cannot be performed with the target MCU in its current state.
2587D-AVR-11/09
13
http://www.BDTIC.com/ATMEL
5.1.9 Start Program Execution (CMND_GO: 0x08)
Starts program execution at current Program Counter address. Slave state: STOPPED or RUNNING. When the command is executed the state
either changes to or remains in RUNNING.
Table 5-25. Message Format.
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character) SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE 1 TOKEN ASCII 14 MESSAGE_BODY None CRC 2-byte CRC.
The MESSAGE_BODY consists of: < MESSAGE_ID >
Table 5-26. Parameters.
Parameter Name Usage Format
MESSAGE_ID CMND_GO : 0x08 [BYTE]
Table 5-27. Response.
Parameter Name Description
RSP_OK The command was executed. RSP_FAILED
RSP_ILLEGAL_EMULATOR_MODE
Timeout No response from the slave within the timeout time.
5.1.10 Single Step (CMND_SINGLE_STEP: 0x09)
Starts one-step execution at current Program Counter address. Slave state: STOPPED. After execution the slave is in RUNNING state until it hits the
next breakpoint. Then a Break Event is issued, and the slave returns to STOPPED state.
The command was not understood by the JTAGICE mkII
The operation cannot be performed in this emulator mode. (JTAG / debugWire).
Table 5-28. Message Format.
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character)
14
AVR067
2587D-AVR-11/09
http://www.BDTIC.com/ATMEL
Parameter Name Description
SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE 3 TOKEN ASCII 14 MESSAGE_BODY High level or low level flag, see below. CRC 2-byte CRC.
AVR067
The MESSAGE_BODY consists of: <MESSAGE_ID, FLAG>
Table 5-29. Parameters.
Parameter Name Usage Format
MESSAGE_ID 0x09 (CMND_SINGLE_STEP) [BYTE] FLAG 0x01 : Low level
0x02 : High level.
STEP_MODE 0x00: STEP_OVER
0x01: STEP_INTO 0x02: STEP_OUT
[BYTE]
[BYTE]
Table 5-30. Response.
Parameter Name Description
RSP_OK The command is executed. RSP_FAILED
RSP_ILLEGAL_EMULATOR_MODE
RSP_ILLEGAL_MCU_STATE
Timeout No response from the slave within the timeout time.
5.1.11 Stop Program Execution (CMND_FORCED_STOP: 0x0A)
Stops program execution. Slave state: STOPPED or RUNNING. After execution of the command the slave is in
STOPPED state.
Table 5-31. Message Format.
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character) SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE 2 Bytes TOKEN ASCII 14 MESSAGE_BODY See below CRC 2-byte CRC.
The command was not understood by the JTAGICE mkII
The operation cannot be performed in this emulator mode. (JTAG / debugWire).
The operation cannot be performed with the target MCU in its current state.
2587D-AVR-11/09
15
http://www.BDTIC.com/ATMEL
The MESSAGE_BODY consists of: <MESSAGE_ID, MODE>
Table 5-32. Parameters.
Parameter Name Usage Format
MESSAGE_ID 0x0A (CMND_FORCED_STOP) [BYTE] MODE 0x01: LOW LEVEL
0x02: HIGH LEVEL (stops at next high level statement)
Table 5-33. Response.
Parameter Name Description
RSP_OK The command is executed. RSP_FAILED
RSP_ILLEGAL_EMULATOR_MODE
Timeout No response from the slave within the timeout time.
The command was not understood by the JTAGICE mkII
The operation cannot be performed in this emulator mode. (JTAG / debugWire).
[BYTE]
5.1.12 Reset User Program (CMND_RESET: 0x0B)
Emulator performs all actions to restart program execution Slave state: Any. If the slave is in RUNNING mode prior to this operation, the slave
will change to STOPPED state prior to the execution of this command
Table 5-34. Message Format.
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character) SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE Size of message body TOKEN ASCII 14 MESSAGE_BODY See below
CRC 2-byte CRC.
High level or low level flag. High level typically returns to main. Give a procedure. Give low level reset with “run afterwards”.
16
AVR067
2587D-AVR-11/09
http://www.BDTIC.com/ATMEL
AVR067
The MESSAGE_BODY consists of: <MESSAGE_ID, FLAG>
Table 5-35. Parameters.
Parameter Name Usage Format
MESSAGE_ID 0x0B (CMND_RESET) [BYTE] FLAG 0x01: Low level
0x02: High level (reset, then run to main)
0x04: Reset with debugWire disable.
[BYTE]
Table 5-36. Response.
Parameter Name Description
RSP_OK The command is executed. RSP_FAILED
RSP_ILLEGAL_EMULATOR_MODE
Timeout No response from the slave within the timeout time.
The command was not understood by the JTAGICE mkII
The operation cannot be performed in this emulator mode. (JTAG / debugWire).
5.1.13 Set Device Descriptor (CMND_SET_DEVICE_DESCRIPTOR: 0x0C)
Transmits all parameters relevant for a specific device set-up Slave state: STOPPED.
Table 5-37. Message Format.
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character) SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE Size of message body TOKEN ASCII 14 MESSAGE_BODY All parameters for a specific device set-up. CRC 2-byte CRC.
The MESSAGE_BODY consists of: <MESSAGE_ID, PARAMETERS>
Table 5-38. Parameters.
Parameter Name Usage Format
MESSAGE_ID
0x0C (CMND_SET_DEVICE_DESCRIPTOR)
[BYTE]
2587D-AVR-11/09
17
http://www.BDTIC.com/ATMEL
Parameter Name Usage Format
PARAMETERS
Table 5-39. Response.
Parameter Name Description
RSP_OK The command is executed. RSP_FAILED
RSP_ILLEGAL_EMULATOR_MODE
RSP_ILLEGAL_MCU_STATE
Timeout No response from the slave within the timeout time.
5.1.14 Erase Page SPM (CMND_ERASEPAGE_SPM: 0x0D)
Erases a whole page in Flash memory
All parameters required to set up a device in raw binary form, identical to the JTAGICE descriptor.
The command was not understood by the JTAGICE mkII
The operation cannot be performed in this emulator mode. (JTAG / debugWire).
The operation cannot be performed with the target MCU in its current state.
[BYTE] * 298
Slave state: STOPPED
Table 5-40. Message Format.
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character) MESSAGE_ID 0x0D (CMND_ERASEPAGE_SPM) SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE 5 TOKEN ASCII 14 MESSAGE_BODY See below CRC 2-byte CRC.
The MESSAGE_BODY consists of: <MESSAGE_ID, PAGE_ADDRESS>
Table 5-41. Parameters.
Parameter Name Usage Format
MESSAGE_ID
PAGE_ADDRESS Address to the page to be erased
0x0D (CMND_ERASEPAGE_SPM)
[BYTE]
[BYTE]*4, LSB first
Table 5-42. Response.
Parameter Name Description
18
AVR067
2587D-AVR-11/09
Parameter Name Description
http://www.BDTIC.com/ATMEL
RSP_OK The command is executed. RSP_FAILED
RSP_ILLEGAL_EMULATOR_MODE
RSP_ILLEGAL_MCU_STATE
Timeout No response from the slave within the timeout time.
5.1.15 Get Sync (CMND_GET_SYNC 0x0F)
Sent from AVR Studio in order to regain synchronization with JTAGICE mkII, if lost
Table 5-43. Message Format.
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character) SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE 1 TOKEN ASCII 14 MESSAGE_BODY See below CRC 2-byte CRC.
The command was not understood by the JTAGICE mkII
The operation cannot be performed in this emulator mode. (JTAG / debugWire).
The operation cannot be performed with the target MCU in its current state.
AVR067
The MESSAGE_BODY consists of: <MESSAGE_ID>
Table 5-44. Parameters.
Parameter Name Usage Format
MESSAGE_ID 0x0F (CMND_GET_SYNC) [BYTE]
Table 5-45. Response.
Parameter Name Description
RSP_OK The command is executed. RSP_FAILED
Timeout No response from the slave within the timeout time.
5.1.16 Self test (CMND_SELFTEST: 0x10)
Makes the JTAGICE mkII perform self test and report back to the master. Slave state: STOPPED
Table 5-46. Message Format.
Parameter Name Description
The command was not understood by the JTAGICE mkII.
2587D-AVR-11/09
19
http://www.BDTIC.com/ATMEL
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character). SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE Size of message body. TOKEN ASCII 14 MESSAGE_BODY Parameters for self test (choose what to test). CRC 2-byte CRC.
The MESSAGE_BODY consists of: <MESSAGE_ID, FLAGS>
Table 5-47. Parameters.
Parameter Name Usage Format
MESSAGE_ID 0x10 (CMND_SELFTEST) [BYTE] FLAGS
FLAGS identifying which tests to be performed.
bit 7: internal tests (SRAM, FIFO…) bit 6: <not used> bit 5: <not used> bit 4: <not used> bit 3: STK500 RESET JUMPER
detector bit 2: JTAG PUSH PULL bit 1: debugWire Capacitance bit 0: debugWire PUSH PULL
[BYTE]
Table 5-48. Response.
Parameter Name Description
RSP_SELFTEST The command is executed.
RSP_FAILED
RSP_ILLEGAL_EMULATOR_MODE
RSP_ILLEGAL_MCU_STATE
Timeout No response from the slave within the timeout time.
5.1.17 Set Breakpoint (CMND_SET_BREAK: 0x11)
Set a breakpoint. (For hardware breakpoints on megaAVR devices with JTAG interface only, and software breakpoints)
Slave state: STOPPED
20
AVR067
Selftest (RSP_SELFTEST : 0x85) The command was not understood by the JTAGICE
mkII. The operation cannot be performed in this emulator
mode. (JTAG / debugWire). The operation cannot be performed with the target
MCU in its current state.
2587D-AVR-11/09
http://www.BDTIC.com/ATMEL
AVR067
Table 5-49. Message Format.
Parameter Name Description
MESSAGE_START ASCII 27 (ESC character) SEQUENCE_NUMBER Incremented for each packet sent. MESSAGE_SIZE Size of message body TOKEN ASCII 14 MESSAGE_BODY Breakpoint setting (see format below). CRC 2-byte CRC.
The MESSAGE_BODY consists of: <MESSAGE_ID, TYPE, NUMBER, ADDRESS, MODE>
Table 5-50. Parameters.
Parameter Name Usage Format
MESSAGE_ID 0x11 (CMND_SET_BREAK) [BYTE] TYPE 0x01: program memory breakpoint
0x02: data breakpoint 0x03:mask for data breakpoint
NUMBER
ADDRESS Break address of mask value
MODE 0x00: Break on memory read
Breakpoint number, 0x01 to 0x04 (up to 4 breakpoints are supported
0x00 for SW BP
0x01: Break on memory write 0x02: Break on memory read or
write. 0x03: Program breakpoint
[BYTE]
[BYTE]
[BYTE] * 4, LSB first
[BYTE]
2587D-AVR-11/09
21
Loading...
+ 48 hidden pages