AVR Programming Methods 

There are many ways to program AVR microcontrollers.

Since many people ask about different ones at one time or another, I thought I'd outline them here

so that their questions can be answered quickly and efficiently.

Please forgive me if I miss a method or make an error.

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

Bonus FAQ Section!

1) Which is the best method?
There is no universal "best" method. ISP programming is simple and extremely popular, however all the above methods will work. The two high voltage programming modes (whichever is applicable to your device) are the most feature rich, as they allow for the repair of an AVR which has had its fuses misconfigured. However, those methods are a pain to set up, hence the reason most users go with with ISP.

2) I've made a parallel port dongle. Can I use it with AVRStudio?
I'm afraid not. AVRStudio cannot interface with any "dumb" dongles - it requires a smart programming device - containing a microcontroller itself - to decipher the communication protocol it sends. Simple dongles without a microcontroller must be "bit-banged" (ie. the appropriate signals simulated through the dongle via the computer) itself.

3) So my dongle's useless then?
No. You can still program through a home made dongle with a third party programming software tool. AVRDude is a good, known, free command line utility - and it comes included with the WinAVR package.

4) What are my options if I want my programmer to work with AVRStudio?
Choose a programmer that uses an AVRStudio-supported protocol. This can be the simple "AVR910" protocol (deprecated) or a custom implementation of the protocol used by the STK500/AVRISP. Note that these programmers require a micro controller in them, leading to a catch-22 situation. This may be solved by having the programmer's AVR pre-programmed at time of purchase with the appropriate firmware, or by having the AVR pre-programmed with a bootloader.

5) Ok, I want to use a bootloader. How do I get it in there in the first place?!
To use a bootloader in an AVR, you first have to have the bootloader programmed in. If you do not have an existing programmer (even a simple dumb dongle will suffice for the initial programming), you can alternatively purchase AVRs pre-programmed with a bootloader from several suppliers.

Atmel also manufactures the Butterfly demo board, whose MEGA169 AVR comes pre-loaded with an AVR-Studio compatible bootloader.

6) Help! I've messed with the fuses and knackered my AVR while using ISP!
The most common mistake is changing the clock selection fuses to an invalid setting.
Try putting an external clock on the AVR's XTAL1 pin and see if that helps.

Failing that, if possible use one of the high-voltage methods. These will fix any misconfiguration,
including ones involving the clock source as the high-voltage methods provides its own clock to the AVR for programming.

7) How do I interface with my programmer?
Which software you use to interface with your programmer depends on the type of programmer you are using.

Simple "dumb" dongles require third party software, such as PonyProg or AVRDude.

These may be command line or GUI tools - look around on the web and you will fine one to fit your needs.

Programmers and bootloaders based on the AVR910 protocol can be used within AVRStudio.

From the Tools menu, select the "AVRProg" option to open up a GUI screen to interface with your programmer.

As an alternative, third party tools such as AVRDude are also AVR910 compatible.

Official tools are tightly integrated into AVRStudio, especially in the case of the debugging variants (JTAG/Dragon/etc).

From the AVRStudio Tools menu, select the "Program AVR..." submenu and click the "Connect" item.

From the new window, select your tool and its connection interface and click ok.

As is the case with the dumb dongles and AVR910 programmers, the official tools may also be used with third party programming software.

- Dean :twisted:

(C) Dean Camera, 2009. All rights reserved. Not for reproduction on any website other than AVRFreaks.net without prior explicit permission.

AVR Programming Methods的更多相关文章

  1. 学习笔记之编程珠玑 Programming Pearls

    Programming Pearls (2nd Edition): Jon Bentley: 0785342657883: Amazon.com: Books https://www.amazon.c ...

  2. NLP&数据挖掘基础知识

    Basis(基础): SSE(Sum of Squared Error, 平方误差和) SAE(Sum of Absolute Error, 绝对误差和) SRE(Sum of Relative Er ...

  3. 增强学习(三)----- MDP的动态规划解法

    上一篇我们已经说到了,增强学习的目的就是求解马尔可夫决策过程(MDP)的最优策略,使其在任意初始状态下,都能获得最大的Vπ值.(本文不考虑非马尔可夫环境和不完全可观测马尔可夫决策过程(POMDP)中的 ...

  4. 【整理】强化学习与MDP

    [入门,来自wiki] 强化学习是机器学习中的一个领域,强调如何基于环境而行动,以取得最大化的预期利益.其灵感来源于心理学中的行为主义理论,即有机体如何在环境给予的奖励或惩罚的刺激下,逐步形成对刺激的 ...

  5. 自然语言15.1_Part of Speech Tagging 词性标注

    QQ:231469242 欢迎喜欢nltk朋友交流 https://en.wikipedia.org/wiki/Part-of-speech_tagging In corpus linguistics ...

  6. 词性标注 parts of speech tagging

    In corpus linguistics, part-of-speech tagging (POS tagging or POST), also called grammatical tagging ...

  7. 【cs229-Lecture20】策略搜索

    本节内容: 1.POMDP: 2.Policy search算法:reinforced和Pegasus: 马尔科夫决策过程(Partially Observable Markov Decision P ...

  8. 常用的机器学习&数据挖掘知识点【转】

    转自: [基础]常用的机器学习&数据挖掘知识点 Basis(基础): MSE(Mean Square Error 均方误差),LMS(LeastMean Square 最小均方),LSM(Le ...

  9. 【基础】常用的机器学习&数据挖掘知识点

    Basis(基础): MSE(Mean Square Error 均方误差),LMS(LeastMean Square 最小均方),LSM(Least Square Methods 最小二乘法),ML ...

随机推荐

  1. Docker学习笔记二 使用镜像

    本文地址:https://www.cnblogs.com/veinyin/p/10408363.html  Docker运行容器前,需本地存在对应镜像,若没有则Docker从镜像仓库下载该镜像.  镜 ...

  2. python中的__new__、__init__和__del__

    __new__.__init__.__del__三个方法用于实例的创建和销毁,在使用python的类中,我们最常用的是__init__方法,通常称为构造方法,__new__方法几乎不会使用,这篇文章是 ...

  3. Django安装配置

    django2.0基础 一.安装与项目的创建 1.安装 pip install django 2.查看版本 python -m django --version 3.创建项目 django-admin ...

  4. vue-cli 3.0 开启 Gzip 方法

    vue.config.js const path = require('path') const CompressionWebpackPlugin = require('compression-web ...

  5. Linux输出重定向>和>>的区别是什么

    [简介:>与>>的区别]   1 > 是定向输出到文件,如果文件不存在,就创建文件:如果文件存在,就将其清空:一般我们备份清理日志文件的时候,就是这种方法:先备份日志,再用`& ...

  6. ORACLE数据库数据文件转移方法(不同于move方法)

    1) 手动拷贝要转移的数据数据文件'd:\OracleData\GWTABLE42.DBF'到新的位置'E:\OracleData\GWTABLE42.DBF'. 2) 把数据文件所属的表空间Offl ...

  7. Ibatis.Net 数据库操作学习(四)

    一.查询select 还记得第一篇示例中是如何读出数据库里3条数据的吗?就是调用了一个QueryForList方法,从方法名就知道,查询返回列表. 1.QueryForList  返回List< ...

  8. 再谈CentOS 7程序自启动

    上次发现了/etc/init.d下已经没有启动脚本了,然后对于启动乱序自己在rc.local中重排. 其实想一想这些应用的自启动终归还是需要通过脚本来执行的. 一.脚本在哪里? /usr/lib/sy ...

  9. 002_JavaSE笔记:单例模式

    一.应用杨景 在计算机系统中,线程池.缓存.日志对象.对话框.打印机.显卡的驱动程序对象常被设计成单例.这些应用都或多或少具有资源管理器的功能.每台计算机可以有若干个打印机,但只能有一个Printer ...

  10. Python 驱动 MongoDB 示例(PyMongo)

    Python 的MongoDB驱动 pymongo ,使用pip Install pymongo安装即可 最近发现网上的很多实例已经过时了,在此自我探究记录下来. 编写一个接口类来支持MongoDB的 ...