Pfad:
Home =>
AVR-english =>
Beginner => Hardware
(Diese Seite in Deutsch:
)
Hardware for AVR-Assembler-Programming
Learning assembler requires some simple hardware equipment to test your programs and see, if
it works in practice.
This page shows two easy schematics that enable you to homebrew the required hardware and
gives you the necessary hints on the required background. This hardware really is easy to build.
I know nothing easier than that to test your first software steps. If you like to make more experiments,
leave some more space for future extensions on your experimental board.
If you don't like the smell of soldering, you can buy a ready-to-use board, too. The available
boards are characterised on this page below.
To the top of this page
Before going into practice, we have to learn a few essentials on the serial programming mode
of the AVR family. No, you don't need three different voltages to program and read an AVR
flash memory. No, you don't need another microprocessor to program the AVRs. No, you don't
need 10 I/O lines to tell the chip what you like it to do. And you don't even have to remove
the AVR from your experimental board, before programming it. It's even easier than that.
All this is done by a build-in interface in the AVR chip, that enables you to write and read
the content of the program flash and the built-in-EEPROM. This interface works serially and
needs three signal lines:
- SCK: A clock signal that shifts the bits to be written to the memory into an internal shift
register, and that shifts out the bits to be read from another internal shift register,
- MOSI: The data signal that sends the bits to be written to the AVR,
- MISO: The data signal that receives the bits read from the AVR.
These three signal pins are internally connected to the programming machine only if you
change the RESET (sometimes also called RST or restart) pin to zero. Otherwise, during normal
operation of the AVR, these pins are programmable I/O lines like all the others. If you like to
use these pins for other purposes during normal operation, and for in-system-programming,
you'll have to take care, that these two purposes do not conflict. Usually you then decouple
these by resistors or by use of a multiplexer. What is necessary in your case, depends from
your use of the pins in the normal operation mode. ou're lucky, if you can use them for in-
system-programming exclusively.
Not necessary, but recommendable for in-system-programming is, that you supply the programming
hardware out of the supply voltage of your system. That makes it easy, and requires two additional
lines between the programmer and the AVR board. GND is the common ground, VTG (target
voltage) the suplly voltage (usually 5.0 volts). This adds up to 6 lines between the programmer
and the AVR board. The resulting ISP6 connection is, as defined by
AMEL, shown left.
Standards always have alternative standards, that were used earlier. This is the technical basis
that constitutes the adaptor industry. In our case the alternative standard was designed as ISP10
and was used on the STK200 board. It's still a very widespread standard, and even the STK500
is still equipped with it. ISP10 has an additional signal to drive a red LED. This LED signals that
the programmer is doing his job. A good idea. Just connect the LED to a resistor and clamp it the
positive supply voltage.
To the top of this page
Now, heat up your soldering iron and build up your programmer. It is a quite easy schematic
and works with standard parts from your well-sorted experiments box.
Yes, that's all you need to program an AVR. The 25-pin plug goes into the parallel port of your PC,
the 10-pin-ISP goes to your AVR experimental board. If your box doesn't have a 74LS245, you can
also use a 74HC245 or a 74LS244/74HC244 (by changing some pins and signals). If you use
HC, don't forget to tie unused inputs either to GND or the supply voltage, otherwise the buffers
might produce extra noise by capacitive switching.
The necessary program algorithm is done by the ISP software, that is available from
ATMEL's software download page, by PonyProg2000 or other
programmer software. Please be aware that the programmer software must support your device
type.
To the top of that page
This is a very small board that allows experiments with the ATtiny13's internal hardware.
The picture shows
- the ISP10 programming interface on the left, with a programming LED attached via a resistor of
390 Ohms,
- the ATtiny13 with a pull-up of 10k on its RESET pin (pin 1),
- the supply part with a bridge rectifier, to be supplied with 9..15V from an AC or DC source,
and a
- small 5V regulator.
The ATtiny13 requires no external XTAL or clock generator, because it works with its internal
9.6 Mcs/s RC generator and, by default, with a clock divider of 8 (clock frequency
1.2 Mcs/s).
The hardware can be build on a small board like the one shown in the picture. All pins of the
tiny13 are accessible, and external hardware components, like the LED shown, can be easily
plugged in. This board allows the use of the ATtn13's hardware components like I/O-ports,
timers, AD converters, etc.
For test purposes we use a AT90S2313 or its compatible and more modern ATtiny2313 on an
experimental board. The schematic shows
- a small voltage supply for connection to an AC transformer and a voltage regulator 5V/1A,
- a XTAL clock generator (here with a 10 Mcs/s, all other frequencies below the maximum for the
2313 will also work),
- the necessary parts for a safe reset during supply voltage switching,
- the ISP-Programming-Interface (here with a ISP10PIN-connector).
So that's what you need to start with. Connect other peripheral add-ons to the numerous free I/O pins
of the 2313.
The easiest output device can be a LED, connected via a resistor to the positive supply voltage.
With that, you can start writing your first assembler program switching the LED on and off.
To the top of that page
If you do not like homebrewed hardware, and if have some extra money left that you don't know what
to do with, you can buy a commercial programming board. Easy to get is the STK500 (e.g. from
ATMEL. It has the following hardware:
- Sockets for programming most of the AVR types,
- serial und parallel programming,
- ISP6PIN- and ISP10PIN-connector for external In-System-Programming,
- programmable oscillator frequency and suplly voltages,
- plug-in switches and LEDs,
- a plugged RS232C-connector (UART),
- a serial Flash-EEPROM,
- access to all ports via a 10-pin connector.
Experiments can start with the also supplied AT90S8515. The board is connected to the PC
using a serial port (COMx) and is controlled by later versions of AVR studio, available from
ATMEL's webpage. This covers all hardware requirements
that the beginner might have.
To the top of that page
©2002 by http://www.avr-asm-tutorial.net