AVR-JTAG-USB-A JTAG connection doesnt work with AT90CAN128

Started by embedded007, October 13, 2020, 03:29:51 PM

Previous topic - Next topic

embedded007

I recently purchased AVR-JTAG-USB-A. I am using avarice utility to connect AVR-JTAG-USB-A to AT90CAN128 and will eventually debug the program. I can erase/program flash using avarice also, reading of fuse bits works correctly. However, I couldn't connect it to GDB debugger.

I see following log when I try to connect using AVR-GDB ( GNU gdb 6.8 ) with command "target remote localhost:4242"


C:\WinAVR\bin>avarice -d  --jtag /dev/ttyS2 -1  -P AT90CAN128  :4242
AVaRICE version 2.9, Jan  7 2010 22:42:57

Defaulting JTAG bitrate to 250 kHz.

JTAG config starting.
Attempting synchronisation at bitrate 115200

command[S, 1]: 53 45 20 20

command[S, 1]: 53 20 20
response: 41 56 52 4E 4F 43 44 41

command[B, 1]: 42 62 FF 20 20
response: 41

command[q, 1]: 71 7A 20 20
response: CE 41
Hardware Version: 0xce

command[q, 1]: 71 7B 20 20
response: 80 41
Software Version: 0x80

command[F, 1]: 46 20 20
response: 00 FA AC 41
Automatic device detection:
command[q, 1]: 71 A7 20 20
response: 3F 41

command[F, 1]: 46 20 20
response: 00 FD 66 41

command[q, 1]: 71 A8 20 20
response: 10 41

command[q, 1]: 71 A9 20 20
response: 78 41

command[q, 1]: 71 AA 20 20
response: 09 41
JTAG id = 0x978103F : Ver = 0x0 : Device = 0x9781 : Manuf = 0x1f
Reported JTAG device ID: 0x9781
Looking for device: AT90CAN128
Configured for device ID: 0x9781 at90can128 -- Matched with AT90CAN128

command[ , 1]: A0 FF FF FF F1 DF 7C BB E8 FF FF FF F1 DF 7C BB E8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 43 C3 33 BF F7 3F F7 3F 00 00 4D 1F 77 77 00 FF FF FF FF 07 43 C3 33 BC 77 77 F7 3F 00 00 4D 1F 00 00 00 CD 3C F0 FF 04 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 22 57 3B 00 01 08 00 FE 00 00 FA 20 20
response: 41
JTAG config complete.
Preparing the target device for On Chip Debugging.

command[B, 1]: 42 86 FD 20 20
response: 41

command[£, 1]: A3 20 20
response: 41
jtagRead
command[R, 1]: 52 B3 00 00 00 00 20 20
response: FF 00 41

Disabling lock bits:
  LockBits -> 0xff

Enabling on-chip debugging:
jtagRead
command[R, 1]: 52 B2 02 00 00 00 20 20
response: FF 10 FD 00 41
  Extended Fuse byte -> 0xfd
      High Fuse byte -> 0x10
       Low Fuse byte -> 0xff

command[, 1]: A4 20 20
response: 41

command[x, 1]: 78 20 20
response: 41

command[B, 1]: 42 A0 00 20 20
response: 41

command[x, 1]: 78 20 20
response: 41
Waiting for connection on port 4242.
Connection opened by host 127.0.0.1, port 51131.
GDB: <qSupported>
->GDB:
GDB: <?>
->GDB: S05
GDB: <Hc-1>
->GDB:
GDB: <qC>
->GDB:
GDB: <qOffsets>
->GDB:
GDB: <Hg0>
->GDB:
GDB: <g>

GDB: (Registers)Read 32 bytes from 0x800000
jtagRead
command[R, 1]: 52 20 1F 00 00 00 20 20
Timed out.

command[ , 2]: 20
Timed out.

command[ , 3]: 20
Out of sync, reponse was `e0'

command[ , 4]: 20
Out of sync, reponse was `e0'

command[ , 5]: 20
Out of sync, reponse was `e0'

command[ , 6]: 20
Out of sync, reponse was `e0'

command[ , 7]: 20
Out of sync, reponse was `e0'

command[ , 8]: 20
Out of sync, reponse was `e0'

command[ , 9]: 20
Out of sync, reponse was `e0'

command[ , 10]: 20
Out of sync, reponse was `e0'
JTAG ICE: Cannot synchronise

What can be done? I am using windows 10.

LubOlimex

What is this port 4242?

Can you try with something like:

avarice -1 -j ⁄dev⁄ttyS2 -e -P AT90CAN128 -f YOURCODE.hex -p -v
Technical support and documentation manager at Olimex

embedded007

As I mentioned in the previous post, erase/program works using avarice and JTAG. When I try to debug, it fails. BTW, 4242 is the TCP port where AVR-GDC communicates with avarice to perform debugging-tasks such as "add breakpoints" or "read/write memory".
To run avarice as GDBServer use following command

>avarice -d  --jtag /dev/ttyS2 -1  -P AT90CAN128  :4242

This command will run GDBServer at port 4242. Please note that since, I already flashed the code. I did not flash it one more time.

Then open another terminal and run AVR-GDB instance

>C:\WinAVR\bin\avr-gdb.exe MYCODE.elf
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-mingw32 --target=avr"...
(gdb) target remote localhost:4242
Remote debugging using localhost:4242
Remote communication error: No error.
(gdb)

 Please check this guide for more details on setup. http://winavr.sourceforge.net/AVR-GDB_and_AVaRICE_Guide.pdf

LubOlimex

If the programming works fine, then it is probably something in the software.

Try with the latest AVaRICE and AVR-GDB versions and if the problem remains report it to the AVaRICE team and AVR-GDB team.

Try debugging using AVR Studio 4.
Technical support and documentation manager at Olimex