Go Down

Topic: Need help with JTAG debugging on Leonardo (Read 3371 times) previous topic - next topic

zoidicus

Unrelated to my other post, I would like some help with JTAG debugging of a Leonardo.

First, I had to build a JTAG adapter for the Leonardo.  After reading the datasheet for the Atmega32u4, the Olimexino32u4 (Leonardo clone), and the JTAGICE3, I assembled a stripboard adapter as shown in the attachments.  I think I did it right, because I can read and re-program the Arduino with no problems.  However, all attempts to start a debug session are failing.  Can someone help me with this?

I have the JTAGEN fuse programmed, and am uploading a simple blink program.  When I press <alt><f5> (start debugging and break), the chip gets programmed, followed by a 5-10 second pause, followed by an error message.  At that point the blink program begins running as it should (I can program different durations to verify that programming is working).  The output window of AS6 contains only this: 
Code: [Select]
21:21:03: [ERROR] , ModuleName: TCF (TCF command: Processes:getContext failed.)
21:21:03: [ERROR] Failed to start debugging session., ModuleName: TCF (TCF command: Processes:launch failed.)




zoidicus

Anybody?

I cannot possibly be the first person to try JTAG on a Leonardo. 

Nick Gammon

Quote
First, I had to build a JTAG adapter for the Leonardo.


Not having your adapter to hand it is hard to help.

Are you asking if I can JTAG debug with (say) the AVRISP programmer? If I can would that prove what you want proven?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

zoidicus

Very close.  As I understand it you wouldn't be able to debug with an ISP, but--yes--just knowing that you had successfully used a JTAG debugger to single step code on a Leonardo would be a nice, first, baby step.  Knowing that someone succeeded specifically with the JTAGICE3 and the Olimex Leonardo would be awesome; as would knowing exactly how they adapted the JTAG header to the Leo.  That may sound trivial to the point of being silly, but try to understand where I'm coming from.  I've spent 4-5 days trying to figure this out, with zero luck.  So, I'm taking it one tiny step at a time.  Since debugging a Leonardo requires different hardware and pinout than an Uno, I expected to see some details about it in the list of how Leonardo differs, or in a tutorial, or forum post, or ... something.  I can find nothing of the sort.  So I pieced together knowledge from 3 datasheets to make an adapter that I think is right.  Seems strange to me such an adapter isn't already widely commoditized by now, but whatever.  It would be nice if someone could validate my stripboard design (design and photos are attached above), or point me to another design I could use for reference.  It would also be nice to know whether I have the fuses and project settings correct.  If all those things are correct, then maybe I have a problem with my JTAGICE3, but I can't make that leap without a little help validating the other stuff first.  So that's what I'm asking for.  

Nick Gammon

Hmm. Looks like you are right. My ISP device is not a JTAG debugger. I can neither confirm nor not-confirm anything, sorry.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon


Since debugging a Leonardo requires different hardware and pinout than an Uno, I expected to see some details about it in the list of how Leonardo differs, or in a tutorial, or forum post, or ... something.  I can find nothing of the sort.


I just want to point out that the Arduinos are, more or less, aimed at the hobbyist market. The Leonardo is fairly recent. We are gradually putting together information about the differences in our own minds. Here are some references:

http://www.doctormonk.com/2012/10/arduino-leonardo-vs-arduino-uno.html

The official page: http://arduino.cc/en/Main/ArduinoBoardLeonardo

More official stuff: http://arduino.cc/en/Guide/ArduinoLeonardo

Also: http://arduino.cc/blog/2012/07/23/massimo-introduces-arduino-leonardo/

There are also some forum posts, eg.

http://arduino.cc/forum/index.php?topic=109659.0




Personally I debug with "debug prints", flashing LEDs, and the logic analyzer.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

marsanyi

I'm having fun with JTAG + Leonardo, too.  I've got a JTAGICE mkII and I've wired up the interface to the appropriate pins on the header on the Leonardo.  I can use avrdude to read and write fuses, and to upload firmware to flash (I can re-flash the Leonardo bootloader "caterina", for instance), but debugging, either with avarice or with Atmel Studio 6.0 doesn't work.  I get the message "bad response to leave progmode command: RSP_FAILED" and something similar in Atmel Studio.

marsanyi

Update: debugging over avarice w/avr-gdb is working.  Running from Eclipse shows nice GUI for debug.  So: Leonardo + jtagice mkII does work.  Off to try it with Atmel Studio 6.0 again.

marsanyi

Final update: Atmel Studio 6.0 is working, but requires a version that's a little older than the "current" one.  Per the info at http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=127073, downgrading Studio 6 to version 1853, available from the Studio Archives page at http://www.atmel.com/tools/STUDIOARCHIVE.aspx, and re-flashing the firmware on the jtagice mkII enabled debugging in Studio 6.

Go Up