Turning a Top2005 EPROM Programmer into a Desktop Test Bench

Register-Direct USB Commands

The next section are the register-based commands.   These commands are used to write/read the FPGA, and are usually the commands used to change pin states.   Keep in mind that the bitstream in the FPGA may include a state machine or other more complex logic, so it’s not always a case of “bit banging” pins.   One example is the 27xx series EPROM, where the address lines are driven from a binary counter.   A single write to register $13 increments the current address counter and all 20-something address pins are updated.   This greatly decreases the number of writes needed to fetch each byte from the EPROM.

The register-direct commands are either one or two bytes long.   The commands $01-$04 are commonly used as read registers, and the registers $10-$14 are used as write registers.   In the next part of the discussion, we will assume that the bitstream used is “ictest.bit”, a general-purpose 74xx logic test bitstream where the implementation truly IS literal bit-banging.


In the ictest bitstream, USB commands 10 XX, 11 XX, 12 XX, 13 XX, and 14 XX write the actual pin data to pins 1-40.   Each bit in those bytes corresponds to one ZIF pin, where the LSB of command $10 writes to ZIF pin 1 and the MSB of command $10 writes to ZIF pin 8.   The full breakdown is as follows:

  • $10 – pins 1-8
  • $11 – pins 9-16
  • $12 – pins 17-25, skipping ZIF pin 20.
  • $13 – pins 26-33
  • $14 – pins 34-40, where MSB would be p41 and is not used

To finalize the pin manipulation and latch the data to the pins, you follow up your list of registers with 0A 15 FF.   You can write as many or as few registers as you like, but for any register written, you MUST define all bits in that section as high/low.   These commands are NOT additive, and what you write will be what is literally applied to the ZIF pins.   40-bit wide bit banging is cool!

Write Examples

To write all pins on the socket to a logic high, you would fire the usb command

10 FF 11 FF 12 FF 13 FF 14 FF 0A 15 FF

And to write all pins low, you’d fire:

10 00 11 00 12 00 13 00 14 00 0A 15 FF


In a similar manner, USB commands $01 through $05 load the data from the FPGA to the PDIUSB buffer for reading.   $01 reads the pins on register $10, and $05 reads the pins on register $14.   You finish up with a $07, which preps the PDIUSB for reading, and then you can fetch the 64-byte USB buffer by doing a 64-byte read of endpoint $82.

  • $01 – Reads pins 1-8. Bit 0 (LSB) corresponds to pin 1, and Bit 7 corresponds to pin 8.
  • $02 – pins 9-16
  • $03 – p17-25, skipping p20. p20 has an FPGA line, but logically it’s not connected here where I expected.
  • $04 – p26-p33
  • $05 – p34-p40.

Developer note:   Internally, the 8051 reads addresses $10-$14 when it receives the $01-$05 “read” code, so the FPGA implementation only has to deal with an address space of $10-$14.   Not sure why they did it like this, or even why they didn’t make the read codes $00-$04 to match up nicely with the write codes $10-$14, but that’s the way it works.

Read Examples  

Again, you can read as many or as few registers as you like.   The typical USB command to read everything is

01 02 03 04 07

But you can certainly only read one section (for example p9-16) using

02 07

Or read that section many times (up to 64) using

02 02 02 02 02 02 02 02 02 07

If you’d like to try to catch a pin toggling from high to low, for example.

At this point, you have all the info you need (hopefully) to write a simple piece of client software to control the programmer.   By snooping the USB commands used when programming each of the different types of devices, it’s probably possible to implement an entirely open-source software client for this device.   However, that’s a BIG job and not one that we’re willing to tackle.   We have a little piece of “testbench” software that’s being kicked around the debug table these days that we will discuss at the end of the article.

In order to keep track of all these pins and their associated USB commands, we’ve generated a “cheat sheet”.   We think it’s accurate but there were a few signals that we couldn’t get working when it was developed, which are marked with ? symbols.   Since then, most of those have been verified to be correct but still live in question due to our laziness in updating the file.   Click the tiny unreadable cheat sheet to pop open a larger version for saving or printing.

Top2005 ZIF Pin cheat sheet

Fig 4 – ZIF Control Cheat Sheet

Continue to Next Page

This entry was posted in Hacks, Projects. Bookmark the permalink.

33 Responses to "Turning a Top2005 EPROM Programmer into a Desktop Test Bench"

Leave a reply