ICE JTAG

Go To Last Post
40 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I discovered the ATmega1284P's use JTAG for debugging instead of debugWire, although the data sheet mentions debugWire.  The JTAG connector on my ICE is 0.050 pin spacing, so I ordered some 2x5 0.050 x 0.050 headers and some .050 grid perfboard, so I can make a little board to connect to the bare ATmega1284P with the ICE.  I have never used JTAG, so once I get it wired up and go to debug does it work like debugWire and set/unset the JTAGEN and OCDEN fuses for me, or do I do it manually.  Are there any special tricks required that I should know about.  I am programming the ATmega1284P with ISP and my AVRISP mkII and that is all good, but no debugging except with JTAG, hence the current project.  Any comments in advance appreciated.  Otherwise, I expect to have questions as I move along the JTAG path.  Should be fun.

 

Thanks in advance,

mark

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am intrigued.

 

My datasheet is 2009.  There is no mention of debugWIRE.

 

I have never seen 0.050 perfboard.    I find 0.100 protoboard difficult to solder point to point wiring.

I suggest that you buy an adapter from Ebay e.g. https://www.ebay.co.uk/itm/PinBoard-1-27mm-to-2-54mm-Cable-Converter-for-Zigbee-Bluetooth-Emulator-Download-/372615365239?hash=item56c19b4277

 

I dislike squid cables.    The official Atmel adapter is pretty horrible too.  (and expensive)

 

Oh.   JTAG is 10x more pleasant to use than debugWIRE.    Your ATmega1289P comes out of the factory with JTAGEN as default.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is a .1 inch, 10 pin connector for JTAG on the ICE. I use it all the time with the 1284P. Also, I have noticed that the ICE and the AVR ONE are sensitive to the length of the cable. I have made up longer cables because I don't like the ICE hanging from the PCB when I'm using it. They have refused to work. Maybe its a timing problem.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It depends on which "ICE" you are talking about.

 

JTAGICE-1,  JTAGICE-mkII, Dragon, AVRONE have 2.54mm pitch connectors

 

JTAGICE-3,  ATMEL-ICE have 1.27mm connectors.   Only the full-fat version of ATMEL-ICE comes with 2.54mm adapters.

 

David.

Last Edited: Sun. Mar 3, 2019 - 12:13 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
My datasheet is 2009.  There is no mention of debugWIRE.

The 10/20/16 datasheet mentions it on page 378:

Table 28-7. Fuse High Byte.
High Fuse Byte Bit No. Description Default Value
RSTDISBL(1) 7 External Reset Disable 1 (unprogrammed)
DWEN 6 debugWIRE Enable 1 (unprogrammed)
SPIEN(2) 5 Enable Serial Program and Data
Downloading
0 (programmed, SPI programming
enabled)
WDTON(3) 4 Watchdog Timer Always On 1 (unprogrammed)
Atmel ATmega1284P [DATASHEET]
Atmel-42719C-ATmega1284P_Datasheet_Complete-10/2016
378

 

david.prentice wrote:
I suggest that you buy an adapter from Ebay e.g. https://www.ebay.co.uk/itm/PinBo...

I could have gotten that adaptor, but I would rather make my own that fits on my board.

 

jimlake wrote:
There is a .1 inch, 10 pin connector for JTAG on the ICE. I use it all the time with the 1284P.

I got my ICE when they first came out, and it has a 2 x 5 .050 connector on it.

 

david.prentice wrote:
I have never seen 0.050 perfboard.

Here is some:  https://blackmesalabs.wordpress....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I downloaded the current ATmega164A/PA/324A/PA/644A/PA/1284/P datasheet.

No mention of debugWIRE.

 

I think the moral of the story is:   update your datasheets periodically.

 

The 1.27mm pitch protoboard looks useful for prototypes.

 

I am a wimp.    A professionally made pcb with ready made 1.27mm ribbon is more reliable than any hand made adapter.

I am quite capable of making software errors.    If I can't trust the programmer wiring it makes life difficult.

 

David.

Last Edited: Sun. Mar 3, 2019 - 01:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
I downloaded the current ATmega164A/PA/324A/PA/644A/PA/1284/P datasheet.

Right you are.  The one I was looking at was from October 2016.  Looks like they cleaned it up.  I have various version of datasheets that are different and some have mistakes others dont.  Some of the older ones are better in some areas.

 

david.prentice wrote:
I am a wimp.    A professionally made pcb with ready made 1.27mm ribbon is more reliable than any hand made adapter.

I have a lot of experience soldering prototypes, and i think it is fun.  Have never had too much trouble with reliability.  As a time vs. money goes, it would make sense to buy the adaptor, but who knows what kind of quality they have.  I have gotten enough "professionally made" Chinese boards that are not so reliable at all.  Frankly, I trust my own more that someone elses.  Especially something this simple, and it will fit on my board the way I want instead of hanging in midair, and I wont be using .050 ribbon except what is on the ICE.  Plus, I end up with .050 headers and perfboard for future projects.  I build a lot of boards by hand.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
I find 0.100 protoboard difficult to solder point to point wiring.

 

Really, it's a piece of cake.  There is lots of room for 24 gauge wire and a soldering iron between the pins.  0.050 will be even more interesting.  I will use 30 gauge solid wire  Sounds like you need more practice.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MarkThomas wrote:
0.050 will be even more interesting.  I will use 30 gauge solid wire
30AWG strands from 22AWG for SMT 50mil (1.27mm) pitch.

https://busboard.com/documents/datasheets/BPS-DAT-(SMTpads)-Datasheet.pdf

(page 7)

SMT Board Construction Tips

via SP3T-50x50-G | SMTpads, Size 3, 50x50mil | BusBoard Prototype Systems

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As David says using JTAG is about 10X easier than debug Wire. None of this DWEN and ISP/debug duality nonsense. You never change JTAGEN or OCDEN. Just connect up and your debugging. Oh and as JTAG is a superset of ISP there's no need at all for ISP headers. All programming and debugging can be done over the JTAG link.
.
Personally I deliberately pick and use AVR with JTAG (so 40 pins plus) and I just connect up a JTAG interface to it. Unlike David I personally like squid cables so that's my preferred connection.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jimlake wrote:
Maybe its a timing problem.
... or ground bounce and/or overshoot (injection current through the mega1284P's ESD suppressors, mega1284P : pin voltage, absolute maximum limit is 500mV outside the rails)

Series termination that somewhat matches the ICE's source impedance will reduce the effect.

22 ohms is common, 100 ohms may be good, audio impedances (499 ohms, 600 ohms) may be acceptable though may have to reduce the JTAG clock frequency.

10 ohms may work well as some external ESD suppressors have an approximate 1 ohm channel resistance (current division, 1 to 10)

More connected ground wires in the cable will reduce the issue; some ribbon cable have a ground plane by copper foil (cable ground plane to ICE ground and target ground)

Accurate Series Termination

via http://www.sigcon.com/Pubs/Keyword.html#termination

 

P.S.

jimlake wrote:
... I don't like the ICE hanging from the PCB when I'm using it.
Probes and small instruments can be hung above the PCBA by modular hose though laying all on a bench or table top is usual.

ModularHose.com - Loc-Line Modular Hose System

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm not sure I know what a squid cable is.  Is it one with multiple connectors on it?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lower right in Figure 1 :

Atmel-ICE - Full Kit Contents

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And the upper right shows the Adapter:

Adapter board containing 50-mil AVR, 100-mil AVR/SAM, and 100-mil 20-pin SAM adapters

The female connector at the bottom left is 100-mil AVR (2.54mm).    It should mate with most 5x2 JTAG headers but the awkward shape might get in the way.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh, ok,  So cables with multiple connectors coming off of them are squids.

 

The Atmel conversion board is ugly, and expensive.  I am looking forward to using JTAG.  I have an Arduino like board with an ATmega1284P on it that I use for everything, except debugging, as it turns out.  I also made my own Arduino like board with an ATmega328P (before I had ever heard about Arduino), and 5 x 2 shrouded headers, one for each PORT, that I also use all the time.  I also have an Arduino Uno 3 that sits in a drawer that I loan to people who want to learn Arduino.  I like the 2x5 headers, so I get a port (byte), power, and ground that I can plug my homemade ribbon cables into.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
JTAG is a superset of ISP

My Chinese AVRISP mkII, which is now working, has a ten wire ribbon with a 10 pin male header, with 4 of the wires cut and the remaining 6 going into a 6 pin ISP header I use to program flash.  Does that 10 pin connector mean my AVRISP will also program flash using JTAG?  All the AVRISP's on AliBaba have the 10 pin connector.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nope. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have never seen a Chinese AVRISP-2 or even a genuine Atmel AVRISP-2.

 

I suspect that the 5x2 header is the alternative ISP format that is used by STK500 (and USBASP)

It certainly is not JTAG.

But it might be for self-programming the AVRISP-2 firmware.

 

You can do your own detective work.   Compare the 5x2 pins with the 3x2 pins.

 

You have never said which JTAGICE you own.  e.g.

JTAGICE-1,  JTAGICE-mkII, Dragon, AVRONE have 2.54mm pitch connectors

JTAGICE-3,  ATMEL-ICE have 1.27mm connectors.   Only the full-fat version of ATMEL-ICE comes with 2.54mm adapters.

PICkit-4, SNAP has 8x1 female (2.54mm)

 

The STK600 can program JTAG but can't debug JTAG.

 

David.

Last Edited: Mon. Mar 4, 2019 - 11:08 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
I have never seen a Chinese AVRISP-2 or even a genuine Atmel AVRISP-2.

I bought a genuine Atmel from Digi-Key about 8 years ago, and that is about how long it lasted.  Here is a link to the Chinese ones:

 

https://www.aliexpress.com/whole...

 

david.prentice wrote:
You have never said which JTAGICE you own.  e.g.

I dont know which one it is.  I got it when they first came out.  It is genuine Atmel  It has a 1.27mm 2x5 connector partway down the ribbon connector and a 2.54mm 2x3 connector on the end of the ribbon.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MarkThomas wrote:
david.prentice wrote: I suggest that you buy an adapter from Ebay

I ended up buying one of those adaptors.  It should come from China sometime after I finish making my own.  Thanks for the pointer to it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Go on.  gchapman posted a link in #13

The ATMEL-ICE is available as a Basic model with a single ribbon.

 

It is not difficult to Google each "model" that I mentioned in #18.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
You have never said which JTAGICE you own.  e.g. JTAGICE-1,  JTAGICE-mkII, Dragon, AVRONE have 2.54mm pitch connectors JTAGICE-3,  ATMEL-ICE have 1.27mm connectors.   Only the full-fat version of ATMEL-ICE comes with 2.54mm adapters. PICkit-4, SNAP has 8x1 female (2.54mm)

 

It is an ATMEL-ICE.

 

Digikey sells the ATMEL-ICE basic with no cables for $90:

https://www.digikey.com/product-...

 

and then another $23 for the cable that came with mine:

https://www.digikey.com/product-...

 

I seem to remember paying $50 for the basic with the cable combined.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes,  that sounds about right.    Atmel sold the ATMEL-ICE Basic for about $50.   And the full-fat version for about $80.

The PCBA version has no case, no cables.

The Basic has a single ribbon.

The full-fat version comes with the set of adapters, cables as shown in #13

 

All versions have gone up in price with Microchip ownership.

But PICkit-4 is similar.    But without Atmel ribbon cable.

In theory,  the SNAP has got the hardware capability to do your JTAG.    The software/firmware is not willing.    One day,   the software will be updated.

 

IMHO no tool is any good if it does not come with suitable cables and connectors.

 

Anyway,   you should be able to buy / make a cable for your ATMEL-ICE.    You probably have enough parts available.

It is not so simple for a new user.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
The Basic has a single ribbon.

Now the "basic" from Digi-Key is just the box.  The single ribbon is a separate part for another $23.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, the Digikey site seems to omit the cables for the Basic. I suspect that this is a mistake.
Other distributors e.g. Farnell sell the Basic with USB cable and ribbon cable. RS sell with USB, ribbon and squid.
.
Hey-ho. It might be a cunning master plan from Microchip. But I suspect it is just a cock-up from Digikey.
.
David.

Last Edited: Tue. Mar 5, 2019 - 08:02 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mouser shows just the box for $91, same as Digi-Key.  No mention of cables.  Farnell shows just the box in their picture for about the same price, but the fine print mentions cables, so who knows.  I'm glad I have one and hope it doesn't fail any time soon.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
You never change JTAGEN or OCDEN. Just connect up and your debugging

I looked at the fuses on the ATmega1284P I'm using with my AVRISP mkII, and both HIGH.OCDEN and HIGH.JTAGEN were unchecked, so I checked them both and got a warning that disabling JTAGEN will make programming with JTAG no longer work.  I'm a little confused about the HIGH and LOW prefixes.  I check HIGH.EESAVE and the EEPROM becomes non-volatile and I check LOW.CKOUT and the clock goes out to the appropriate pin.  I'm not sure what the deal is.  Can anyone explain this to me?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The data sheet shows:

 

So I guess changing the JTAGEN fuse from default will disable JTAG.  However the data sheet also says:

 

and

 

so I do I check the OCDEN fuse to change it from the default value (unprogrammed) to get JTAG to work?  Or do I do what Cliff suggests and not change either of them and just plow forward.  I guess I can experiment with all this once I get a 1.27mm adaptor, but it is a little confusing.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It just works, until you disable it!  wink

 

 

jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The mega1284P comes out of the factory with JTAGEN.

AS7 will handle the OCDEN for you.

 

Just connect to the JTAG pins and away you go.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is what I meant about it being "easier". There's no switching it into the right "mode" or anything like that. The chips come out of the factory with everything set right to JTAG. You just attach the interface and "start debugging". In fact the only "gotcha" is the other way round... those folks who don't want to JTAG but find they can't use those 4 IO pins by default.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, I will just leave the fuses the way they came from the factory.  I will report back once I get the 1.27mm business worked out.

 

Thanks all.  I appreciate it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wired up a set of 2x10 1.27mm header pins as if I am looking down on the pins as shown below.  When I plug in the Atmel ICE it tells me to check my connections.  Do I have it reversed?  When I check continuity between the header pins and the ATmega1284P pins they all check out.  I have the /reset pin wired to reset.  Pins 7 and 8 NC.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MarkThomas wrote:
My Chinese AVRISP mkII, which is now working, has a ten wire ribbon with a 10 pin male header, with 4 of the wires cut and the remaining 6 going into a 6 pin ISP header I use to program flash. Does that 10 pin connector mean my AVRISP will also program flash using JTAG? All the AVRISP's on AliBaba have the 10 pin connector.

 

Are you using an MKII or an ICE?  If an MKII then you have a problem as the MKII only does ISP.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, I am using the ICE.  Is the pinout correct if I am looking down on the pins?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I read 5V between pins 2 and 4 but VS7 says no JTAG voltage detected.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can read your current fuses with ISP.    Make sure that you have JTAGEN.   (it was the default from the Factory)

 

Then connect your ATMEL-ICE ribbon to your 1.27mm header.   Make sure that the ribbon female header pin#1 aligns with your male pin #1.    Mark pin#1 with a spot of paint or permanent marker pen.

 

The VCC voltage should read correctly in AS7 when the ribbon is correctly attached (and the target is externally powered).

 

David.

Last Edited: Thu. Mar 14, 2019 - 12:00 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did that.  With my volt meter i read 5V on the Vcc and GND pins, but in VC7 I cannot read the voltage.  It says reading target voltage failed.  It cannot detect a JTAG device.  The fuses are as from the factory.  When I read them with my AVRISP both HIGH.JTAGEN and HIGH.OCDEN are unchecked.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OH, I must have changed the fuse at some point.  I put in a new chip and the JTAGEN box is checked.  DUH.  I will try with the new chip.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Well, this is pretty embarrassing.  Now that I think about it I think that chip is one I bought from a guy on eBay.  The JTAGEN fuse was unchecked.  I dont think I would have unchecked it.  Every time I checked it and tried to set it I got a warning that changing that fuse would disable JTAG, so I was hesitant to continue with it checked.  When I put in a brand new chip that fuse was checked as it came from the factory.  So I put the old chip back in, checked the JTAGEN fuse box and ignored the warning, and now I built the code in debug mode and installed it with JTAG.  Started up the debugger, and now I am debugging.  Beautiful.  Thanks for your time.  JTAG is pretty cool.  Onward and upward.smiley