All You Need To Get Started with Atmel AVR 8-bit RISC Micro controllers (MCU) Using An AT90S8535

Last update: 20-Mar-2000

picture of a SIMM100 with an AT90S8535 installed
[Picture shamelessly stolen without permission from the SIMM100 page.]

The aim of this page is to be a guide to the quickest way to get from ground zero to a useful working construction in the least amount of time and money [estimate total cost ~$25].
The motivation for this page came from the personal observation that there are many very good AVR pages around, but none uniquely focused on getting the newbie from ground zero to a working project in the least amount of time and money.  This page is very explicit about not listing every option possible, but only a carefully selected subset that has proven successful to the author.

No real attempts is made to motivate the use of AVRs.  The mere existence of these pages should be taken as an token of appreciation.

The AVR Micro controller

The Atmel AVR is a family of 8-bit RISC-like MCUs.  They have a number of nice properties making them particularly easy to work with, especially compared to PICs: Sane, register rich architecture, one instruction per clock (for most instructions), flash based, programmed in system.  There are many other sites that will explain better the advantages of AVRs.

For a starters project taking the most powerful version of the family first will provide with the richest experience.  The AVR AT90S8535 is the current top of the line in the AVR family.  A few highlights from the AT90S8535:

The full detail is available in the fine Data Sheet (2.7 MB, 113 pages).

The Hardware Platform

To get up and running in the least amount of  time and hassle I strongly recommend using a pre made (pre tested) PCB. I found the SIMM100 to be wonderful suited as it's very flexible, fairly cheap, and of very high quality.  It can be used for standalone applications or used with other SimmSticks. You can SIMM100 and AT90S8535 from Dontronics in Australia or Lawicel in Sweden (I'm not affiliated with either, just a happy customer). Do not underestimate the value of using a tested board, compared to making a breadboard or other.  Especially when starting you'll want to minimize the things that can go wrong. For an even faster approach you could consider Atmels AVR start kit, the STK200. [link]

Assuming you go with the SIMM100, configure it with at least the XTAL, ISP connector, the three leds, and all their support components.  Including the voltage regulator might also be a good idea if 5V isn't readily available.  There is much more detail available on the SIMM100 page.

One thing to keep in mind when connecting things to the pins of the AVR is that for In System Programming (ISP) to work even with stuff connected, the MOSI, MISO, and SCK pins must be connected to an input device, that is, must be configured as outputs in normal operations.  On the AT90S8535 used in this project (and if I'm not mistaken all of the AVRs), these pins corresponds to PB5, PB6, and PB7 (the three highest bits of port B).

The Programmer

The Atmels are really simple to program in-system, so include an ISP connector and forget the tiresome swapping chips between programmer and application.  All AVR applications should include an ISP connector.  There are two common connectors for the ISP, but the following is compatible with the official AVR ISP dongle and is what the SIMM100 board expects:

1 MOSI2 +5V
3 Prog on4 GND
5 RES6 GND
7 SCK8 GND
9 MISO10 GND
Bottom view of the ISP connector

Notice, that the application should be powered while being programmed (the programmer doesn't supply power).

The simplest and cheapest programmer use just the parallel port of the PC and is trivial to make with snapon connectors (adapted from Alexey Lapshin and Sergey Larins simple AVR programmer):

          Connect AVR with parallel port
    ISP connector                 Parallel Port
   Signal name   Pin             Pin  Signal name
   MOSI           1 ----\/\/\---  2   Data 0
   GND            4 ------------ 19   GND
   Reset          5 ------------ 16   Init
   GND            6 ------------ 21   GND
   SCK            7 ----\/\/\---  1   Strobe
   MISO           9 ----\/\/\--- 11   Busy

This scheme works with all parallel port modes (EPP,ECP, classic).
Copyright (C) 1998 by Alexey Lapshin and Sergey Larin.
This scheme can be modifyed as described in send_byte.s
It works nicely under Linux with uisp (read below), but there is no software support for Windows. The only drawback of this simple programmer is that it, unlike the ISP Dongle (mentioned below), doesn't have the software controlled connections to MISO, SCK, and MOSI, thus might interfere with what ever is connected to these pin, even when not programming.  For this this reason I've added 1K resistors and patched uisp to leave the outputs high.  With this in place, I haven't had any problems.  [Picture of my version].

The "official" AVR programmer is the ISP Dongle that also connects to the printer port.  Claudio Lanconelli has the schematics for a cheap and reliable clone that can be build quickly, but beware that the ISP connector is wired wrongly in his diagram.  If it is to be compatible the SIMM100 platform (and the STK200 starters kit), it must be wired as according to the the description given above.

The Software

Windows

Even if you expect to use Linux for any serious development, some might prefer to use the standard Windows tools to verify initially that the board and programmer is working properly.  Start by installing the AVR ISP Software. If you can flash you board with the following small demo test.mot and the leds subsequently blinks, then you have a working board and programmer!

To develop under Windows, the standard Atmel assembler might suffice.  There is also a windows version of the AVR GCC C Compiler, but I have no experience with this.  It look like the most current stuff (as of Marts 16th, 2000) can be found at http://www.gwdg.de/~mrickma/avr.

Linux

For any serious development, I'd recommend using Linux and programming in C. Denis Chertykov has extended GCC with support for the AVR (known as the AVR GCC, included in future official GCC distributions).  The AVR GCC works really well, but it can be very hard to find the mix of latest releases and set up the tools as they are scattered out over the web and partly in the mailing list. Most of it could be found at the Micro Tools for Linux page and at http://www.gwdg.de/~mrickma/avr.

[Include links to examples with code snippets for LCD (lcd.h, lcd.c, test_lcd.c), keyboards (keymatrix.h, keymatrix.c, test_kbd.c. I've just discovered that AVR240 a similar method, but IMHO it's vastly harder to understand.), serial, ibm-pc keyboard, I2C, Hall-effect sensor (trivial), servos, CNC controller, the onboard ADC, the gameboy camera, ...

AVR's application notes are full of valuable examples and information. Don't miss it!

The Microchip's PIC application notes is also a valuable source of good idea, most of which can be adapted to the AVR with a much nicer result.]