View Full Version : 64k spi eeprom

08-22-2005, 02:47 AM
I found some info on this chip :25LC640 here


The link to digikey shows many part numbers with 25LC640 most with non stock status

One in stock part number 25LC640-I/P seems to be the part number I am looking for It links to the same datasheet as the author in the link above.

So unless someone tells me otherwise I will buy 25 of then for 24 bucks.

Chris Savage
08-22-2005, 03:02 AM

·· How much storage do you need?· There may be a production part that can foot the bill.

Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

08-22-2005, 04:39 AM
Not sure yet, (hey Gates uses everything and more for his operating system no matter what size memory is installed eventually!)

I just never had any hands on experience with memory chips except for frying a motherboard once with the wrong chips http://forums.parallax.com/images/smilies/freaked.gif
I just want experience in working with IC Chips and that seems like a good place to start.

I found the info on the 8k chip but it says discontinued on the parallax site so I am still looking for any memory that will work.
I don't se any others on the parallax site.

Don't know what you mean by production part.

Bruce Bates
08-22-2005, 05:00 AM
metron9 -

Here is a web page listing for all of the Microchip Serial EEPROMs, using various access methods (I2C, SPI, Microwire, etc):

I'm sure they have what you want in stock, and thier datasheets are usually quite understandable. Their prices probably aren't much different than anyone else in small quantities.

Nearly any major chip manufacturer will have some sort of EEPROM offerings. If need to find a way to locate a resource for purchasing a chip number you like, you can use the free FindChips service here:
········ ·· http://www.findchips.com


Bruce Bates

08-22-2005, 07:39 AM
FindChips--- Very Cool....

Ordered them

Now about the hookup, I know what pins to connect but...

The datasheet is not showing the spaceing of the pins, I ordered the 25LC640-I/P PDIP package (no idea what it stands for yet P=PLASTIC d=DEVICE i=INTIGRATED P=?)
Anyway will this thing fit on the breadboard I have Basic stamp Homework Board or can you point me to solderless boards that it will fit?
I will retire to read my new book I picked up today "Programming and Customizing PICmicro Microcontrollers" by Myke Predko a bit over 1000 pages so I will be back in a few hours.

By the way , I know the C64 had 64k mem but there was an unused 4k area ( I think it was 4 k) starting at &HC000 That's where my IEA Assembler would put the code it generated. I used the basic editor and line numbers for the actual programming I wish I could find that code.. Hey I have my old file I just found it. I used the basic command line with a "." to communicate with the assembler running in the background. The .A command was Assemble hmmm Looks like I was reading the stream from the keyboard input, I even tab spaced the code as you could list it with the .L command. Brings back old memorys as my daughter was only 2, now she's third year at UofM.

Thanks again for the links...

Chris Savage
08-22-2005, 10:30 AM
We have several EEPROM chips available under our OEM parts section.· Please see the link below.


Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

08-22-2005, 10:42 AM

From what I have been told, PDIP stands for Plastic Dual In-Line Packages, and yes it will fit on the homework board's breadboard.


Bruce Bates
08-22-2005, 10:44 AM
Metron9 -

Although Myke's book "Programming and Customizing PICmicro Microcontrollers" is an excellent asset for learning about MicroChip PIC micro-controllers, it will only be marginally helpful in understanding the Parallax Basic Stamp per se. Two excellent books (PDF's actually) for the PBASIC Stamp which can be downloaded for FREE from the Parallax web site are: "What's A Microcontroller?" (often referenced as WAM on this forum) and the "PBASIC Stamp Manual", both of which contain a wealth of information about the Stamp platform. There are NUMEROUS other texts which can also be downloaded for FREE from the Documentation Section of the Parallax Web site as seen here:

You will come to learn over time that Parallax is a BIG believer in student/customer education, and they go out of their way to provide as much clear and concise documentation as is humanly possible, in support of the products they sell. There is also an entire segment of their business dedicated to EDUCATION, at elementary, high school, and college levels!

The underlying microchip which drives the earlier Stamp BS-1 and the Stamp BS-2 is indeed a pre-programmed MicroChip PIC micro-controller, but the Stamp user/programmer has little or no control of the hardware features of the PIC itself, and almost no control at a native code (assembler) level. Later versions of the Stamp have used the Ubicom SX series of micro-controllers as their basis. The latest incantation of the Stamp platform (the BS2px) is beginning to offer the programmer a limited amount of control over some of the hardware features. Parallax also offers a non-PBASIC but compiled Basic or assembler solution for using the Ubicom series of micro-controllers easily. More information about that solution and support can be found here:

The PBASIC Stamp also lacks direct access to the internal clock, as well as no integration with the built-in interrupt facility. Both have largely to do with the use of an interpretive language, as opposed to a compiled or asembled language. IMHO there are more rewards than setbacks, in opting for an interpretive language, as you will soon see. Ease of use, and a fast development cycle are two of the greatst features. There is also a much more gradual, and MUCH more enjoyable learning curve for those who are initially unfamiliar with programming, than those platforms which require internal knowledge of the processor, and/or those which require learning assembler.

The Parallax PBASIC Stamp is user programmed in an interpretive form of the Basic Language, which happens to be quite powerful in it's own right. The PBASIC Language interpreter is embedded on the Stamp module itself. Schematics of the various Stamp platforms are available both in the Stamp PBASIC Manual, and seperately on the Parallax web site. After viewing the schematics, you will see that it is a good deal more than just a MicroChip PIC sitting there. It's an entire mini-system built on a DIP male header which can be inserted right into a DIP socket just like any other chip. DIP refers to a Dual Inline Package, and PDIP refers to a Plastic Dual Inline Package, as you rather surmised.

If you have any other questions, just shout. There is generally someone on this forum 24 x 7 x 365. It may be a Parallax employee, or another confirmed Stamp user/programmer such as myself. We're all here to help each other with this wonderful educational and creative adventure, affectionately called "Stamping"! Welcome aboard, you're in for an enjoyable trip.

Finally, the Commodore 64, as well as the Apple, the TRS-80, et al, and later the IBM PC-1 and PC-2, were all personal micro-COMPUTERS, and as such had a vast array of internal, expandable program memory, add-on peripheral cards, expandable ROM/RAM memories, and attached external peripherals. A micro-CONTROLLER, of which the Parallax PBASIC Stamp is one example, have none of those features, but rather have feature sets of their own. Comparison between micro-COMPUTERS and micro-CONTROLLERS are ALWAYS short lived! It's an apples-to-oranges comparison http://forums.parallax.com/images/smilies/smile.gif


Bruce Bates

08-22-2005, 11:43 AM
I know I seem to be all over the map right now and that's to be expected as I usually jump in the deep end to see if I can swim. I have the WAM book as I bought the stamp last year from RadioShack, I also have skimmed thru most of the manuals online. As a programmer starting a new project I try and get an overall view of the full spectrum of what is available to do a task. I then sort out the details and make a final plan of attack. My sisters husband works on research and developement of medical devices to measure brain waves and bio feedback stuff. I had a short conversation with him today. For the task I am about to embark on he suggested moving into the (and I did not write it down) TI something and said it is used in cell phones. So far I love my basic stamp as I have learned alot in the short time I have played with it. *of course it sat on my desk from last year and I had to blow the dust off a few days ago, but I am full steam crash cramming information at this point but it's the way I learn stuff).

The reference to the c64 was adding to a comment I made in another thread (Light Bulb thread, I thought it was in this thread, should be in the introduce yourself topic threads i guess) I am not making any comparison between them I was just noting I used the memory in the system that was unused by the kernal and the basic interpreter, I read another post here from someone making a 6502 system so i just mentioned what I did with it 20 years ago.

Thanks for the detailed response as these forums are one of the reasons I picked the stamp to get started with in the first place.

I wanted to say, I really liked programming the c64, the z80 in my RS-TRS-80 but when windows came along I just could not keep up with the rapid change and lost interest in programming for quite some time. This stamp has rekindled my interest in both electronics and programming. Sometimes I try and move to fast though but I eventually get to the core however my brain has all interups on so I jump around quite a bit.

08-25-2005, 06:17 AM
Ok I just recieved my 25LC640 chips. Hooked one up and ran the demo program I found here:http://geocities.com/SiliconValley/Orchard/6633/EEPROM.html

Works great no problems, an extra 8,000 bytes of eeprom memory for $1.15

Question, If i wanted to hook up 4 chips would I need 3 BS2 pins for each chip or could I wire all 7 pins of 4 chips in parallel and use just one extra pin on the BS2 for each chip? I would think this is how it's done. If so, could you tell all the eeproms that data is comming, and since they all share the same data line they would all write the same data, giving you redundant data or if you are programming eeproms for use in other moduals for example you could write a dozen eeproms at a time?

Attached is the hookup for 1 chip to the BS2

Bruce Bates
08-25-2005, 06:41 AM
metron9 -

DI, DO and CLK will all be wired in parallel for the EEPROMs, as you suggested. A separate line, and pin port is used for the each of the /CS lines. All chips will see all the data transmitted. but only the chip with /CS active will actually use the information.


Bruce Bates

08-25-2005, 09:36 AM
Thank's Bruce.

I wired just the one simi permanente and added another work board that's a little bigger for my clumbsy fingers.

I have some 256k FRAM chips on the way, Found them for about 8 bucks but there the old bubble memory I guess
10 billion write cycles so you can use it like ram but of course the serial com is slow.

Just doing some experimenting to try and understand it a bit better...

It takes 30 seconds to write 2000 bytes,
Doing some timimg, I rem'ed the actual write shiftout and it still took 25 seconds so the actual write is not taking the time it's the setup and status that takes the time.

I see to write one byte 6 bytes of setup must be sent. At the 16kbits per sec 6 * 2000 = 12000 bytes to send at 2000 per second we have 6 seconds plus maby 3 seconds overhead on the pbasic side, so it takes the eeprom 20 seconds to write 2000 bytes of data.

Looking at the spec sheet it should take 5ms max to write a byte so 2000 * 5 =10,000 or 10 seconds max

So BS2 10 seconds in sending
eeprom 10 seconds writing
eeprom 10 seconds of setup communication before byte is written.

Is that about right?

08-25-2005, 11:59 AM
metron9 said...
[C]ould I wire all 7 pins of 4 chips in parallel and use just one extra pin on the BS2 for each chip?
You could.· Or, to save I/O pins, you could use an external decoder chip like the 74HC138 or 74HC139.· These will provide 4 or 8 active low outputs, only one of which will be low based on 2 or 3 input lines.· You'd probably need one additional output line to strobe the decoder.· Still, you'd only need 3 output lines to produce 4 chip select signals using half of a '139.

Don Kinzer


Bruce Bates
08-25-2005, 12:43 PM
metron9 -

You don't specify which Stamp platform your using for your timing considerations, so we'll look at the slowest version, the BS-2 below. Timing for the faster Stamp platforms can be extrapolated from that BS-2 calculation.

Additionally, you don't mention which specific EEPROM chip is under consideration in your calculations, so I'll presume you're speaking of the 256K Ramtron FRAM chip you last spoke of in your message. You do mention using a serial interface for the chip, but not which serial interface (2-wire or SPI), so I'll presume you're considering the faster of the two, which is the SPI interface, and also the interface which uses the /CS line we spoke of earlier.

Your calculations also do not take into consideration the manipulation of the /WP (write protect) line nor the time for setting the /CS line, either of which may or may not be necessary or required. Just keep that in mind when generating your final timing numbers.

Lastly, I have to respectfully disagree with your assessemnt that "I see to write one byte 6 bytes of setup must be sent". According to the FRAM datasheet, each memory write (regardless of the amount of data being written) MUST be preceeded by a WREN command (write enable). WREN = 8 bits or 1 byte, since it requires nothing but the op code to be written to the device. A memory write requires an 8 bit op code, 16 bits of addressing data, followed by a minimum of 8 data bits. So we end up as follows for one completed write cycle:

1. WREN (write enable) = 8 bits, 1 byte = op code (only)

2. WRITE (memory write) = 8 bits, 1 byte = op code
= 16 bits, 2 bytes = address
= 8 bits, 1 byte = data
40 bits, 5 bytes = total information transfer

Thanks to Dr. Tracy Allen, here is a table of BS-2 Basic Stamp instruction timings. Other Basic Stamp platform instruction timings can be extrapolated from those shown on this web site, as noted:

From that table we get the following general timing guidelines -

Simple one byte SHIFTOUT using LSBFIRST:
990 mS total instruction time, inclusive of the one byte transfer.

Simple two byte SHIFTOUT using LSBFIRST:
240 mS additional per byte transferred.

From that we can develop the following general formula:

Total BS-2 execution and data transfer time = 990 mS + (240 mS * (n - 1))
where "n" = total number of bytes.

I will leave the actual calculations to the reader.

One might tend to think that we must issue two SHIFTOUTs per EEPROM write access, due to the WREN then WRITE requirement. Since FRAM memories support zero wait states, I would be quite tempted to try and use only ONE SHIFTOUT command to perform a memory write, thusly:

wren_op con $06 'Op code for write enable
write_op con $04 'Op code for memory write
data_addr var word '16 bit data address (15 significant)
datum var byte '8 bits, one byte of data

SHIFTOUT cpin, dpin, LSBFIRST, [wren_op, write_op, data_addr, datum]

This will save you the overhead of one complete SHIFTOUT, at the mere expense of 8 bits of data transfer (the WREN command) prefixed to the memory write command. I would expect that to be successful, based on my reading of the FRAM datasheet. Your own mileage may vary http://forums.parallax.com/images/smilies/smile.gif


Bruce Bates

Chris Savage
08-25-2005, 09:27 PM

·· That sounds like an awfully long time.· Perhaps you should post your code so that we can determine if there's something else going on.· 2000 passes through a loop not writing data should take less than·2 seconds.· Reading memory, on a BS2 AND printing it to the DEBUG screen took almost 15 seconds.· Reading it and not writing it to the DEBUG screen took about 3 seconds.· Writing without DEBUG took about 5 seconds using the internal EEPROM.· It would take longer with an external EEPROM, but not that long.· BTW, all tests were using 2000 bytes from location 0 through 1999.

Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

08-26-2005, 02:40 AM
I am getting in over my head now I can see but to clear up some issues. I have 2 memory chips I am working with the 25LC640 is a thru hold .100 spaceing and I have made it work fine. The FRAM part number FM24C256-S its not EEPROM but its bubble memory I think they called it in the old days so says a chip designer that just happened to stop by my office today, a friend that flys RC Planes, anyway , I ordered -I/P and I don't know what that is but I thought it was thru hole mount)
So to stay on topic;

I am Using the BS2
I am Using the 25LC640 , not the FRAM chip I just got them this morning but there surface mounts (my second order of chips and I screwed up, I guess they dont make them in thru hole package size so now I have 4 of them and maby I can make a nice set of earrings or something because I have no idea how to mount something like this.

The program code, and all details on how to hook it up I got here:http://www.geocities.com/SiliconValley/Orchard/6633/EEPROM.html

From his code there are 6 writes per BYTE of code written. That's my starting point, if there is a better way please advise.
Snippiits From the code

gosub EEPROMreadstatus 'check to see if the EEPROM is busy
if EEPROM_Busy =1 then WriteEEPROM 'if its busy loop until its not
low CS 'tell EEPROM a transmission is coming
shiftout SerData,SerClk,msbfirst,[WREN_EEPROM] 'tell the EEPROM you want to 1 byte
'set the write enable latch
high CS 'tell EEPROM its done transmitting
low CS 'tell EEPROM a transmission is coming
'Tell the EEPROM you want to write to it, send the 16bit address to write to,
'and send a byte of data to write to that location
shiftout SerData,SerClk,msbfirst,[Write_EEPROM,Address\16,EEPROM_data\8] 2 bytes (the addresss) and 1 byte
high CS 'tell EEPROM its done transmitting

low CS 'tell EEPROM a transmission is coming
'send the command to EEPROM that a device wants to read the status register
shiftout SerData,SerClk,msbfirst,[RDSR_EEPROM] 1 byte
'return the byte containing the status of the read register
shiftin SerData,SerClk,msbpre,[Status_register\8] 1 byte
EEPROM_busy = Status_register
high CS 'tell EEPROM its done transmitting

so the read status sends one byte and then reads one byte
Then you set a latch sending 1 more byte
Then you send the address 16 bit number and the byte you want to store.

I just did some quick and dirty timing for example just doing 2000 read status gosubs and some others to get a quick idea what was taking time
Like I say I understand a tiny fraction of what I am doing, kinda like throwing a rock in a pool of water and saying hey it makes ripples, the depth of discussion that could flow from that simple act and the understanding of what the forces are and how they all interact spured great thinkers into learning how to split atoms.

So to sum up, I was able to buy a raw chip from a chip supplier, wire it up to the BS2 and store and retreive information from it. I am happy to have done that and I was looking forward to trying the FRAM chips 256kbits but like I say they are surface mount tiny critters, so small I need 2 magnifying glasses to read the info on them.

Is there a way for the low budget hobby hacker to mount these tiny bugs?
The chip is only 1/4 inch x 1/4 inch with 4 pins on each side. Probbly what they use on smart cards or something.

I am going to buy some potato chips on the way home, i know the brand I like.....

Chris Savage
08-26-2005, 02:52 AM
·· Not sure if that code could be optimized or not...It seems like you should not have to send the command and data separately, but maybe you do.· On another note the chip is 64Kb, essentially 8KB.· We have a 128Kb/16KB chip that is very easy to interface to the Stamp Module and can store more data.· You could check the link below.· It's a through-hole part as well...I could arrange a test to see how long it would take to write 2000 bytes to it.


Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

Paul Baker
08-26-2005, 03:08 AM
metron9 said...
I am getting in over my head now I can see but to clear up some issues. I have 2 memory chips I am working with the 25LC640 is a thru hold .100 spaceing and I have made it work fine. The FRAM part number FM24C256-S its not EEPROM but its bubble memory I think they called it in the old days so says a chip designer that just happened to stop by my office today, a friend that flys RC Planes, anyway , I ordered -I/P and I don't know what that is but I thought it was thru hole mount)
So to stay on topic;

FRAM stands for Ferroelectric Random Access Memory, bubble memory is extremely obsolete (the patent office has only received 1 patent application for bubble memory in the last 15 years and it is concerned with dumping the contents onto modern computer memory technology). DIP packaging itself is obsolete and is·primarily used by hobbyists and applications where easy removal from a circuit is a nessesary requirement, don't confuse obselescence with unavailibility because the two are correlated but not equivalent. As such new products are rarely released in DIP packaging, and FRAM is the cutting (but not bleeding) edge of computer memory technology. Fortunately SOIC is the easiest of SMT packages to work with (actually SOJ, the surface mount version of DIP is, but SOIC is the second easiest), sparkfun (http://www.sparkfun.com/shop/index.php?shop=1&cat=66&) has adapter boards to convert SOIC chips into a DIP format. I literally can solder an 8-SOIC held in place with tweezers to a board with my eyes closed (well technically, I turned my attention towards the television while soldering a part to look back down and be suprised the joints were perfect). Don't be intimidated by the prospect, yes it is a little more difficult than working with thru hole components, but the skill will become increasingly nessesary in the future as DIP parts become more and more difficult to find.


Post Edited (Paul Baker) : 8/25/2005 8:11:31 PM GMT