Reading EPROMS

Talk about non-Acorn classic computers/hardware/software here (including retro consoles)
Post Reply
User avatar
tautology
Posts: 369
Joined: Wed Sep 01, 2010 2:26 pm
Contact:

Reading EPROMS

Post by tautology » Wed Jan 17, 2018 10:01 pm

After a bit of mucking around trying to resurrect a dead Oric-1; to prove that the EPROM was fine, I coded an EPROM reader in python (interfacing to a Raspberry Pi). This was actually a whole lot easier than I expected; the most complex bit was getting the 27 different wires into the right places.

And it doesn't work well when you connect both Vcc and GND to 5V!

Yesterday, I made a quick ZIF interface on a bit of stripboard:
Photo-0.jpg
Next step is to transfer it to a Pi HAT. But this requires lots of swearing at the really bad UX on every PCB design program out there. (Last time I designed a PCB it was twenty-five years ago on a BBC Master.)

User avatar
hoglet
Posts: 7698
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Reading EPROMS

Post by hoglet » Thu Jan 18, 2018 7:37 am

Are you planning to use any kind of level shifters?

If not, you could possibly damage the Pi, all of it's GPIO pins work with 3.3V levels.

Dave

duikkie
Posts: 2890
Joined: Fri Feb 07, 2014 3:28 pm
Contact:

Re: Reading EPROMS

Post by duikkie » Thu Jan 18, 2018 9:22 am

why don't you put the rom in a beeb ? then read all bytes from rom in ram. and so on

the rom will not run hopefully in the beeb :) , but you can read the bytes :)

User avatar
tautology
Posts: 369
Joined: Wed Sep 01, 2010 2:26 pm
Contact:

Re: Reading EPROMS

Post by tautology » Thu Jan 18, 2018 3:16 pm

hoglet wrote:Are you planning to use any kind of level shifters?

If not, you could possibly damage the Pi, all of it's GPIO pins work with 3.3V levels.
In testing the O0-7 pins had the same voltage as the A0-12 pins; so it bounced back 3.3V to me. But it's a good point; and I probably ought to look at a component to limit the voltage on the O0-7 pins.

User avatar
1024MAK
Posts: 8110
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Reading EPROMS

Post by 1024MAK » Thu Jan 18, 2018 3:54 pm

You may find that it works with a 3.3V supply voltage (well, for reading, not recommended for programming). Unless the original programming was marginal (in which case some cells may return incorrect data). It may also not meet the datasheet timing values.

Mark

crj
Posts: 835
Joined: Thu May 02, 2013 4:58 pm
Contact:

Re: Reading EPROMS

Post by crj » Thu Jan 18, 2018 3:57 pm

While most complex ICs have protection diodes on their inputs which might make over-voltage OK, or at least mean that a series resistor sufficed as protection, so far as I'm aware the precise details have never been published for (any of the various versions of) the Raspberry Pi.

It's probably a good idea to do things properly and put a bus transceiver in the way.

(I'm trying to imagine what the circuitry inside an EPROM looks like, but I expect the output voltage matching the input is a coincidence.)

User avatar
1024MAK
Posts: 8110
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Reading EPROMS

Post by 1024MAK » Thu Jan 18, 2018 4:08 pm

The data area of an EPROM is actually analog. Comparators actually decide if each memory cell is a zero or a one based on the voltage from the cell. The rest of the circuitry is either NMOS or CMOS logic circuits, with the CPU interface designed to be compatible with 5V TTL logic (for the smaller/older designs) or 3.3V logic for some of the larger/more modern designs (see the relevant datasheet).

NMOS types may have outputs that do not actually make it to 5V if loaded. As a TTL logic high / logic one is 2.7V to 5V (for a typical output).

Mark

User avatar
tautology
Posts: 369
Joined: Wed Sep 01, 2010 2:26 pm
Contact:

Re: Reading EPROMS

Post by tautology » Thu Jan 18, 2018 8:33 pm

According to the datasheet, you as well as Vcc and GND, you have Vil which is -0.1 to 0.8 and Vih which is 2 to Vcc+1. Vpp needs to be about 24V for programming; I can't do that from a Pi (well not without frying it).

I may try it with VCC being 3.3 to see whether I can just power it at that voltage. This would mean that I wouldn't need to set up another rig for 24 pin [E]PROMs.

The Python is very simple: (Note I kept OE and CE at GND, trying to follow the datasheet was a bit random)

Code: Select all

#!/usr/bin/python
import RPi.GPIO as GPIO
import hexdump
import time

address = [ 27, 18, 17, 15, 14, 4, 3, 2, 22, 23, 24, 10, 9]
data = [ 21, 26, 20, 19, 16, 13, 6, 12 ]

ce = 25
oe = 11
pgm = 8

def setup():
        GPIO.setmode(GPIO.BCM)
        GPIO.setwarnings(False)
        for i in address:
                GPIO.setup(i, GPIO.OUT, initial=GPIO.LOW)
        for i in data:
                GPIO.setup(i, GPIO.IN)
        GPIO.setup(ce, GPIO.OUT, initial=GPIO.LOW)
        GPIO.setup(oe, GPIO.OUT, initial=GPIO.LOW)

def setaddr(a):
        for i, v in enumerate(address):
                if (a & (1<<i)):
                        GPIO.output(v, GPIO.HIGH)
                else:
                        GPIO.output(v, GPIO.LOW)

def readbyte(a):
        setaddr(a)
        # Now read from data
        result=0
        for i, v in enumerate(data):
                if GPIO.input(v) == GPIO.HIGH:
                        result = result | (1<<i)
        return result

setup()
result=""
for i in range(0,8192):
        result=result + chr(readbyte(i))
of=open("epromo.bin","wb")
of.write(result)
of.close()

User avatar
1024MAK
Posts: 8110
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Reading EPROMS

Post by 1024MAK » Thu Jan 18, 2018 9:47 pm

/OE (negative logic output enable) turns on the three state drives on the output pins, while /CE or /CS (negative logic chip enable or chip select) brings it out of "standby" mode and tells it to read it's memory.

So normally /CE or /CS is connected to address decoder logic and /OE is connected to the CPU /Read signal (or equivalent).

Mark

User avatar
tautology
Posts: 369
Joined: Wed Sep 01, 2010 2:26 pm
Contact:

Re: Reading EPROMS

Post by tautology » Fri Jan 19, 2018 3:23 pm

I know how OE and CE are meant to be used, but I found following the flow in the datasheet brought back random results; forcing them permanently to ground worked every time.

I've just powering the EPROM straight off 3.3V and it works perfectly. This means I can revisit it an make a setup that will also work for 24 pin EPROMS.

User avatar
tautology
Posts: 369
Joined: Wed Sep 01, 2010 2:26 pm
Contact:

Re: Reading EPROMS

Post by tautology » Fri Jan 19, 2018 4:40 pm

Oh the good news is that once I replaced the Oric-1's voltage regulator, the computer works. Woo! It's only taken me five years to get to this point...

Post Reply