View Single Post
Old 24th Feb 2021, 10:02 pm   #16
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,482
Default Re: Reading PROMs with a Raspberry Pi

My thanks to ciprians for the useful information regarding the project which uses an Arduino as the base for a chip reader - we have discussed other Arduino projects which do similar things but that is certainly one of the most finished / sophisticated Arduino versions to date. I have no objection to the scope of the thread spreading out this way - with hindsight I should have added '/Arduino' to the end of the thread title, but for the moment I would like to return to the original thread topic of using a Raspberry Pi to read a PROM.

The background to this was that two forum members recently had problems with retro-computers in which they did not know whether the PROMs were good or bad. Neither person had an EPROM reader or similar device, also neither had Arduinos but both had Raspberry Pis, so that was why I set off down the road of trying to use a Pi rather than an Arduino. The main concern was that Raspberry Pis are 3V3 devices whereas old PROMs and EPROMs are invariably 5-volt devices. Both of the individuals concerned have since resolved this issue in other ways but I decided to continue to the end so that we have a ready made and tested and above all simple solution if this need arises again.

This is an absolute barebones Raspberry Pi PROM reader with minimal hardware and simple Python software to drive it. For the hardware, it has been assumed that the 3V3 output levels from the Pi's GPIO pins are enough to satisfy the threshold for a logic '1' on the address pins and data pins of the source device. It has also been assumed that the CE / CS pins on the PROM can also accept the 0V / 3V3 logic levels as valid logic 0 and logic 1.

Data out from the PROM to the Pi presents a greater problem as the Pi's GPIO pins are not 5V - tolerant which means some kind of level shifting is needed. I tried various methods but the simplest one which works is to use a resistor divider to divide the 5V-out from the PROM down to 3V3. After some experimentation I decided on series resistors = 4K7 and resistors down to 0V = 10K, which divides the input voltage to about two-thirds of the original voltage.

My first attempt at doing this used a female-female header block plugged onto the 40-pin GPIO connector and an experimenter's plug-in breadboard to hold the source device and level shifter, with the two elements connected together by Arduino style round-pin male-male jumpers. It didn't work too well, I had constant problems with connections coming and going.

Version two, which works really reliably, replaced the F-F header and male jump leads with female to female Dupont leads and a purpose made carrier board for the source device and the level shifter (see first two images). On the 'carrier' I have started by fitting vertical rows of male pins so that each source device pin has at least one connector pin associated with it. I have then added horizontal rows of more pins to those pins which may be 0V or 5V supply pins on the source device. This is to make it easier to tie some of the source device pins, especially additional chip select pins, to 0V or 5V, as and when required.

For the data pin level shifter I used two resistor packages, an 8 x parallel 4K7 package for the series resistors and an 8 x 10K SIL resistor package for the resistors going from the Pi pins down to 0V. You could of course use 16 individual resistors.

For the two CE / CS outputs I have intentionally used GPIO 3 as the active low CE output because this pin has a permanent hardware pullup resistor on it, so it will therefore hold the connected PROM in the disabled state until such time as it is intentionally enabled by this output being driven low under software control.

As this project uses most of the Pi's 40 GPIO pins you need to go into Raspi-Config and check / ensure that all of the 'special functions' of some of the Pi's GPIO pins are turned off, so turn off Serial, PSI, I2C, Onewire and so on.

The .PY program can be loaded into IDLE PYTHON 3 on the Pi and run there but it will run very slowly. It will run much faster in a terminal window if you place it in your home /yourusername/bin folder (create the bin folder if necessary) and, while in that folder, make it executable with

Code:
sudo chmod +x readprom.py
cd back down to your home folder and run the program with

Code:
readprom.py <enter>.
Output from the reader is to the screen and each line shows a line address in hex, 16 hex bytes and the equivalent in ASCII. At the end of the operation the 16-bit checksum of the code which has been read is also displayed. You can, optionally, also write the code being read out to a binary file. To enable this, find the line "FileWrite=0", change it to "FileWrite=1" and save the program. Now when you run it, as well as displaying the code on the screen it will write it out to a plain binary file called 'binaryfile.bin', which will be generated in the folder where the readprom.py file is. This is a no-frills feature - if the file already exists it will be overwritten. If the file path specified is invalid, the program will fall over.

The program is currently set to read 4K (4096) bytes. You can change that value downwards to read smaller (2K, 1K etc) memory devices.

In the .zip file: The readprom.py script and a larger version of the connection diagram shown below.
Attached Thumbnails
Click image for larger version

Name:	PromReaderCarrierBoard.jpg
Views:	96
Size:	91.4 KB
ID:	227542   Click image for larger version

Name:	PromReader.jpg
Views:	84
Size:	89.2 KB
ID:	227543   Click image for larger version

Name:	PiPromReader_Resistordivider.jpg
Views:	95
Size:	63.0 KB
ID:	227547   Click image for larger version

Name:	prom_read_UD7_code_2.jpg
Views:	82
Size:	133.3 KB
ID:	227548  
Attached Files
File Type: zip PiPromReader.zip (185.5 KB, 72 views)
SiriusHardware is online now