# JTAG, ISP, debugWIRE, Your mom!

**URL:** <https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537>\
**Category:** MicroMod\
**Tags:** avr-atmel\
**Created:** [February 23, 2008, 5:01am UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537 "2008-02-23T05:01:07Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chupa](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@Chupa](https://community.sparkfun.com/u/Chupa)\
**Post date:** [February 23, 2008, 5:01am UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/1 "2008-02-23T05:01:07Z")

</div>

Ive been developing with PICs for some time now and am looking to give AVRs a shot. One thing i wish i learned sooner than i did about PICs is ICSP. Knowing this im trying to figure out all this stuff for AVR. I am just over whelmed with the info out there though. So far from what i can tell theres a couple different types of in circuit programing/debugging: JTAG, debugWIRE, ISP (or is that just referring to all of this stuff?). This is what ive gathered from looking over doc2562 from atmel. Could someone shed some light on the subject for me? Is there a better doc i should be reading? Couldent find much at AVR freaks. What type of additional components are required to implement ISP? IE. with PICs you need a protection diode from MCLR to VCC to use ICSP.

I gather from other threads here that the AVR Dragon is a nice board to get. So think I will be getting that when im ready.

---

<div class="post-metadata">

**Author:** ![wiml](https://avatars.discourse-cdn.com/v4/letter/w/48db29/32.png) [@wiml](https://community.sparkfun.com/u/wiml)\
**Post date:** [February 23, 2008, 9:10am UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/2 "2008-02-23T09:10:19Z")

</div>

JTAG is usually found on larger chips which can dedicate four pins to the task. debugWire is a proprietary Atmel thing that lets you do live debugging (as well as programming) over a single pin (it re-uses the reset pin). The mid-sized AVRs use an SPI-like serial programming interface (if I remember how PICs work, it’s very similar to that); when they’re not in ICSP mode, the pins are normal I/O pins.

So, there are three different interfaces, supported by different chips. Some chips support more than one (e.g., the attiny25 has both debugWire and the SPI programming interface).

---

<div class="post-metadata">

**Author:** ![Chupa](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@Chupa](https://community.sparkfun.com/u/Chupa)\
**Post date:** [February 23, 2008, 5:17pm UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/3 "2008-02-23T17:17:56Z")

</div>

i actually found something on the forums at AVR freaks. [http://www.avrfreaks.net/index.php?name … hlight=isp](http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=38691&highlight=isp)

I think between this and your info wiml i have enough to get started. thanks!

---

<div class="post-metadata">

**Author:** ![stevech](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@stevech](https://community.sparkfun.com/u/stevech)\
**Post date:** [February 23, 2008, 11:58pm UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/4 "2008-02-23T23:58:07Z")

</div>

also serial port downloading (bootloader). There are lots of free ones, including

[http://www.avrfreaks.net/index.php?modu … tem\_id=625](http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_type=project&item_id=625)

[avrfreaks.net](http://avrfreaks.net) has an active user forum, lots and lots of donated code in the projects section, etc.

free GCC (winAVR) integrated with free Atmel Studio (download).

Better-yet low cost C compilers such as Codevision and ICC.

[Zbasic.net](http://Zbasic.net) - superb compiler/platform. Like VB6

I find this all more advantageous than PICs, which I used to use, and Iconsider them training wheels or freshman lab stuff.

---

<div class="post-metadata">

**Author:** ![Chupa](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@Chupa](https://community.sparkfun.com/u/Chupa)\
**Post date:** [February 24, 2008, 6:10am UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/5 "2008-02-24T06:10:12Z")

</div>

> stevech:  
> free GCC (winAVR) integrated with free Atmel Studio (download).
> 
> Better-yet low cost C compilers such as Codevision and ICC.

winAVR is a C compiler, is it not? Your quoted statement confuses me.

As for PICs vs AVR, what about PICs makes you think of them as training wheel type uC’s? From a development standpoint i dont think theres much difference. The key differences i know of is that AVRs are most often cheaper when running production quantities, and AVRs execute code faster (instructions executed in 1 cycle, as appose to multiple on a PIC), none of which has to do with development. I mean if someone can write a program to convert PIC asm to AVR asm there cant be that much difference, no?

---

<div class="post-metadata">

**Author:** ![beebop](https://avatars.discourse-cdn.com/v4/letter/b/65b543/32.png) [@beebop](https://community.sparkfun.com/u/beebop)\
**Post date:** [February 24, 2008, 9:52pm UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/6 "2008-02-24T21:52:17Z")

</div>

> I find this all more advantageous than PICs, which I used to use, and Iconsider them training wheels or freshman lab stuff.

THAT is your opinion. I, myself, consider those who think one one product is

‘the best’ less than freshman, in fact, closer to children, than adults.

I’m tired of hearing of how AVR is better than PIC or Windows is better than Mac, Intel is better than AMD, or the other way around. Same goes for development languages, and almost anything else I can think of.

Use what works for you, and if you feel your member is so much smaller than that of others, please find a new way to compensate.

---

<div class="post-metadata">

**Author:** ![Chupa](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@Chupa](https://community.sparkfun.com/u/Chupa)\
**Post date:** [February 25, 2008, 12:05am UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/7 "2008-02-25T00:05:14Z")

</div>

i agree with beebop and will continue using what i am most comfortable with. I am just open to all the information those around me are willing to give me. So feel free to let me know why you think one is better than the other. Ill never stop someone from teaching me something new.

---

<div class="post-metadata">

**Author:** ![stevech](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@stevech](https://community.sparkfun.com/u/stevech)\
**Post date:** [February 25, 2008, 5:07am UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/8 "2008-02-25T05:07:49Z")

</div>

> Chupa:  
> So feel free to let me know why you think one is better than the other. Ill never stop someone from teaching me something new.

I’ve used both PIC and AVR and many others. I have my opinions based on two decades of experience. But I don’t care to debate it here.

---

<div class="post-metadata">

**Author:** ![Chupa](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@Chupa](https://community.sparkfun.com/u/Chupa)\
**Post date:** [February 25, 2008, 6:17am UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/9 "2008-02-25T06:17:40Z")

</div>

> stevech:
> 
> > Chupa:  
> > So feel free to let me know why you think one is better than the other. Ill never stop someone from teaching me something new.
> 
> I’ve used both PIC and AVR and many others. I have my opinions based on two decades of experience. But I don’t care to debate it here.

can you not just give an example or two? It was never my intention to debate you in anyway. Just curious is all.

---

<div class="post-metadata">

**Author:** ![jotux](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@jotux](https://community.sparkfun.com/u/jotux)\
**Post date:** [February 25, 2008, 4:31pm UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/10 "2008-02-25T16:31:35Z")

</div>

There are four methods of programming AVR devices. High Voltage Serial programming, Jtag, Debug Wire, and ISP.

HVSP is the bazillion-pin interface you can only use on some older devices. It is also the only way to reset some fuse bits once you’ve accidentally set them to something that makes your chip unusable to you(like setting the clock to external when there is no clock connected…).

Jtag is the 10 wire(I think 7 are actually used) interface that is standard on some of the larger devices. If you want to do on-chip debugging for mega16/32/64…you’ll need to use Jtag.

ISP is the cheapest and simplest interface. On the dev. boards you’ll usually have a 6-pin connector, and five of them are used. You can’t debug on the chip with this interface, so when you go to test your code you’ll have to use the (what I consider) nearly inhumane burn-and-run method. The great thing about ISP is it’s dirt cheap ($30 for usb ISP programmer, or $70 for stk500 which has HVSP and ISP).

Debug Wire is the 2-wire interface atmel uses to do on-chip debugging for smaller(and newer) devices. The catch is, you actually need many more pins for this “2-wire” interface than two wires. To use Debug Wire you’ll need to go through a process similar to this:

to debug:

Compile your code and burn it with ISP, enable the debugwire fuse, enter debug mode and debug.

to reprogram:

disable the debugwire fuse, recompile, program with ISP, enable debugwire fuse…repeat.

It doesn’t look like a complicated way to get stuff done…if you’re not doing it for the first time.

Anyways…I’ve done firmware development on the MSP430, AVRs, and dsPICs extensively. The nice thing about AVRs is the kitchen-sink approach to features. Instead of having a million devices(like PICs) they have ~50 or so and generally have everything built in. For small quantities they’re pricey, but for hobby stuff that’s alright. One thing about AVRs that really bothers me, especially after using MSP430s, is the patchwork of registers they have in order to keep reverse compatibility. They’ll have multiple bits across several registers, and sometimes configuring something that would be trivial on other devices is just a pain.

If you do end up using the AVRs, the dragon is a great board to use. It’s pretty cheap, and you can use it to do on-chip debugging for devices up to 32kb. Just be careful with static around it. I haven’t had a problem with mine, but I’ve read articles of people zapping it.

Personally, I would use the free C compiler(since I’ve been using it for years now) GCC and use the free AVR studio environment to do your development. Free is the best price 🙂

---

<div class="post-metadata">

**Author:** ![stevech](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@stevech](https://community.sparkfun.com/u/stevech)\
**Post date:** [February 25, 2008, 6:43pm UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/11 "2008-02-25T18:43:32Z")

</div>

> Chupa:
> 
> > stevech:
> > 
> > > Chupa:  
> > > So feel free to let me know why you think one is better than the other. Ill never stop someone from teaching me something new.
> > 
> > I’ve used both PIC and AVR and many others. I have my opinions based on two decades of experience. But I don’t care to debate it here.
> 
> can you not just give an example or two? It was never my intention to debate you in anyway. Just curious is all.

OK. At the risk of flame-bait (but this IS the AVR section of the forum)

AVR:

- uses linear addressing of memory: no bank switching with tiny page sizes, which, in the PICs, is a super PITA, wastes a lot of code space, and is very error prone, and an interrupt context PITA

  

Search [AVRfreaks.net](http://AVRfreaks.net) for other comparisons. This has been hotly debated many times. I used PICs when I first started in embedded microprocessors. I came from assembly language on PDP-11s, Moto 68000, Moto 6809; I was shocked at how crude the PICs were, architecturally, and soon moved on.

---

<div class="post-metadata">

**Author:** ![Chupa](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@Chupa](https://community.sparkfun.com/u/Chupa)\
**Post date:** [February 25, 2008, 8:07pm UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/12 "2008-02-25T20:07:52Z")

</div>

good info everyone. thanks much!

---

<div class="post-metadata">

**Author:** ![Chupa](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@Chupa](https://community.sparkfun.com/u/Chupa)\
**Post date:** [February 25, 2008, 8:34pm UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/13 "2008-02-25T20:34:57Z")

</div>

ahh forgot to ask. What are the hardware requirements for using ISP/debugWire? I assume the pins on the uC can also be used as I/O, so if your using one of them as such you have to isolate whatever the lines connected to so it doesn’t interfere with ISP. Thats a given though but for using ICSP on a pic you always included a diode from VCC to MCLR/VPP for over voltage protection. Is there anything like that required for the AVR?

---

<div class="post-metadata">

**Author:** ![stevech](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@stevech](https://community.sparkfun.com/u/stevech)\
**Post date:** [February 26, 2008, 5:04am UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/14 "2008-02-26T05:04:32Z")

</div>

ISP can share the I2C pins if the external device doesn’t interfere, e.g., is tri-stated or resistor isolated.

It’s also common to use a bootloader and serial port.

---

<div class="post-metadata">

**Author:** ![inventore123](https://avatars.discourse-cdn.com/v4/letter/i/b9bd4f/32.png) [@inventore123](https://community.sparkfun.com/u/inventore123)\
**Post date:** [February 26, 2008, 8:23am UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/15 "2008-02-26T08:23:44Z")

</div>

To find a simple schematic for a parallel port ISP programmer google for stk200, it’s easy to make with just some perf board 8) . It is compatible with avrdude (the program, which is part of winavr gcc compiler that lets you download your code to the chip).

A very easy way to reuse the ISP pins for other functions is, if your project requires some pushbutton, to connect them to those pins. If you don’t push the buttons while programming the chip, everything will work 🙂

---

<div class="post-metadata">

**Author:** ![beebop](https://avatars.discourse-cdn.com/v4/letter/b/65b543/32.png) [@beebop](https://community.sparkfun.com/u/beebop)\
**Post date:** [February 26, 2008, 2:06pm UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/16 "2008-02-26T14:06:26Z")

</div>

stevech,

Thanks for that review, so much better!

---

<div class="post-metadata">

**Author:** ![Chupa](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@Chupa](https://community.sparkfun.com/u/Chupa)\
**Post date:** [February 26, 2008, 5:59pm UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/17 "2008-02-26T17:59:45Z")

</div>

> stevech:  
> ISP can share the I2C pins if the external device doesn’t interfere, e.g., is tri-stated or resistor isolated.
> 
> It’s also common to use a bootloader and serial port.

so most all the AVRs ISP is done via SPI/I2C pins? that seems like it makes more sense then PICs having them on random port B pins…

You need additional hardware (max232) to do the serial thing i assume so im not too interested in that. Also i don’t have a serial port on my PC, same with a parallel port, no stk200 for me ☹

---

<div class="post-metadata">

**Author:** ![stevech](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@stevech](https://community.sparkfun.com/u/stevech)\
**Post date:** [February 27, 2008, 1:39am UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/18 "2008-02-27T01:39:29Z")

</div>

I’d strongly recommend that you buy the Atmel ISP programmer (connects to USB port of PC). The home made parallel port ISPs are notoriously unreliable, and also require goofy device drivers on the PC because MS WIndows prohibits direct access to I/O devices.

$45 or so, well worth it, and will save a lot of hair pulling.

---

<div class="post-metadata">

**Author:** ![Chupa](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@Chupa](https://community.sparkfun.com/u/Chupa)\
**Post date:** [February 27, 2008, 4:26am UTC](https://community.sparkfun.com/t/jtag-isp-debugwire-your-mom/6537/19 "2008-02-27T04:26:20Z")

</div>

I was originally planning on getting a dragon board. Is the atmel ISP (or clone) still a better option?
