home index sites engineering software hardware email
 

AVR Microcontroller


Atmel AVR

AVR == 8-bit 'micro' dream


Are you looking for a highly integrated, low-cost micro with lots of features and GCC support? If so, then look no further than the Atmel AVR 8-Bit RISC.

Although my personal expertise, and experience lies mostly with 32-bit processors (mostly PowerPC, ARM7, Coldfire and TI DSPs) I still have the need, and the pleasure of working with the AVR. I started my embedded programming career with the 8-bit Intel 8748 (pre-8051 family), so it's kind of ironic that umpteen years later I still design with an 8-bit micro like the AVR! ;)

Never have I worked with such an easy to use, and highly integrated micro. The megaAVR (higher end AVRs) contain (up to) dual full duplex UARTs, SPI, I2C, 10 bit ADCs, multiple timer/PWMs, 4 kBytes of RAM, 4 kBytes of EEPROM, 128 kBytes of Flash, external bus interface, JTAG debugging and in-service programming all in a nice, tight package. Also included are reset and R/C oscillator circuitry, which means you can boot an AVR without any external components - just provide power and away you go (bypass caps and reset filter are recommended)!

Want more good points? How about a supported GCC and libc port (there are numerous commercial tools as well)! To boot, there is a very large community of AVR hackers, so if you ever run into problems, chances are someone can help you out.

AVR GNU development tools under Linux


Needless to say I develop under Linux. Below you will find the build script that I created to compile and install the GNU binutils, GCC C compiler, libc and Insight/GDB debugger for the AVR micros under Linux (windows users can use WinAVR, also available at AVR Freaks). I am using Gentoo and Debian Linux, however this script should work for almost any Linux, or UNIX system for that matter. Also included below are links to the necessary source tarballs needed by the script.

To start developing with AVR under Linux simply download all of the following files, then run the build script buildavr.sh. I (currently) only develop with the AVR using C, so the script will only build the C capable GCC (it's easy to modify it to support C++). Warning: this script now builds the 1.2 series of avr-libc, not the version 1.0 variants! In addition, I patch both binutils and GCC to support some of the new AVR devices (like the mega88), patches are included below:


Of course, actually writing code for the AVR is a completely different matter! If you are new to the AVR, or GCC in general then you should first consult one of the following guides:


Programming and debugging the AVR


There are several ways to program AVRs.

Under Linux I currently use a tool called 'UISP' to program AVR devices via the 4 pin ISP interface. UISP requires some hardware in order to bit bang the ISP pins on the AVR (you can use the STK500 or STK501 development boards). I personally use a Xilinx Parallel Cable-II JT-40594 (originally designed to program CPLDs and FPGAs, yet is basically just a parallel port I/O interface). I have also used the Atmel programmer called the 'AVR ISP', which is a deal at only $29 USD.

Under Windows you can program an AVR via ISP using a variety of tools, including those mentioned for Linux.

Another method of programming, and debugging AVRs is via the JTAG port. Under Linux you can use 'AVaRICE', in combination with your favorite debugger (I personally like GDB/Insight). Under Windows you can use the Atmel IDE called 'AVR Studio 3' (or 'AVR Studio 4'). Each of these requires the $299 USD 'AVR JTAG ICE' POD to connect to the target.

Another JTAG based programming method uses the free tool from Atmel called 'AVRSVF' which generates Serial Vector Format (SVF) files that can be used as input to many common JTAG programmers and ATE testers (although I haven't used this).

Happy AVR'ing!


This site is a member of WebRing.
To browse visit Here.