Close
0%
0%

Logic reader

Simple and cheap logic reader for PC with USB

Similar projects worth following
I needed a quick way to read the outputs of a PAL14L4 chip, and compare it with the GAL16V8 replacement I had made, in order to prove the correctness of the latter. I made this simple project with a couple of ready-made modules mounted on a breadboard. It worked correctly. The pins can be individually controlled, so one could toggle a clock pin and observe the before and after states of registered logic. It can easily be expanded to read bigger logic chips, or even boards of logic.

Simplicity is the key feature here. You don't need to make or buy a PCB, build it, or do much wiring.

Components:

  • USB to I2C module
  • I2C to 16-bit parallel I/O module or chip
  • Two 4k7 resistors to pull up the I2C bus signals

Optional parts:

  • Current limiting resistors where you might connect two outputs
  • LED bar to show output pin activity
  • Switch for VCC to logic chip power

Operation

I had to write some C code, because the demo code from FTDI had the USB-to-I2C module driving a serial EEPROM. The I2C-to-PIO chip is significantly different. I wasted many hours trying to adapt the demo code before asking an AI bot what was wrong with my code. It quickly spotted what I had done, and gave me some working code. This was the most time-consuming task, which won't need to be done again.

I quickly wrote a short routine to test the I/O by driving an LED bar. 

I then wired the port A to the PAL14L4 pins 1 to 8. Port B had the less-significant bits wired to the other PAL input pins and the most significant bits to the four outputs. With 14 inputs and 4 outputs, a single 16-bit IO module can only read 2 outputs at a time. I decided to read just one output at a time, because it was quicker to run the reader program four times (4 x 40 seconds) than to write more code.

My code read the outputs to an ASCII text file, for both the original PAL14L4 and my self-made GAL16V8. Comparing the files using the Linux diff command quickly identified which outputs were identical, and where they were not. 

Then it was a matter of tweaking my logic expressions until the matched. Fortunately I had equations from a similar chip for another machine, which proved a good starting point. With a bit of intuition and several iterations, I successfully duplicated the original logic.

I have a device that should have been able to read the fuse maps directly, but for some reason it was not working for 2 of the four outputs. Hence I had to create this project to figure those out the hard way.

Advantages

  • Off the shelf modules
  • Simple and quick to assemble
  • Input pins can be individually changed
  • Software in C
  • Runs on a desktop PC
  • Easily expandable for more I/O pins
  • Cheap enough to make and send to people who don't want to send their chips to me

Disadvantages

  • About 100 time slower than a device reader, but still only about 10s to cycle through the 16384 possible input combinations. This is trivial compared to all the other time spent. 
    Of the 600 microseconds per address, most of this is due to USB overheads. USB is great for transferring large packets of data, but less efficient for a few bytes at a time.

Cost

UMFT4222EV module about £15 

MCP23017 module (or chip) a few pounds

Comparison with other methods

Reading by using a ROM socket adaptor

This is simple but does need a ROM reading device.

https://dreamjam.co.uk/emuviews/readpal.php

Tony Brewer's PAL14L4 Reader

This uses counters to drive the input pins and is specific to the Memotech

Needs building on prototyping board  

The software is written in Z80 assembler.

http://www.primrosebank.net/computers/mtx/projects/pal_reader/palreader_build.htm

A QBASIC program for reading PAL outputs and automatically deducing the logic equations is mentioned, but I can't find it for downloading.

Ideas for future work

  • Expand design to cope with 24-pin PAL chips
  • Sense when pins are input, output, or disabled
  • Find how to automate equation recovery with Espresso or Logic Friday
  • Remove the USB time overhead by talking directly to the I/O chip from the I2C bus of a Raspberry Pi

There is hobbyist demand for reverse engineering programmable logic from old machines to preserve them. The combinatorial chips are simple, but registered chips are usually harder. For example, the PAL chips in the Applix 1616 machine had their security bits blown and the original inventor has lost/forgotten the original equations. People have discussed trying 'brute force' analysis by bombarding...

Read more »

  • Pinouts and connections

    Keith11/17/2025 at 20:19 0 comments

    The USB module just has power, ground and the two I2C signals connecting.

    I used just one MCP23017 chip, with GPB7 connected to D0, D1, D2 and D3 in turn. This needs that pin direction set to input instead of output. For a more general purpose device, use two of these chip and set their slave addresses to be different (using pins 15, 16 17).

    Here are the connections to simple programmable logic chips with all their possible output pins (pale blue cells) set to outputs. Some cells are always inputs (green cells). 

    In practice, some of the possible output cells may be inputs. You may not know their signal directions at first, so current-limiting resistors to those lines are a wise precaution to prevent damage.

    The pin ordering on the right may seem a bit irregular, but it allows the addresses to be cycled from 0 to 2^n where n is the number of address pins minus 1. 

    You can also use the two-chip version to read EPROM chips. The /CS and /OE pins can be tied down for reading. Where pins become VPP or /PGM, simply hold A11, A14, and A15 high as required. Pin 28 can be permanently connected to VCC, but pin 26 will need switching to VCC, or buffered to be able to supply enough current to drive a 24-pin EPROM.

View project log

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates