6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Wed Apr 24, 2024 1:12 am

All times are UTC




Post new topic Reply to topic  [ 269 posts ]  Go to page 1, 2, 3, 4, 5 ... 18  Next
Author Message
 Post subject: 28Cxxx EEPROM Programmer
PostPosted: Fri Apr 05, 2013 8:38 pm 
Offline

Joined: Mon Mar 25, 2013 9:26 pm
Posts: 183
Location: Germany
Hello everybody,

I hope this is the right place for this topic. In preparation for my own homebrew 6502 system I need a possibility to write data on a 28C64 or eventually the 28C256 EEPROM. I'm quite familiar with the AVR ATMega micro-controllers, especially with the Arduino boards and so I decided to build my own programmer based on the Atmega328 µC.
Image
The 28C64 and 28C256 are 28 pin DIP chips and have up to 14 address lines (28C256). I also need 8 data lines and 3 additional lines for /WE, /OE and /CE. The programmer should be used by a serial connection, so I need 2 more lines for RX and TX.
Image
In sum 27 lines. My preferred µC has only 20 GPIO pins that seems to be too less for my programmer. But for the address-lines I only need output and no input lines so I can use two 74HC595 shift register to get up to 16 address-lines with only 3 GPIOs used on the µC.

To be sure that everything works as expected, I first build up everything on a breadboard. Additionally I created a simple “16 bit line-sniffer” with 16 small LEDs and two ULN2803 darlington drivers to protect the “sniffed” bus from too much current consumption.

The first thing was to test the output of the address-lines. The Arduino IDE provides a simple function to shift out data to a single IO-line, using a second line as clock. But it's important to push the bytes in the right order and also set the right direction for the single bits (MSB or LSB).

While counting up all possible addresses in a loop, I could check that all 16 bits are shifted out in the right order.
Image
The next thing was to set the data on my 8 bit data bus right. My first idea was to use a complete 8bit GPIO port form the Arduino to simplify reading and writing data. But unfortunately the only complete usable 8bit port on the Arduino board includes also the both serial-ports (RX,TX) that I need for the serial communication. So I had to cut my data byte into 8 bit-pieces setting them one by one to the choosen IO lines. To be sure that everything is connected right I used my little sniffer again read and check the data output. All these things were done without the 28C64 connected to the breadboard.

The next step was to play with the EEPROM itself. As a first step I tried to read the data from the EEPROM with the following procedure
* set databus for reading
* first disable output (/OE HIGH)
* enable chip select (/CE LOW)
* disable write (/WE HIGH)
* set address bus
* enable output (/OE LOW)
* read databus
*disable output (/OE HIGH)

Reading the complete EEPROM returns 0xFF for all bytes, as expected.

The next thing was to write data. There are two modes for writing on my AT28C64. Byte-write and page-write. Because page-write is more complex, I first started with writing single bytes by the following procedure
* first disable output,write and chip select (/OE,/WE,/CE HIGH)
* set address bus
* set data bus
* enable chip select (/CE LOW)
* enable write (/WE LOW)
* wait some micro seconds for the
* disable write (/WE HIGH)
* disable chip select (/CE HIGH)
* wait 10ms for the write cycle to finish

To test this procedure I counted a data byte from 0 to 0xff and wrote every step to the addresses from 0x0000 to 0x0100.

After that I used my reading function to check the written data.

Here is the output of my serial monitor:

Quote:
start writing
finished writing
time elapsed : 2653ms
start reading:

0 : 0 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 : 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
40 : 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
60 : 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
80 : 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
A0 : A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
C0 : C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
E0 : E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF


It takes about 2.6 seconds to write 256 bytes. Over 96% of the writing time is caused by the 10ms write cycle after setting the /WE pulse. In the datasheet these 10ms are only listed for the “page write” mode, but trying to reduce the waiting time for a “byte write” caused wrong written data. So I have to live with that.

So the fist step is done. The next steps are

* moving from the breadboard to a prototype pcb with a zif socket
* replacing the arduino board with a single atmega328 µC
* creating a serial protocol that can be used easily for burning data to a eeprom

I'll keep you updated in this thread for the next things to come in this little project.
And sure, any additional ideas, tips and hints are welcome :-)

_________________
How should I know what I think, until I hear what I've said.


Top
 Profile  
Reply with quote  
PostPosted: Fri Apr 05, 2013 9:59 pm 
Offline
User avatar

Joined: Mon Apr 23, 2012 12:28 am
Posts: 760
Location: Huntsville, AL
Looks like a good job of bread boarding the programmer. It's been a while since I've programmed an EEPROM or Flash EPROM with code that I've written myself.

I am a bit surprised that you had to wait the full 10ms seconds to program each byte, since it appears that you are starting from a blank EEPROM.

The nominal programming time is generally less than 10ms, and the programming time, if I recall correctly, is directly related to the number of bits that are changing. Thus, when programming the EEPROM a byte at a time, it would be worth your effort to using the data toggle or data polling bits to determine when the programming cycle for each byte has completed. It has been my experience that using the data polling mode by reading bit 7 and/or bit 6, is significantly faster. I would further suggest that the page mode would be altogether much better, even faster, and worth the additional effort.

If I understand your timing values, your approach would require approximately 5 minutes and 30 seconds to program a 28C256 EEPROM. I don't know about you, but waiting five minutes for something is like an eternity in our high-speed world. Perhaps since this is for a retro project, time scales inversely with the target processor speed. :)

Look forward to reading more about your results with this project.

_________________
Michael A.


Top
 Profile  
Reply with quote  
PostPosted: Fri Apr 05, 2013 10:39 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8427
Location: Southern California
MichaelM wrote:
If I understand your timing values, your approach would require approximately 5 minutes and 30 seconds to program a 28C256 EEPROM. I don't know about you, but waiting five minutes for something is like an eternity in our high-speed world. Perhaps since this is for a retro project, time scales inversely with the target processor speed. :)

If you're not programming very many, that time is negligible compared to the time to make the programmer. It becomes more significant if debugging your program requires many, many erase-reprogram cycles. I think it took about that long (actually about six minutes) for Nightmaretony's programmer to do the 1Mx8 EPROMs for the large look-up tables for hyperfast, accurate 16-Bit scaled-integer math last year a few months before we lost him. It seemed kind of slow since we did a lot of them, but it gave us time to chat while they were programming. My PB-10 programmer didn't do such big ones—or maybe I just lacked the latest software updates before Needham's went out of business. Doing a reliable job of programming the big ones is more tricky though, so software alone may not have been enough. I am not aware of any EEPROMs that are that big. Mine does a 27c64 8Kx8 EPROM just about as fast as you can get it into the socket and back out, so there would be no benefit to having a gang programmer for that. The limiting factor in how quickly I could modify the program and re-try it was probably the speed at which the UV EPROM eraser erased them. It would finish one every four minutes or so, if I kept it going full time. Since you're using EEPROMs though, you won't have the separate time in the eraser.

Making your own is nice in a way because you have full control of every bit of it, so you don't have to worry about it becoming unsupported. BTW, a 28c256 has 15 address lines, numbered 0-14.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Fri Apr 05, 2013 11:51 pm 
Offline

Joined: Sat Oct 20, 2012 8:41 pm
Posts: 87
Location: San Diego
Just for reference, it takes about 2 seconds to program an Atmel 28C64B using page mode and polling. In the beginning I used the 10ms wait method and a byte at a time just to get some experience with the chips before I dug into the more efficient methods.


Top
 Profile  
Reply with quote  
PostPosted: Sun Apr 07, 2013 5:32 am 
Offline

Joined: Mon Jan 07, 2013 2:42 pm
Posts: 576
Location: Just outside Berlin, Germany
Given the price of commercial EEPROM programmers (seriously, what is wrong with these people), I can't stress enough how grateful I am for this project. I'll be happy to be the Clueless Beta Tester once the design is finished. And five minutes would not be a problem, I have to get more pizza occasionally anyway.


Top
 Profile  
Reply with quote  
PostPosted: Sun Apr 07, 2013 6:32 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8427
Location: Southern California
scotws wrote:
Given the price of commercial EEPROM programmers (seriously, what is wrong with these people), I can't stress enough how grateful I am for this project. I'll be happy to be the Clueless Beta Tester once the design is finished.

The price of device programmers is indeed an obstacle to getting more people into this hobby. I would suggest putting the entire design online for the low-budget types to be able to make their own, including the 328 program for the Arduino. For others, I might suggest making something like my workbench computer which, although it's too big of a project to justify for a single use, can be used like a Swiss Army knife of the workbench like whartung put it, with, in most respects, way, way more interfacing than you'll get on something like a PI or Arduino. I don't program (E)EPROMs with mine, but one of the many dozens of things I've used it for is programming PICs.

Quote:
And five minutes would not be a problem, I have to get more pizza occasionally anyway.

The movies documenting the early history of home computers make a big deal out of the guys doing the programming who kept no schedules but worked all night and lived on Coke and pizza. :lol:

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Sun Apr 07, 2013 1:37 pm 
Offline

Joined: Mon Mar 25, 2013 9:26 pm
Posts: 183
Location: Germany
The whole project will be available as open source. I hope that I end up in a proper PCB design so anybody can order a PCB or etch its own and build his own programmer. If somebody wants to join the project, you are welcome. I would be pleased to share the work. Once the serial protocol is finished somebody could work on the PC side to send Data to the programmer.
Mario.

_________________
How should I know what I think, until I hear what I've said.


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 08, 2013 6:54 pm 
Offline

Joined: Mon Mar 25, 2013 9:26 pm
Posts: 183
Location: Germany
Hi again,

I attached the first draft of the protocol description that I want to implement for the programmer. Not alle features will be available in the first shots, but this is where I want to end up finally.
Any criticism, additional ideas, even laughing is welcome :D

Mario.


Attachments:
File comment: First draft of serial protocol.
serial_protocoll.txt [8.4 KiB]
Downloaded 899 times

_________________
How should I know what I think, until I hear what I've said.


Last edited by mkl0815 on Thu Apr 11, 2013 8:13 am, edited 1 time in total.
Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 09, 2013 12:55 pm 
Offline
User avatar

Joined: Mon Dec 08, 2008 6:32 pm
Posts: 143
Location: Brighton, England
Have you considered using counters instead of shift registers to generate the addresses? They could be controlled by two lines (Reset, Clock pulse)

Since you will probably be programming the EEPROM addresses sequentially, outputting the next address would only take 1 clock pulse instead of the 16 you need now.

Admitidly, setting the program starting address if you are not starting from zero would take many more pulses.

_________________
Shift to the left,
Shift to the right,
Mask in, Mask Out,
BYTE! BYTE! BYTE!


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 09, 2013 1:21 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
The atmega328 can generate a 10 MHz SPI clock (using 20 MHz crystal), so setting up the address only takes a few microseconds. The programming time is measured in milliseconds, so it's not really worth it to give up the flexibility of the shift registers.


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 10, 2013 7:30 pm 
Offline

Joined: Mon Jan 07, 2013 2:42 pm
Posts: 576
Location: Just outside Berlin, Germany
mkl0815 wrote:
I attached the first draft of the protocol description that I want to implement for the programmer.


Hey, cool! Found a few typos, and have one question about the ve command:

Typo: Any number bigger the 7fff will cause an error because you should never have a address beyond 0x7ffff. (an "f" too far).
Typo: * 02 - data lenght mismatch

In bw command: In cause that the write cycle need some time to finish, you may need to make some breaks of about 50 ms after each 100 bytes. --> If the write cycle needs some time to finish, you may have to insert some breaks of about 50 ms after each 100 bytes. (BTW, are those 100 hex or 100 decimal?)

In pw command: command is send (sent); returnvalue (space missing)

Could you provide an example for what ve returns? We should probably have a string in a high-level program to compare it with so we know they are speaking the same language.

I'll try to get a primitive Python CLI going in the next few days until a real programmer can put together something with a graphic interface.

Oh, and sooner or later we're going to have to have a name of this thing. I suggest "meepromer", for "Mario's EEPROMer", since you're doing all the work.


Top
 Profile  
Reply with quote  
PostPosted: Thu Apr 11, 2013 6:53 pm 
Offline

Joined: Mon Jan 07, 2013 2:42 pm
Posts: 576
Location: Just outside Berlin, Germany
Here is a first Python fragment, pretty much only the interface so we can discuss if this is what we'll want to have. (It took me longer than I had thought because optparse is considered obsolete in 2.7, and I had to figure out how to use argparse instead. What will they think of next.) Ignore the single serial port routine, it doesn't do anything yet. Note that the suffix is .txt because the forum will not let me upload .py files, you'll have to change it.

Put briefly, I'd suggest flags for writing (-w, --write), reading (-r, --read), dumping as ascii (-d, --dump), diff writing of those bytes on the EEPROM that are different in the file (-D, --diff), and a verify function (-v, --verify) to make sure that EEPROM and file are the same. You can give the first address to be written to or read (-a, --address, default is 0000), and the number of bytes to be read or read (-b, --bytes, default 1). Supply a filename with -f or --file. There is a bunch of others stuff like --version or --info (gets information from the EEPROM).

Anything else that should go in there, anything we should do differently?

Unfortunately (well, for the project), the Longest Winter Ever seems to be finally over in Germany, and I'm going to be spending time in the garden the next few weeks getting the veggies going, so my projects here are going to slow down a bit, unless it rains a lot :-).


Attachments:
meepromer.txt [2.87 KiB]
Downloaded 597 times
Top
 Profile  
Reply with quote  
PostPosted: Fri Apr 12, 2013 8:54 am 
Offline

Joined: Mon Mar 25, 2013 9:26 pm
Posts: 183
Location: Germany
Hey, this is great. The python script is exactly what I was thinking about. Motivation is high to go further with the hardware and the firmware this weekend. The first things we should get up and running are serial communication and reading, writing binary data.
We should discuss which features should be implemented by the firmware and which features by the controlling software.
My approach was to get as much intelligence into the programmer as possible, so it can be used more flexible.

The "diff" option should be able to get the data either from the EEPROM itself and also from a file to speed up programming. My idea behind that is, that you have an iterative development process. You create your ROM file and write it to the EEPROM and test it. After that you make some changes in you programm and create a new rom-file. with the diff option you can then write only the few bytes that have changed between both rom-files to the EEPROM.
Mario.

_________________
How should I know what I think, until I hear what I've said.


Top
 Profile  
Reply with quote  
PostPosted: Sun Apr 14, 2013 2:09 pm 
Offline

Joined: Mon Mar 25, 2013 9:26 pm
Posts: 183
Location: Germany
After a long night and only a few hours of sleep I stumbled together a first version of the prototype. At the moment only the 15 address lines are connected to the ZIF socket. I had to use my 40 pin socket, cause my 28 pin ZIF socket are still on the way to me. By using my handy little bus-sniffer I could proof, that all lines are connected to the pins they belong to. :D
Image
I did not start with a barbeone Atmeg328, because for development it's much easier to have a complete Arduino Nano to work with. It has a USB connector included that appears as a serial interface on the host computer and I can upload new firmware versions directly from the Arduino IDE without an additional programmer.
I think i will completely discard my idea to use a barebone Atmega328 chip. Because if somebody wants to build his own EEPROM programmer, he needs to get the firmware on the chip. This is done normaly be a external progammer. It can also be done by a serial connection based upload, but for that a proper "bootloader" on the chip (running at 8MHz internal clock) is needed.
For connecting the EEPROM programmer with a barebone Atmega328 you would also need some serial-to usb interface or at least a MAX323 converter.
The Arduino Nano starts at 12$ on Ebay, so the cost advantage is minimal by using a single Atmega328, because additional hardware is needed.
It's easy to upload the programmer firmware with the Arduino IDE, that is freely available for any common OS (MacOS, Linux, Windows).
The Arduino Nano I used for my prototype is not soldered on the PCB. It's mounted on a IC socket (formerly a 40 pin 600mil socket, cut down to 30 pins), so it can be removed and used for other purposes. Reinstalling the firmware for the programmer is done in a minute, so this solution is more flexible.

I think I will finish this first prototype within the next days. For today I'll take the chance to celebrate the first warm and sunny Sunday this year with a little barbecue :mrgreen:

P.S. I'll attach the last version of the serial protocol that includes the improvements from scotws.


Attachments:
serial_protocoll.txt [8.64 KiB]
Downloaded 802 times

_________________
How should I know what I think, until I hear what I've said.
Top
 Profile  
Reply with quote  
PostPosted: Sun Apr 14, 2013 3:38 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
Watching this with interest!
Cheers
Ed


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 269 posts ]  Go to page 1, 2, 3, 4, 5 ... 18  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: