24Cxx, 93Cxx and 25xxx Serial Eeprom programmer Specifications: * Support 24C01, 24C02, 24C04, 24C08, 24C16 I2C Bus EEPROM * Support 24C32, 24C64, 24C65, 24C128, 24C256, 24C512 I2C Bus EEPROM * Auto detect 24XX EEPROM capacity * Support 24C325 and 24C645 I2C Bus EEPROM * Detect the bank roll over capability of some old 24XX EEPROM.
Home | Products | Teensy | Blog | Forum |
You are here:8051 ToolsCode LibrarySerial EEPROM |
| Don't like reading docs, why not justSkip Down to the Code?ContentsWhat is it, Why use a serial EEPROM?Serial EEPROMs are small Electronically Erasable ProgrammableRead Only Memory chips. These devices are usually used to storeuser configurable parameters and device serial numbers. Theyuse a serial bus interface, which allows them to be packagedin inexpensive 8 pin packages.To you, the 8051 system designer,these little chips offer a nifty way to store a small amount ofdata in non-volatile memory, using only a few of the port pins,and without raising the system's cost much. They are usuallyspecified to retain the data for 10 years and to endure 100,000write operations before failure. They only require a 5 volt powersupply (some 3V only versions exist too). Because these chips use a serial interface, they can notbe read quickly enough to serve as conventional memory. In addition,a considerable length of time (milliseconds) is required to performa write operation. They typically hold less than 1024 bytes ofmemory. However, they usually cost less than $1.00 (US) forsingle piece quantities, making them pretty desirable memorydevices for storing configuration parameters or other bits ofinformation that should be retained when the power is lost. Types of Serial EEPROM ChipsThere are several types of Serial EEPROMs, but most of them fall intoeither a 2-wire or 3-wire interface category. Usually, the 3-wiredevices require an addition wire (beyond the 3 for data transfer) foreach chip to be used. The 2-wire interface, called I2Cor IIC or 'I squared C' uses only two wires, regardless of how manychips are attached. I2C is a trademard ofPhilips. Thethree wire interfaces include SPI and Microwire, which is a trademarkof National Semiconductor.As the pressure on engineers to make products smaller has grown,semiconductor manufacturers have introduced several new interfaces,usually aimed at lower a product's size and cost... and undoubtedlymany more will appear in the future. As a practical matter, the code offered below only works withthe Microwire 3 Wire interface, and is specifically intended towork with the 93C46, which is a standard part available from avariety of distributors. Where to get a Serial EEPROM?The code below works with the 93CS46 Serial EEPROM. It can be usedwithout much difficulty with a 93C46, by avoiding calls to theroutines that manipulate the extended features of the 93CS46.ManufacturersAtmel has data sheets on-line formost of their EEPROM and microcontroller products. They have also addedexample 8051 code similar to the code below, as well as for I2Cparts they offer.National Semiconductor has lots ofdata sheets on-line. I used their93CS46 data sheetto write the code.Their literature number is800-272-9959... or at least is was some time ago when I put their stickeron my phone. MicroChip now has data sheetson-line for most of their products. They offer the 93C46, as well asa variety of other EEPROMs. SGS Thompson made the chips Iused when I wrote this code. I used the National datasheet to writethe code, but the SGS Thompson parts worked flawlessly.They offer quite a few different typesof serial eeproms, including of course the 93CS46 and 93C46. Xicor offers 2-Wire interfaceand SPI interface serial EEPROMs, but apparantly nothing which willwork with the code below. Xicor once had a considerable collectionof example code on-line, but they appear to have removed it. DistributorsWithin the United States, the easiest way to get ahold of a 93C46 isto callDigiKey800-344-4539 (MicroChip, maybe National) orMouser Electronics800-346-6873 (SGS Thompson). Both have aminimum order, appox $25, and these serial EEPROMs are only about$1 each. There are lots of other distributors too, but Mouser andDigiKey are probably the easiest, since they give out a free catalogWhat this 8051 family code doesThis code was written to support the 93CS46. This 3-Wire interfacechip actually has 6 wires. As mentioned above, four wires areactually required, and the 93CS46 has two additional lines that worktogether with a special write protection register. This codeshould work 'out of the box' with a 93CS46 chip.Compability with other 3-Wire serial EEPROMsThe 93C46 chip should be usable, but care should be taken not tomake calls to the functions which access the protection register withinthe 93CS46. The two extra pins not required for the 93C46 aremanipulated by all the routines. To reclaim these pins, remove allthe instructions that use 'pe ' and 'pre 'symbols. A simpler approach may beto set the bit addresses of these bits in the .equ statements toa bit within the 16 byte bit-addressable space, or perhaps one ofthe general purpose flag bits in the PSW, if you're not using it.It's up to you.I might make another version of the code specifically for theplain 93C46, if anyone wants it enough tolet me know. Please explainthe difficulty you have using the code with a 93C46 (or the troubleyou think you may have).Early versions of this code worked with the 93C56 and 93C57, whichhave more memory. Unfortunately, these chips use an 8 bit addressfield, whereas the 93C46 uses only 6. The code can be adapted towork with these larger chips... good luck. The early versions arelong since gone.. they were buggy anyways. The code is basically designed to manipulate a single 93CS46 chip,connected to six of the port pins. Two versions of the code areavailable, one with a little menu driven user interface (via aterminal connected to the UART) and the other with only theroutines to include in your existing program. The user interfaceis simple and shouldn't need documentation. The routinesavailable for your code are: Routines for both the 93C46 and 93CS46
Routines specific to the 93CS46 chip
It is not necessary to erase memory locations before writing. Theerase functions provided in the 93C46 are unnecessary (for the chipsI've used, double check your data sheet). The erase functions arenot implemented here. DisclaimerThese 93C46 Serial EEPROM devices are used in many commercial productswhere the data contained within the chip, though only 128 bytes,is considered confidential and proprietary. This code library maynot be used to 'break into' the data stored within devices incommerical products. Use of this code library to modify the behaviorof commercial products, without the expressed written authorization ofthe manufacturer, is also prohibited. (e.g. modifing ethernet cardhardware addresses, etc)Of course, I, Paul Stoffregen, give no warranty, expressed or impliedfor the software and/or documentation provided, including, withoutlimitation, warranty of merchantability and fitness for a particular purpose. On a lighter note, I have tried to provide you with a ready-to-run93CS46 interface library, which I hope you will find useful as adesign component in your own 8051 based projects/products. Thiscode library is in the public domain. You are free to use it withinyour projects/products. You may use it within commercial for-profitproducts, without concern of licensing restrictions, copyright, royalties, etc.If you do use it, I hope that you'llgive me some feedback. Files to Download |
![93c56 93c56](/uploads/1/2/5/8/125872241/734879146.jpg)
http://www.pjrc.com/tech/8051/serial-eeprom.html
Last updated: February 24, 2005
Status: complete
Suggestions, comments, criticisms:<[email protected]>PonyProg now works with several hardware interfaces. Choose the one you prefer and try it.
SI Prog (Serial port Interface for PonyProg)
The official PonyProg hardware interface. It works with all devices supported by PonyProg. Look here to buy it.
SI Prog schematics
SI Prog kit
SI Prog kit
AVR ISP (STK200/300) parallel port interface
The best way to perform AVR ISP programming. It works even in low voltage systems (3V). To select it choose 'AVR ISP I/O' or 'AVR ISP API' from the Options - Setup menu and the parallel checkbox.
You can connect directly to the target system (ISP) through the 10 pin connector, alternatively you can connect a PonyProg adapter card for AVR, AT89S, SPI eeproms, microwire eeproms and feed external power to the device.
'AVR ISP API' on Linux version need the parport, parport_pc and ppdev kernel modules.
On WindowsNT/2000 you have to select 'AVR ISP I/O'.
Note that this interface doesn't support I²CBus devices, use the SI-Prog or EasyI2CBus interface instead.
You can connect directly to the target system (ISP) through the 10 pin connector, alternatively you can connect a PonyProg adapter card for AVR, AT89S, SPI eeproms, microwire eeproms and feed external power to the device.
'AVR ISP API' on Linux version need the parport, parport_pc and ppdev kernel modules.
On WindowsNT/2000 you have to select 'AVR ISP I/O'.
Note that this interface doesn't support I²CBus devices, use the SI-Prog or EasyI2CBus interface instead.
The STK200/300 official dongle is provided by Kanda.
AVR ISP with STK200/300 pinout (connect it to STK200/300 eva board)
Click here to enlarge
Click here to enlarge
AVR ISP with SI-Prog pinout (connect it to SI-Prog adapter boards)
Click here to enlarge
Click here to enlarge
Ludipipo and JDM interface
PonyProg support ludipipo and JDM interface to program PIC16x84. To select it choose 'JDM I/O' from the Options - Setup menu and the serial checkbox. If you use Linux or experiment problems select 'JDM API'.
JDM schematics
How to connect 24Cxx eeproms to JDM programmer:
How to connect 24Cxx eeproms to JDM programmer:
Easy I²C Bus interface
To select it choose 'Easy I2CBus' from the Options - Setup menu and the parallel checkbox.
'AVR ISP API' on Linux version need the parport, parport_pc and ppdev kernel modules.
On WindowsNT/2000 you have to select 'AVR ISP I/O'
'AVR ISP API' on Linux version need the parport, parport_pc and ppdev kernel modules.
On WindowsNT/2000 you have to select 'AVR ISP I/O'
Click here to enlarge