JTAG, ISP, debugWIRE, Your mom!

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.

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).

i actually found something on the forums at AVR freaks. http://www.avrfreaks.net/index.php?name … hlight=isp

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

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

http://www.avrfreaks.net/index.php?modu … tem_id=625

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 - 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.

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?

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.

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.

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.

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.

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 :slight_smile:

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:

  • has a real hardware stack (very few micros lack a real stack, q.v. PIC) that can be as large as you wish, up to RAM size. As opposed to a very small subroutine call stack where the compiler/programmer must avoid overflowing. Real stack allows local variables in C functions to be on the stack rather than tying up an address register to emulate a stack.

    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

    Bootstrap loader (serial port) is widely used. Many are public domain. Example is “BLIPS” on AVRfreaks.net’s projects section. PC side + AVR side. free.

    All the usual I/O things among a large family of AVRs: up to 4 UARTs, SPI, I2C, external memory chips mapped into linear space, etc.

    Excellent free C compiler (WinAVR/GCC) integrated with Atmel’s Free IDE; gawdawful Makefiles are hidden.

    More numerous and lower cost software development tools:

    Low cost commercial C compilers: Codevision AVR, ICC, plus high cost commercial: IAR

    Low cost structured Basic compilers: Zbasic.net and mikroElektronika (also PASCAL).

    Low cost limited Basic compiler: BASCOM

    lots more

    AVRfreaks.net - superb support site and source of lots of sample code and projects

    Lots of truly low cost development boards from many vendors


  • Search 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.

    good info everyone. thanks much!

    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?

    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.

    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 :slight_smile:

    stevech,

    Thanks for that review, so much better!

    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 :frowning:

    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.

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