Forum: Mikrocontroller und Digitale Elektronik Probleme mit JTAG einstieg


von Torsten W. (torsten_w)


Lesenswert?

Hi,

ich hab in letzter Zeit viel mit dem atmega32 herumgespielt und wollte 
mich wegen der zunehmenden Komplexität der Programme und reinem 
Interesse mit dem On-Chip Debugging mittels JTAG beschäftigen.
Leider stoße ich dabei auf einige Probleme, bei denen ich hoffe hier 
vielleicht eine Antwort zu bekommen.

Vorweg, ich verwende Linux (Kubuntu 10.10), als Schnitstelle den USB Avr 
Lab mit der mitgelieferten JTAGICEmkII_1.3 Firmware, avr-gdb, avarice 
zur Kommunikation von gdb und jtag und den bereits angesprochenem 
atmega32 (mit 16Mhz Quartz, On-Chip Debug und jtag per fuses enabled).

Ich habe die Anschlüsse des USB Avr Lab TDI, TDO, TCK und TMS mit den 
jeweiligen Anschlüssen am mega, TDI dabei an TDO und umgedreht.
Mittels avrdude lässt sich der mega ohne Probleme programmieren, 
weswegen ich mal davon ausgehe, dass der Programmer richtig 
angeschlossen ist.

Softwaremäßig habe ich jetzt damit angefangen avarice mit folgendem 
Befehl zu starten:
1
avarice --program --file output.elf -P atmega32 --jtag usb :4242 -2 -d
Und bekomme dabei folgenden Output:
1
toti@toti-vostro:~/workspace-avr/FirstSteps$ sudo avarice --program --file output.elf -P atmega32 --jtag usb :4242 -2 -d
2
AVaRICE version 2.10, Feb  8 2010 07:22:18
3
4
Defaulting JTAG bitrate to 250 kHz.
5
6
Found JTAG ICE, serno: ULLIHOME.DEE
7
JTAG config starting.
8
Attempting synchronisation at bitrate 19200
9
10
command[0x01, 1]: 01 
11
recv: 0x1b
12
recv: 0x00
13
recv: 0x00
14
recv: 0x1d
15
recv: 0x00
16
recv: 0x00
17
recv: 0x00
18
recv: 0x0e
19
sDATA: reading 29 bytes
20
read:  86 11 ff 2c 05 00 ff 2c 05 00 00 a2 00 00 01 1e 4a 54 41 47 49 43 45 20 6d 6b 49 49 00
21
recv: 0x00
22
recv: 0x30
23
CRC OK
24
Got message seqno 0 (command_sequence == 0)
25
response: 86 11 FF 2C 05 00 FF 2C 05 00 00 A2 00 00 01 1E 4A 54 41 47 49 43 45 20 6D 6B 49 49 00 
26
Found a device: JTAGICE mkII
27
Serial number:  00:a2:00:00:01:1e
28
JTAG ICE mkII sign-on message:
29
Communications protocol version: 17
30
M_MCU:
31
  boot-loader FW version:        255
32
  firmware version:              5.44
33
  hardware version:              0
34
S_MCU:
35
  boot-loader FW version:        255
36
  firmware version:              5.44
37
  hardware version:              0
38
39
command[0x02, 1]: 02 03 01 
40
recv: 0x1b
41
recv: 0x01
42
recv: 0x00
43
recv: 0x01
44
recv: 0x00
45
recv: 0x00
46
recv: 0x00
47
recv: 0x0e
48
sDATA: reading 1 bytes
49
read:  80
50
recv: 0xcd
51
recv: 0x83
52
CRC OK
53
Got message seqno 1 (command_sequence == 1)
54
response: 80 
55
56
command[0x0a, 1]: 0A 01 
57
recv: 0x1b
58
recv: 0x02
59
recv: 0x00
60
recv: 0x01
61
recv: 0x00
62
recv: 0x00
63
recv: 0x00
64
recv: 0x0e
65
sDATA: reading 1 bytes
66
read:  a0
67
recv: 0x1f
68
recv: 0x28
69
CRC OK
70
Got message seqno 2 (command_sequence == 2)
71
response: A0 
72
Automatic device detection: 
73
command[0x03, 1]: 03 0E 
74
recv: 0x1b
75
recv: 0x03
76
recv: 0x00
77
recv: 0x05
78
recv: 0x00
79
recv: 0x00
80
recv: 0x00
81
recv: 0x0e
82
sDATA: reading 5 bytes
83
read:  81 3f 20 50 09
84
recv: 0xbb
85
recv: 0x59
86
CRC OK
87
Got message seqno 3 (command_sequence == 3)
88
response: 81 3F 20 50 09 
89
JTAG id = 0x950203F : Ver = 0x0 : Device = 0x9502 : Manuf = 0x1f
90
Reported JTAG device ID: 0x9502
91
Looking for device: atmega32
92
Configured for device ID: 0x9502 atmega32 -- Matched with atmega32
93
94
command[0x0c, 1]: 0C FF 6F FF FF FE FF FD FF 00 00 00 00 01 00 00 00 8F 26 B6 FD FE FF BD FA 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 31 57 00 80 00 04 00 3F 00 00 00 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3E 3D 00 01 00 00 01 00 00 01 00 60 00 00 00 00 00 1C 00 
95
recv: 0x1b
96
recv: 0x04
97
recv: 0x00
98
recv: 0x01
99
recv: 0x00
100
recv: 0x00
101
recv: 0x00
102
recv: 0x0e
103
sDATA: reading 1 bytes
104
read:  80
105
recv: 0xac
106
recv: 0x14
107
CRC OK
108
Got message seqno 4 (command_sequence == 4)
109
response: 80 
110
JTAG config complete.
111
Preparing the target device for On Chip Debugging.
112
113
command[0x02, 1]: 02 07 15 
114
recv: 0x1b
115
recv: 0x05
116
recv: 0x00
117
recv: 0x01
118
recv: 0x00
119
recv: 0x00
120
recv: 0x00
121
recv: 0x0e
122
sDATA: reading 1 bytes
123
read:  80
124
recv: 0x13
125
recv: 0x95
126
CRC OK
127
Got message seqno 5 (command_sequence == 5)
128
response: 80 
129
130
command[0x14, 1]: 14 
131
recv: 0x1b
132
recv: 0x06
133
recv: 0x00
134
recv: 0x01
135
recv: 0x00
136
recv: 0x00
137
recv: 0x00
138
recv: 0x0e
139
sDATA: reading 1 bytes
140
read:  80
141
recv: 0xc3
142
recv: 0x1f
143
CRC OK
144
Got message seqno 6 (command_sequence == 6)
145
response: 80 
146
jtagRead 
147
command[0x05, 1]: 05 B3 01 00 00 00 00 00 00 00 
148
recv: 0x1b
149
recv: 0x07
150
recv: 0x00
151
recv: 0x02
152
recv: 0x00
153
recv: 0x00
154
recv: 0x00
155
recv: 0x0e
156
sDATA: reading 2 bytes
157
read:  82 ff
158
recv: 0xd3
159
recv: 0x2d
160
CRC OK
161
Got message seqno 7 (command_sequence == 7)
162
response: 82 FF 
163
164
Disabling lock bits:
165
  LockBits -> 0xff
166
167
Enabling on-chip debugging:
168
jtagRead 
169
command[0x05, 1]: 05 B2 03 00 00 00 00 00 00 00 
170
recv: 0x1b
171
recv: 0x08
172
recv: 0x00
173
recv: 0x04
174
recv: 0x00
175
recv: 0x00
176
recv: 0x00
177
recv: 0x0e
178
sDATA: reading 4 bytes
179
read:  82 ff 19 ff
180
recv: 0x16
181
recv: 0x7a
182
CRC OK
183
Got message seqno 8 (command_sequence == 8)
184
response: 82 FF 19 FF 
185
  Extended Fuse byte -> 0xff
186
      High Fuse byte -> 0x19
187
       Low Fuse byte -> 0xff
188
189
command[0x15, 1]: 15 
190
recv: 0x1b
191
recv: 0x09
192
recv: 0x00
193
recv: 0x01
194
recv: 0x00
195
recv: 0x00
196
recv: 0x00
197
recv: 0x0e
198
sDATA: reading 1 bytes
199
read:  80
200
recv: 0x71
201
recv: 0xae
202
CRC OK
203
Got message seqno 9 (command_sequence == 9)
204
response: 80 
205
206
command[0x0b, 1]: 0B 01 
207
recv: 0x1b
208
recv: 0x0a
209
recv: 0x00
210
recv: 0x01
211
recv: 0x00
212
recv: 0x00
213
recv: 0x00
214
recv: 0x0e
215
sDATA: reading 1 bytes
216
read:  80
217
recv: 0xa1
218
recv: 0x24
219
CRC OK
220
Got message seqno 10 (command_sequence == 10)
221
response: 80 
222
Waiting for input

Ich denke das ist schonmal nicht so wie es sein sollte, in jedem fall 
bekomme ich beim Versuch mit avr-gdb zu verbinden folgenden Fehler:
1
toti@toti-vostro:~$ avr-gdb
2
GNU gdb 6.4
3
Copyright 2005 Free Software Foundation, Inc.
4
GDB is free software, covered by the GNU General Public License, and you are
5
welcome to change it and/or distribute copies of it under certain conditions.
6
Type "show copying" to see the conditions.
7
There is absolutely no warranty for GDB.  Type "show warranty" for details.
8
This GDB was configured as "--host=i486-linux-gnu --target=avr".
9
(gdb) file workspace-avr/FirstSteps/output.elf 
10
Reading symbols from /home/toti/workspace-avr/FirstSteps/output.elf...done.
11
(gdb) target remote localhost:4242
12
localhost:4242: Connection refused.
13
(gdb)

Ich bin mir nicht sicher ob da vielleicht nur ein einfacher 
Anfängerfehler vorliegt, deswegen hoffe ich, dass mir einer von euch 
helfen kann, da ich leider keine konkreten Lösungen zu dem Problem im 
Internet finde.
Ich poste natürlich gerne alle nötigen Infos.

Gruß,
toti

von Georg W. (gewe)


Lesenswert?

Hallo Thorsten,

soweit ich weiß, kann das USB AVR-LAB nur über JTAG programmieren und 
nicht debuggen.

Bis bald
Georg

von Torsten W. (torsten_w)


Lesenswert?

Hi,

danke für die schneller Antwort. Da hab ich wohl die einfachste 
Möglichkeit außen vor gelassen, dass es gar nicht unterstützt ist.

Ich werde mich mal nach einer Alternative umschauen, aber kann mir 
jemand hier vielleicht schon einen JTAGICEmkII-kompatibelen Low Cost 
Clon empfehlen, der das kann und über USB betrieben werden kann? Gerne 
auch zum selber bauen?

Gruß,
toti

von Oliver J. (skriptkiddy)


Lesenswert?

Schau dir mal den AVR Dragon an.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.