4
\$\begingroup\$

I'm a beginner with Arduino. I'm reading a book called Practical AVR Microcontrollers: Games, Gadgets, and Home Automation with the Microcontroller Used in the Arduino.

From the beginning, the book speaks about the AVR programmer. It says that the way to communicate and send code / compile code for the Arduino is by connecting your computer to the AVR programmer and then the AVR programmer to the Arduino.

The book is several years old so maybe things have changed. Do I need to have this extra component called the AVR programmer?

\$\endgroup\$
10
\$\begingroup\$

An Arduino is not an AVR. AVR is a family of microcontrollers made by Atmel, which includes 8-bit and 32-bit microcontrollers. Most common Arduino boards (UNO, duemilanove, etc.) use the ATMEGA328p, and new ones like Leo use the ATMEGA32u4 which is also in the AVR family. Arduino is a hardware and software platform built with an AVR. It sounds like your book is about the AVR and is referencing Arduino to draw attention. It's about Arduino as much as a book entitled "Practical Physics. Fun Physics experiments in the same field studied by Sheldon in The Big Bang Theory" is about Sheldon Cooper.

If you have just an AVR, you need something to program it. The most common way is through In-Circuit Serial Programming, or ICSP. Usually this is a 6 pin .100" pitch header. There are devices out there that speak this protocol on one end, and USB on the other. Atmel's AVRISP mkII is an example. There are many alternative products which do the same thing. This is what people often mean when they say "AVR programmer".

The Arduino platform canonically includes the same functionality that is in a device like the AVRISP mkII so that the AVR in the Arduino can be programmed with nothing more than an ordinary USB cable and the Arduino software. If your Arduino has a USB port on it, this is almost surely the case, and you do not need an extra AVR programmer. You just need a USB cable.

There are Arduino variants that omit this component to reduce cost. These Arduinos don't have USB ports. Instead, they have the ICSP header or something similar, and the electronics that would have been present on other Arduinos are instead available in a separate cable or device.

To summarize, if your Arduino has a USB port, you probably do not need an additional AVR programmer, because the programmer is on the Arduino. If your Arduino does not have a USB port, you probably do need an AVR programmer.

If you buy, for example, an ATMEGA328p and put in your Arduino board, it will not work, because it has to be programmed with the bootloader and appropriate fuses to work properly. This programming is done using the ICSP interface by the AVR programmer. This needs to be done just once, after this you can use it to upload sketches.

\$\endgroup\$
  • 5
    \$\begingroup\$ One minor correction to Phil's answer: there is not technically a "programmer on the Arduino". What the Arduino does is, when powered up or after a reset, it first starts a small program called a bootloader. This bootloader waits for a few seconds to see if any reprogramming of the microcontroller is required, and it does that with a very standard UART serial connection. If not it simply starts your main program (called "sketch" in Arduino terms). This only works if/because the microcontroller on the Arduino is preloaded with the bootloader. \$\endgroup\$ – fm_andreas May 30 '13 at 20:04
  • \$\begingroup\$ Arguably the bootloader is a "programmer" - and it talks essentially the same protocol as common programmers used to load code into separate devices. The distinction is that instead of using ISP or high voltage parallel programming, or whatever scheme, it uses the ability of software running on the chip to program its own internal flash and/or eeprom. \$\endgroup\$ – Chris Stratton May 30 '13 at 21:13
  • 1
    \$\begingroup\$ @Phil Frost fm_andres is correct. I think you better edit the post. \$\endgroup\$ – Standard Sandun Oct 11 '13 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.