|An EPROM Simulator is a very useful tool, necessary for developing and testing any microprocessor-controled devices with external program memory. One way to develop and debug software for microprocessor-controled devices is to constantly move a programmable circuit (EEPROM, FLASH EPROM or ZeroPower RAM) between a socket in the tested device and the socket of a programmer. Another way is to use a special development circuit board, which contains, in addition to a SRAM, a non-volatile memory with a 'monitor' program in it that would download the main program from a PC (via RS-232 or another interface) and store it into the SRAM. This would seem to be a good idea; however, due to presence of the 'monitor' program, the main software cannot use the communication interface nor the whole address space. On the other hand, in such a system it is easy to look at register and memory contents, etc. Using a simulator enables the user to fix or modify the software in an already constructed device. It is not necessary to replace the main board with a debugging board, while the previous solution requires to do so. All we have to do is replace the EPROM with the simulator, find and analyze the problem, and then put another EPROM with an updated version of the software into our device, and the fix is done. Developing an application using an EPROM simulator may seem to be expensive and more complicated; however, such a device is very flexible and universal, and it is a good investment.
What is it for and how does it work?
Any microprocessor-controled device needs a program, which can be stored either in the processor itself, or in an external program memory. First case will be discussed later. If the program is stored in an external program memory, it is necessary for the memory chip to be easily replaceable to allow software upgrades. Most often, an EPROM or Flash EPROM memory circuit in a socket is used. EPROM SIMULATOR is a device that plugs into the socket and behaves just like an EPROM would. In addition, it is connected to a personal computer. The PC can upload user software into the simulated memory, and the microprocessor will run according to it. For increased comfort, the EPROM simulator may contain a reset output, which can be activated immediately after uploading a new version of the software.
Of course, such a system can't (and is not intended to) compete with simulators of a microprocessor as a whole, which are able to simulate its internal memory, watch register contents, read ports, control timings, etc. with no restrictions.
An 8-bit D-type flip flop (74374) and the i/o chip 8255 are connected to the parallel port. The clock input of the 74374 is connected to a simple inverting feedback, which shapes the write pulse for the D flip-flops via R2 and C1. This feedback, together with the termination resistors, protects against unwanted crosstalk of pulses, which tend to occur in an unshielded twisted cable. In addition it works as a test if the simulator is connected to the parallel port. The 8255 control signals (/RD, A0, A1) are connected to the remaining pins of the LPT. The 74374 outputs are used to control the whole simulator. The RESET output is used to reset the microprocessor. The LED output is used as a status indicator, and may be used alternatively as a source of clock pulses.
After inicialisation and the presence test of the EPROM Simulator, the reset pin is set active and the bus decouplers are set to high impedance state, thus separating the SRAM in the simulator from external circuitry. Then, the entire SRAM is filled with the simulated program: first, the address is set via the 8255 PB and PC ports, the SRAM is set to write mode, and the byte at the PA port is written to it.
In the last phase, all three 8255 ports are set to input mode - the data pins then behave as if they are in high impedance state. Then, the bus decouplers (74244's) connect the SRAM to the address and data bus of the application, and the rest of the logic circuits ensure that it looks like an EPROM to the application. (The bus decoupler is also used to set the data signals to high impedance state when the simulated EPROM is disconnected via the /CE and /OE pins.) Finally, the EPROM Simulator contains all of the necessary data, the RESET output is deactivated, and the microprocessor can run the program.
The EPROM Simulator was designed using standard components only, which are generally available at e.g. old 286 mainboards, and everybody probably has them in "drawer supplies".
The A15_IN input jumper HAS TO BE CLOSED unless the simulator runs in the 64k mode. The last version of the PCB has a thin connection on the solder side, causing these pins to be closed even if the jumper is missing. To use 64k SRAM, this connection must be removed.
Setup and debugging:
This application should work on the first try. No complicated setup is necessary. However, if it does not work, check the following:
- Sometimes, the soldering pads of the Cannon connector are short-circuited by the thin conductive border.
- Did you remember to put a jumper on the A15 input? - It has to be ALWAYS closed, unless you use a 64 kB memory. If you don't plan to use the whole 64k, it is recommended to hard-wire the jumper closed.
- Software reports that the simulator is not connected : The problem may be with your parallel port. Although we have used all of our knowledge about the parallel port (mostly horrible), there can be a small percentage of parallel ports that don't work with the simulator. Presence test is done by connecting inverted /AutoFeed output to the /ERROR input of the LPT. So, only an inverter (one gate of a 7402 is used) and the supply voltage (common source of most problems) are needed. If both the power and the inverter are OK, try to check the PCB for short circuits.
- Software reports everything OK, but the EPROM socket contains only FF's. If the LED is indicating proper operation (turns off after the program is started and lights up after uploading data to the memory), there may be a connections problem. Check the logic levels on control pins according to the schematic. Pay attention especially to the /CS, /OE, /WE pins of the SRAM and all '1' pins of the 74244's.
There's no point in describing more theoretical errors - if you experience any other problems, it is recommended to look for them by stepping through the Pascal or C++ source code and checking levels with a logic probe.
Planned future enhancements:
Normally, the simulator uses 32kB SRAM; however, it is possible to add another 32kB SRAM chip and double the simulated memory. It is connected parallel to the first one, except that the /CS pin of the second chip must be connected to the NEXT_RAM signal instead. Last address wire for the EPROM socket is then available at the pin next to R4. Unless 64k is used, it has to be jumpered closed!
In connection with a FULLY STATICAL microprocessor, the simulator will allow stepping through its code. In a special mode, the LED pin can be connected to the processor clock, and the PC will be used to step through the instructions. The PC control software can then incorporate disassemblers for various microprocessors; it should be able to dump registers, bus states, maybe peripheral states, etc. However, a fully statical microprocessor is NOT a 80C31 - it needs at least 32 kHz clock. The only fully statical microprocessors of the XX51 series we found are the ATMEL 89C5x chips. With a few modifications, the EPROM simulator can be used as a SRAM, which can be read from a PC. This enhancement, however, will have to use the enhanced EPP or ECP parallel ports with bi-directional data lines.
More useful hints:
Starting Windows 95 send a printer init string to the parallel port, which resets the EPROM simulator and invalidates any data in the SRAM.
The simulator is protected by a diode and a fuse against wrong polarity of the supply voltage. When a zener diode is used (e.g. 6V8), the fuse will protect against overvoltage as well. However, this protection works ONLY when the simulator is powered from an external source. If the simulator is powered from the microcomputer (a common practice), the protection is bypassed. So, it is recommended to power the microcomputer from the simulator (through the fuse), or to pay extra attention to the power supply voltage. Power is a very common source of problems. A dangerous mistake is to connect the PC and the microcomputer power supply to different phases, or even to different branches of the same phase in a home wiring. (Due to my home installation - my desk and my PC are in the opposite corners of the room, connected to different branches - I have blown two parallel ports already.) The safest thing to do si to connect everything into a single mains outlet, or, even safer, to power the microcomputer directly from the PC power supply. It has no problem supplying additional 0.5 to 2A at 5V, and it is short-circuit safe. If short-circuited, the power supply disconnects itself, and after approx. 250 ms it tries to restore the power. If you disconnect something, nothing happens. (Several times, even my Windows 95 did not crash - my motherboard seems to have good power filtering capabilities.)
The following images are in small resolution (75 or 150 dpi). You can download the large 300 dpi images together with the documentation and source code by following the link at the end of this document.
Printed circuit board
|Cannon 25 male into PCB
|SRAM MEMORY (either version)
|Soldering tag 4 x 1
|Soldering tag 2 x 1
|Socket DIL 28, or soldering tag 17 x 2
|Soldering tag 2 x 1
|Soldering tag 2 x 1
|Soldering tag 3 x 1
|Soldering tag 2 x 1
|Total 15x1 + 17 x 2
|Si diode, e.g. KA 261
|Zener diode 6V8
CACHE memory from a computer may be used as the SRAM. According to my experience, the 61256 and 62256 circuits are almost identical. The difference is in consumption and access speed only; none of these are a consideration here. The output connector can be either a DIL-28 socket (most often used solution; however, the sockets' mechanical parts tend to wear out), or soldering tags (with a PLF 26 connector used as their counterpart - the two edge pins, 28-26, are connected separately via a "jumper" connector for onboard supply voltage, right under the PLF connector).
The printed circuit board is fully functional.
Download & Links:
- In the Czech Republic, the PCB can be ordered at SEMACH.
The components cost about 300 Czech crown (approx. $10).
- Software including source code in Pascal (DOS) and C (Linux), schematics and PCB in GIF formats at 300 dpi are available here (in a self-extracting archive).
Translation: Joe Hlavac