A simple "JTAG-HAT" board for the Arduino Mega  - Page 1
Forum section: electronics / general

author: THDplusN_bad
author_rank: Regular Contributor
timestamp: February 07, 2018, 11:46:39 pm
content: Good Day my fellow Arduino enthusiasts,Prologue:I frankly admit it: I am late to the Arduino party. However, I became intrigued by the idea of a low-cost, fairly powerful µC-platform over the past years. An opportunity to get me back into programming - I was into VHDL and Motorola HC11-programming many, many moons ago- I am sure some of you will remember those days of expensive tools such as Codewarrior or IAR workbench and endless evenings dealing with mnemonics such as LDAA, LRSA etc...I am still at the very beginning, but it quickly became obvious that the Arduino "IDE" is nothing but a programming tool - not a real development environment. Support for any level of debugging, stepping commands, monitoring registers - nada.I was then glad to hear about the free ATMEL Visual Studio IDE - only to find out that a) The Arduino Mega2560 µC does not support the so-called debug-wire interface, but JTAG and b) I need an in-circuit-emulator/JTAG device. So, I have placed an order at digikey and a few days later I became the proud owner of an inexpensive Atmel ICE board (again, in comparison to the prices 15..20 years ago!)I went for the basic kit, which comes with a 10-pin/6-pin cable and USB-micro cable...- Only to find out that microchip sells the full kit (which includes all common cables and an adapter) at a 50% discount until Feb 28th! Seehttps://www.microchipdirect.com/product/search/all/ATATMEL-ICE(no affiliation with the company) -The "JTAG-HAT" for the Arduino Mega:The task was to find a convenient way to connect the ATMEL ICE to my Arduino Mega-clone board HW for debugging via JTAG. Again, I am very new to the Arduino universe, but I think the the following little board would be called a "JTAG HAT".What is it?A simple HAT board for the Arduino Mega, which connects to the ATMEL-ICE via JTAG and maintains access to all headers /signals.How was it made?Main components are a simple, single-sided perf.-board and a 0.05"-pitch cable with 10-pin header (digikey order number is SAM8221-ND at 5.37€ plus VAT).I had some 25-pin sub-D connectors in my stock, and decided to use what I had available...Any hints?Yes, the following might be useful for others: The trick is to use standard 0.1" female headers and stack them on top of the board connectors in such a way that the resulting mechanical offset affects all connectors same way.If you cut-off the connectors for the digital signals of the Arduino Mega a bit, the height can be made to match.As a result, the "JTAG-HAT" can be used in conjunction with any other Arduino peripherals as long as the Arduino Mega 2560's port F signals which are also used for JTAG are not used (A4 to A7).The Sub-D connector is designed for 0.1" flat cable. I have used some double-sided adhesive tape and precision tweezers to position the 0.05" pitch cable before crimping. See photos for details. A 2nd layer of adhesive tape and a few drops of hot glue were used to re-inforce the mechanical connection. See photos.Schematics?Sorry, no. I have decided to skip schematics as the design is so very simple. I have added a green LED for the VCC supply, and a simple JFET-based buffer (BF245A) to drive a yellow LED to monitor the JTAG TDI signal.All other connections are just 1:1 feed-through.I was glad to see that after I had set the infamous JTAGEN-fuse on the Arduino Mega using the ISP interface, Atmel Studio 7 reliably connects to the Arduino Mega via my JTAG HAT-board.It works!That will keep me entertained for sure for some time ...I trust this simple board might inspire others. It took me about 1.5 hrs to build it and 30 min for the design and collecting the needed components.Cheers,THDplusN_bad

author: westfw
author_rank: Super Contributor
timestamp: February 08, 2018, 02:30:24 am
content: I did this a while ago. Simpler and less flexible, I guess...https://oshpark.com/shared_projects/HtnXf6wb

author: THDplusN_bad
author_rank: Regular Contributor
timestamp: February 08, 2018, 07:58:56 am
content: Good Day,westfw, that's a nice PCB, I must say. Thanks.However, the point was to maintain access to all ports/pins. One can add any other board for the Arduino Mega on top of my board.Cheers,THDplusN_bad

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: February 08, 2018, 08:52:22 am
content: Quote from: THDplusN_bad on February 07, 2018, 11:46:39 pmNice work!If I create an equivalent KiCad design, would you help reviewing it?I did a quick schematic ...

author: THDplusN_bad
author_rank: Regular Contributor
timestamp: February 08, 2018, 01:44:00 pm
content: Good Day,sure, see my PM. Thanks!THDplusN_bad

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: February 10, 2018, 01:37:12 pm
content: With THDplusN_bad I have created a KiCad projecthttps://github.com/bobc/jtag_shieldI also created a sample PCB layout, requires further work.