Get Free E-mail Updates

Enter your email address:

Delivered by FeedBurner

Search This Blog

Thursday, 9 August 2012

AVR - Programming methods

There are many ways of programming the AVR family of Microcontrollers and these ways are described in this post of AVR Freaks.Thanks to Mr.abcminiuser for this post.The different methods are as follows.

METHOD 1: In System Programming (ISP)
Supported By: Vast majority of AVRs (see below posts)
Supported Programmers: AVRISP MKI/II, JTAG MKII, STK500, STK600, Dragon, AVRISP clones, AVR910 Programmers, AVRONE

    In System Programming is perhaps the most common method of programming the flash, EEPROM, fuse and lockbytes of the entire AVR line. ISP can program AVRs at extremely high clock rates (assuming the target AVR is running at a high frequency and the programmer supports it) and is the method of choice for almost all AVR hobbyists. There are many, many AVRISP clones and AVR910 programmers on the market in addition to simple do-it-yourself dongles which connect to your computer's parallel port.

    Recent new dongle designs may use the computer's serial port, however anecdotal evidence has said that this method is *extremely* slow due to technical limitations.

    ISP requires that the target AVR is running at a clock rate of at least four times that of the ISP clock. This is a common pitfall and a source of confusion to many new to AVRs.


METHOD 2: JTAG
Supported By: See AVRStudio Tools help for MKI and MKII device support
Supported Programmers: JTAG-ICE, JTAG-ICE MKII, Dragon, JTAG-ICE clones, AVRONE, STK600 (programming only)
    Technically JTAG is a debugging system, not a programming method. Still, the JTAG interface allows for the programming of an AVR which supports it.

    JTAG is an in-system debugging tool which allows you to manipulate and examine the status of a supported AVR while it is running in a circuit. JTAG allows the user to stop execution at any time, the manipulation of the AVR's internal registers and much more.

    The official JTAG-ICE units from ATMEL have been superseded by the JTAG-ICE MKII, which supports the newer and more widely supported across the AVR range DebugWire debugging protocol as well as programming via the ISP method (see above).

    JTAG-ICE clones are available for low prices, however their limited compatibility with only a handful of AVRs limits their usefulness. Regardless of this, if your AVR supports the JTAG interface the JTAG-ICE remains a very nice and effective debugging method and programmer.


METHOD 3: DebugWire
Supported By: Many smaller AVRs
Supported Programmers: JTAG-ICE MKII, Dragon, AVRONE
    Again DebugWire is a debugging rather than a programming interface, but can be used to load in programs into supported AVRs. The dW interface uses a single AVR pin (the /RESET line) for all communications, making it ideal for the low-pin count AVR devices.


METHOD 4: Bootloader
Supported By: Most newer AVRs
Supported Programmers: N/A
    Again technically not a programming method. A bootloader is a small AVR program which sits in a user-settable reserved section of the regular flash. Bootloaders make use of the flash self-modification features available in the newer AVRs to allow the AVR to program itself via program data loaded from an external source. Bootloaders may source their data from any location (eg external dataflash or SD card) however by far the most common type of Bootloader communicates with a PC via the AVR's RS-232 (serial) port.

    Bootloaders are limited in that they do consume flash space (limiting the size of the flash available to the AVR's application) and they are unable to change the AVRs fusebits.

    Bootloaders are widely available on the internet for download, but they suffer from a "chicken and egg" problem; you need another type of programmer listed here to program in the bootloader in the first place. This is usually solved by the construction of a simple parallel port dongle (See ISP section) or by the purchase of an AVR already preloaded with a bootloader (eg the AVRButterfly board).


METHOD 5: High Voltage Parallel Programming (HVPP)
Supported By: Most non-TINY AVRs (with exceptions)
Supported Programmers: STK500, STK600, Dragon, Homebrew Dongles, AVRONE
    High Voltage Parallel Programming is a method of programming which is rarely used, because of the hassle it requires to set up. Despite this, HVPP programming is commonly used to "resurrect" AVRs whose fusebits have been mis configured via another programming method.

    Both the STK500 and the Dragon supports HVPP. During HVPP, the target's /RESET pin is raised to the unusually high value of 12V which engages the internal parallel programming circuitry. The /RESET pin is the only pin of the AVR (on HVPP supported AVRs) which can be safely raised to this level.

    You can make your own HVPP dongle using online plans such as this one.


METHOD 6: High Voltage Serial Programming (HVSP)
Supported By: Many TINY AVRs (with exceptions)
Supported Programmers: STK500, STK600, Dragon, Homebrew Dongles, AVRONE
    HVSP is similar to HVPP, except the data transfer is performed serially rather than in parallel. This is the alternate programming method used on many TINY series AVRs who lack enough pins for HVPP.


METHOD 7: PDI
Supported By: XMEGA AVRs
Supported Programmers: STK600, AVRONE, JTAG MKII, Dragon, AVRISP MKII
    PDI is the new programming interface based on the debugWire protocol, for the XMEGA line of AVRs. It's not currently used on any other 8-bit AVR microcontrollers.


METHOD 8: TPI
Supported By: 6-Pin TINY AVRs (ATTINY10, etc.)
Supported Programmers: STK600, Dragon, AVRISP MKII
    TPI is a very tiny programming interface for the newer TINY line of AVRs with limited pins, like the 6 pin ATTINY10. Like dW, TPI uses the device's /RESET line as part of the communication interface, but there the similarity ends. Since the pint-sized TINY AVRs lack a on-chip debugging circuit, the TPI protocol uses a new programming interface of three pins, in a half-duplex protocol. Because the /RESET line needs to be raised to +12V for programming when the device's RSTDSB pin is set, this is currently only supported by the newer STK600 programming board.

No comments:

Post a Comment