bozgrul
Newbie level 3
- Joined
- May 31, 2011
- Messages
- 3
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,332
Hello,
I'm building an 8-bits computer with old cpu (for educational purpose).
Now, to make it work, I need a ROM that I will fill with all kinds of
stupid or smart code.
But I don't have any *PROM programmer.
Looking at Atmel parallel EEPROM AT28C256 (32 KB), I read in the datasheet (http://www.atmel.com/dyn/resources/prod_documents/doc0006.pdf) that it could be programmed with +5 V.
So I thought that I could be able to program it with my microcontroller (Arduino Mega), then plug it to my 8-bits cpu. Et voilà!
Et no voilà...
I'm stuck with the first part - program the EEPROM with the Arduino.
I've spent hours trying to make it work, and I don't know if it's my design that's flawed, or something else (the moon, maybe..).
Here is my attempt.
- for a start, I wanted something very simple, so I only use 3 bits of the address bus : A0, A1 & A2. A3 to A14 are connected to GND of the Arduino.
I only want to write and retreive data to/from addresses 0 to 7 (very short program indeed! Just to check it's working, and less wiring)
- A0 .. A2 are connected to 3 digital pins, as outputs
- D0 .. D7 are connected to 7 digital pins, as outputs or inputs, depending on the action (writing to the EEPROM, or reading - to check)
- VCC is connected to the Arduino's VCC
- GND to the A's VCC
- CE, OE & WE are connected to 3 digital pins
- I use a breadboard
Here is the init sequence:
- set A0..A2, WE, OE and CE to output
- set WE/OE & CE to 1 (+5V)
- wait 1.5 sec
Now the write sequence:
- set D0..D7 to output
- for each byte to write:
. set OE to 1, CE to 0
. write A0..A2
. write D0..D7
. set WE to 0
. wait for x ms (I've tryed lots of different values)
. set WE to 1, CE to 1
And the read sequence:
- set D0..D7 to input
- for each byte to read:
. set CE to 0
. write A0..A2
. set OE to 0
. wait for x ms (I've tryed lots of different values)
. read D0..D7
. set OE to 1, CE to 1
When I do the write then the read sequence, I have trouble with the first byte, which is different between read & write (very often, I read 255, sometimes 127). The other bytes are fine (ie same as written : I write 0 to 7 in ROM addresses 0 to 7, it's easy to check).
If I set a longer wait time for the read sequence, I get the correct value (but 4 ms for a memory read seems eternity...)
But the worst part is : when I reset and only read bytes from the EEPROM, I get data that has nothing to see with my initial data.
For example : 255,255,255,223,4,127,4,255 instead of 0 .. 7.
Does somebody understand what is going on ? What I could try ? If my design is correct ?
Thank you for reading my (way too) long post, I hope to read from you !
Boz
I'm building an 8-bits computer with old cpu (for educational purpose).
Now, to make it work, I need a ROM that I will fill with all kinds of
stupid or smart code.
But I don't have any *PROM programmer.
Looking at Atmel parallel EEPROM AT28C256 (32 KB), I read in the datasheet (http://www.atmel.com/dyn/resources/prod_documents/doc0006.pdf) that it could be programmed with +5 V.
So I thought that I could be able to program it with my microcontroller (Arduino Mega), then plug it to my 8-bits cpu. Et voilà!
Et no voilà...
I'm stuck with the first part - program the EEPROM with the Arduino.
I've spent hours trying to make it work, and I don't know if it's my design that's flawed, or something else (the moon, maybe..).
Here is my attempt.
- for a start, I wanted something very simple, so I only use 3 bits of the address bus : A0, A1 & A2. A3 to A14 are connected to GND of the Arduino.
I only want to write and retreive data to/from addresses 0 to 7 (very short program indeed! Just to check it's working, and less wiring)
- A0 .. A2 are connected to 3 digital pins, as outputs
- D0 .. D7 are connected to 7 digital pins, as outputs or inputs, depending on the action (writing to the EEPROM, or reading - to check)
- VCC is connected to the Arduino's VCC
- GND to the A's VCC
- CE, OE & WE are connected to 3 digital pins
- I use a breadboard
Here is the init sequence:
- set A0..A2, WE, OE and CE to output
- set WE/OE & CE to 1 (+5V)
- wait 1.5 sec
Now the write sequence:
- set D0..D7 to output
- for each byte to write:
. set OE to 1, CE to 0
. write A0..A2
. write D0..D7
. set WE to 0
. wait for x ms (I've tryed lots of different values)
. set WE to 1, CE to 1
And the read sequence:
- set D0..D7 to input
- for each byte to read:
. set CE to 0
. write A0..A2
. set OE to 0
. wait for x ms (I've tryed lots of different values)
. read D0..D7
. set OE to 1, CE to 1
When I do the write then the read sequence, I have trouble with the first byte, which is different between read & write (very often, I read 255, sometimes 127). The other bytes are fine (ie same as written : I write 0 to 7 in ROM addresses 0 to 7, it's easy to check).
If I set a longer wait time for the read sequence, I get the correct value (but 4 ms for a memory read seems eternity...)
But the worst part is : when I reset and only read bytes from the EEPROM, I get data that has nothing to see with my initial data.
For example : 255,255,255,223,4,127,4,255 instead of 0 .. 7.
Does somebody understand what is going on ? What I could try ? If my design is correct ?
Thank you for reading my (way too) long post, I hope to read from you !
Boz