Electronics
Btrieve
Motorcycling
Software

Progamming tool for 28C256 EEPROM

Hardware

As the page writes and special command have 150uS timeouts on write cycles, using the 4040 counter for address is not possible and microcontroller with sufficient I/O pins had to be used. I stock only ATmega1284P devices at home, but any device from that family will work because the actual code and its memory requirements are quite small.

For host interface, FT232R based USB to serial converter module from eBay is used, R1 ensures that no glitches occur on /WR signal while the microcontroller is initialized or programmed. The status LED is just showing the status of hardware handshake line on serial port.

Software

All the code is available at GitHub, in my 28c256pgm repository. For building you need a working make, avr-g++, and avrdude. I have only built the project on OSX, but the makefile shohuld directly work on Linux too.

Building

Just type make, and you should get hex and eep files. make flash will try to write the code to microcontroller using avrdude with usbtiny compatible programmer. make clean will clean the clutter from directory, and make erase will try to erase microcontroller's flash memory.

Firmware code contents

The firmware has read,write,erase,lock, and unlock commands. The EEPROM writes are implemented as page writes where all bytes of the received intel HEX row are programmed at once. To further optimise writing speed, the contents of the EEPROM are first compared to received line and no programming is done if the EEPROM already has the wanted content for entire row.

Erasing the entire EEPROM is quick, as the device supports bulk erase by onlt writing 6 bytes to it. In case this fails for some reason, there is a fallback that tries to erase by actually overwiting all bytes that are not 0xff already.

As the writing is relatively slow, hardware handshake is implemented for the serial port. Note that this is not used for the programming tool, as the tool waits for each row to be written to check for the write failures.

Lock and unlock are special commands that basically write-protect and write-enable the device. Note that bulk erase still works even if the device is locked.

A quicker content verification would be possible by calculating CRC over entire device content, but as this will not tell where the difference is, reading the contents would still be needed. Thats why verification is implemented using the read command in the programming tool.

Programming tool

I created a GUI programming tool using tkinter in Python3. tkinter should come preinstalled with Python, but you do need to install pyserial package with pip3. I've used it only on OSX, but it should work on other platforms too.

Intel HEX and binary are the supported file formats, file names ending with .hex are considered Intel HEX, all others are handled as binary. On file loads all unused space is filled with 0xff.

Erasing the device does not affect buffer contents.

You can modify buffer contents by clicking on the first byte that you want to change, then entering one or more bytes separated by spaces. Hexadecimal numbers need to be prefixed by "0x" and you can also enter text words by prefixing the text with "'". As space character is used as separator, the text strings cannot contain spaces. You need to enter something like "'Hello 32 'World" if you want to include a space character.

Writing is done in 16 byte increments, each sent as separate HEX row. For speed, the tool implements a write optimisation by always bulk erasing the entire device before writing, and then skipping the rows that only contain 0xff. This makes writing partially filled device faster.

.

Copyright © Madis Kaal 2000-