Saturday, 9 March 2013

An AVR EEPROM parallel programmer

My 6809 Single Board Computer will need, at least, the following:
  • A CPU
  • Some RAM
  • Some ROM
  • Some I/O devices
While there are other options for somewhere to hold a core set of routines*, the traditional method is with a ROM.  But a ROM needs to be loaded with code via a programmer.

For the ROM a 28C256 is a nice choice.  It is easily programmable using ordinary TTL voltages, and has enough capacity (256Kbit or 32Kbyte) to hold all the 6809 code I could write.  In fact, it is unlikely that I will want to use all the address lines.  One downside of the 28C256 is they are expensive; about £9 off ebay.

The IC isn't any use on its own - it is needs to be programmed!

There are a few ways to implement a EEPROM programmer.  Some people have bodged one together using a parrallel port and some shift registers for generating address lines.  But my preferred option, because it is more interesting, is to use a microcontroller.  After talking to various people about this project, the MCUs made by Atmel sound like the best choice.

Rough specification for an AVR ATMEGA8:
  • 8KByte Flash
  • 2KByte RAM
  • UART
  • Timers
  • Built in RC oscilator
  • TTL I/O ports
  • Some ADCs
  • Easily programmable over USB
  • Programmable in C
  • And various other cool things
All in a 28 pin DIP package.

After considering various options, the rough block diagram for my programmer is:


The ATMEGA8 communicates with the PC via good-old-fashioned RS232.  In turn the ATMEGA8 is directly connected to the EEPROMs databus in both directions - write for programming and read for verifying that the data has been saved.  Control lines for output enable, write mode, and chip enable are also connected directly to the ATMEGA8.  The address line handling is perhaps the most interesting aspect of this design.  Because the ATMEGA8 does not have enough output lines to form the whole address bus (this would require 15 independent lines), the address bus is instead formed from the outputs of a counter.

This is possible because the ROM is programmed sequentially, ie. one byte after another along the address space.  If random access to the ROM was required, this would not work.  The counter circuit is clocked (ie. the address bus is advanced to the next byte) and reset (back to zero) by the microcontroller.

To handle the serial comms, a simple command set is needed to write bytes, read bytes, advance the counter, reset the counter, and so on.

In my next post I'll include the full circuit diagram and some pictures of the programmer actually doing its thing.

* Using a microcontroller to populate RAM at startup, whilst the CPU is temporarily halted, is one other option.


No comments:

Post a Comment