EPROM LPT Programmer?

Discuss hardware-related topics, such as development cartridges, CopyNES, PowerPak, EPROMs, or whatever.

Moderator: Moderators

User avatar
FARID
Posts: 499
Joined: Wed Apr 07, 2010 1:14 am
Location: Iran
Contact:

EPROM LPT Programmer?

Post by FARID »

In order to learn some basic info about eprom programmer I want to make this : EPROMr

Image

Image

It seems that the source code of the software is not available, so I wrote my own :

Code: Select all

#include <stdio.h>
#include <dos.h>

void main ()
{
	long int i;

	outportb ( 0x37A, inportb(0x37A) & 254 );		/* Set reg0 [pin1] to low >> set reset to high */
	outportb ( 0x37A, inportb(0x37A) | 1 );			/* Set reg0 [pin1] to high >> set reset to low */

	FILE *fp;
	fp=fopen ("read_eprom.bin", "wb");			/* Create a file to store data of eprom */

	for ( i=1 ; i<=1048576 ; i=i+1 )			/* 1048576 dec = 100000 hex */
	{
		putc (inportb(0x378), fp);			/* Read eprom data and save it to the file */

		outportb ( 0x37A, inportb(0x37A) | 4 );		/* Set reg2 [pin16] to high >> set clock to high */
		outportb ( 0x37A, inportb(0x37A) & 251 );	/* Set reg2 [pin16] to low >> set clock to low */
	}

	fclose(fp);
}
But I haven't tested it yet.
Do I have to use any delay between clocks inside of the for loop?
By the way my code is only for 27C080 (1MB) EPROM.
Last edited by FARID on Mon Sep 11, 2017 12:31 pm, edited 1 time in total.
User avatar
krzysiobal
Posts: 1036
Joined: Sun Jun 12, 2011 12:06 pm
Location: Poland
Contact:

Re: LPT EPROM Reader?

Post by krzysiobal »

Use Atmega32+VUSB instead of crappy old slow LPT with unknown response times.
Unless you use pure realtime DOS.
User avatar
Fisher
Posts: 1249
Joined: Sat Jul 04, 2015 9:58 am
Location: -29.794229 -55.795374

Re: LPT EPROM Reader?

Post by Fisher »

That's great Farid!!
Thanks for sharing!! Now I have another reason to try to build this burner. :D
Unfortunatelly, I don't think this will compile under Linux... :cry:
Maybe with some small modifications.

@Krzysiobal:
I don't know much about the inner workings of the paralel port, and I really think there are better options around.
But it seems very simple and inexpensive to use it.
Back in the day there was many stuff that successfully used it.
I've even been using an N64's GameShark inside a Win98 virtual machine without issues.
Maybe it's because I'm still using a PC wich have an onboard paralel port...
By the way, I think the gamecon driver rocks!!
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: LPT EPROM Reader?

Post by lidnariq »

FARID wrote:Do I have to use any delay between clocks inside of the for loop?
Access to these I/O ports is often really slow. Your code will assemble into several INB and OUTB instructions and the last time I tried this I wasn't getting faster than ~500ns per write.

You probably don't need to add anything.
User avatar
FARID
Posts: 499
Joined: Wed Apr 07, 2010 1:14 am
Location: Iran
Contact:

Re: LPT EPROM Reader?

Post by FARID »

krzysiobal wrote:Use Atmega32+VUSB instead of crappy old slow LPT with unknown response times.
Unless you use pure realtime DOS.
I try to keep it in my mind for future projects, but for now I want to keep this thing as simple as possible.
Fisher wrote:That's great Farid!!
Unfortunatelly, I don't think this will compile under Linux... :cry:
Maybe with some small modifications.
Here is a code for linux : https://outflux.net/software/pkgs/EPROM/
Hardware info : https://outflux.net/software/pkgs/EPROM/mirror/
lidnariq wrote:Access to these I/O ports is often really slow. Your code will assemble into several INB and OUTB instructions and the last time I tried this I wasn't getting faster than ~500ns per write.
How fast is it possible to access an EPROM to read or write it?

I modified the schematic to work with my code, does it look ok?
Attachments
schematic.png
schematic.png (8.63 KiB) Viewed 7525 times
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: LPT EPROM Reader?

Post by lidnariq »

FARID wrote:How fast is it possible to access an EPROM to read or write it?
If you have a tight assembly loop, you can probably get a read speed of not more than ≈2MHz? Random projects implementing parallel port logic analyzers show speeds roughly around that.

Remember that you have to configure your parallel port to use its data pins as an input, not an output. How depends on whether the port is running in "Bidirectional", "ECP", or "EPP" mode. Depending on things, you might find it simpler to use the status pins and control pins to accept input from the ROM instead of the data pins, and instead use the data pins to reset and clock the counters.

Schematic looks like it matches your code.
User avatar
FARID
Posts: 499
Joined: Wed Apr 07, 2010 1:14 am
Location: Iran
Contact:

Re: LPT EPROM Reader?

Post by FARID »

Well It didn't work! :cry:
So this is way too tough than it seems at first even for a simple read operation!
Here are some notes I found out from googling :

I have to use only EPP mode and not SPP or ECP.

Reg5 of Control pin is used for Enabling Bi-directional mode for D0 ~ D7 [pin2 ~ pin9]. So I have to set it to 1 to enable this feature.

Before you can start any EPP cycles by reading and writing to the EPP Data and Address Ports, the port must be configured correctly. In the idle state, an EPP port should have it's nAddress Strobe, nData Strobe, nWrite and nReset lines inactive, high. Some ports require you to set this up before starting any EPP Cycle. Therefore our first task is to manually initialise these lines using the SPP Registers. Writing XXXX0100 to the control port will do this.

The Status Port has one little modification. Bit 0, which was reserved in the SPP register set, now becomes the EPP Time-out Bit.
The EPP Timeout bit we have already discussed. When this bit is set, the EPP port may not function correctly. A common scenario is always reading 0xFF from either the Address or Data Cycles. This bit should be cleared for reliable operation, and constantly checked.

Image

1. Program reads EPP Data Register. (Base + 4)
2. nData Strobe is asserted if Wait is Low (O.K. to start cycle)
3. Host waits for Acknowledgment by nWait going high
4. Data is read from Parallel Port Pins.
5. nData Strobe is de-asserted.
6. EPP Data Read Cycle Ends.

Visual Basic for Electronics Engineering Applications : page 419 :
The control signals used to perform the bus cycles are fairly simple. As a
example, consider an address write cycle. To begin an address write cycle, the
host places an 8-bit address on_ADO-AD7 and pulls Write (indicating that the
host is doing a write operation) and AStrb (indicating that the information on
ADO - AD7 is an address) low. The peripheral device corresponding to the
address responds by setting Wait high to indicate that it recognizes it's being
addressed and is ready to receive the address byte. Upon seeing Wait go high,
the host de-asserts AStrb. This action signals the peripheral to read and store the
byte on ADO-AD7 to use as the register address for following data cycles. The
peripheral then pulls Walt low to indicate that it's ready for a new bus cycle, and
the host ends the current bus cycle by removing the signals from ADO-AD7 and
setting Write back high.
A data read bus cycle proceeds in much the same manner. The Dstrb and Wait
lines are the handshake signals that coordinate the data transfer, and the state of
the Write line determines whether the bus cycle is a read cycle or a write cycle.
Last edited by FARID on Wed Aug 30, 2017 6:29 am, edited 2 times in total.
User avatar
FARID
Posts: 499
Joined: Wed Apr 07, 2010 1:14 am
Location: Iran
Contact:

Re: LPT EPROM Reader?

Post by FARID »

Now I feel that EPROMr doesn't use the real EPP handshake.

It seems that EPROMr (and it's other mods) uses SPP and tries to generate the handshake signals manually by using the software.

Here is the summery of the pin function for different projects of EPROMr :

EPROMr v1.0
Pin1 ==> Reset
Pin14 ==> Clock-hi
Pin16 ==> Clock-low

EPROMr v2.0
Pin1 ==> Clock
Pin14 ==> Reset
Pin16 ==> /GVPP

EPROMr 27C801 v1.0
Pin1 ==> Clock
Pin14 ==> Reset
Pin16 ==> /GVPP

EPROMr 27C801 v2.0
Pin1 ==> Clock
Pin14 ==> /CE
Pin16 ==> Reset
Pin17 ==> /GVPP

While according to this reference I feel in order to use the real EPP handshake the pin functions must be :
Pin1 [Output /C0 Write] ==> EPROM /GVPP
Pin11 [Input /S7 Wait] <== Can be generated with Q0 of 4040 :idea: ?
Pin14 [Output /C1 Data Strobe] ==> 4040 Clock
Pin16 [Output C2 Reset] ==> 4040 Reset
Pin17 [Output /C3 Address Strobe] ==> EPROM /CE

Image

Please let me know if I wrong :?:
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: LPT EPROM Reader?

Post by lidnariq »

Unfortunately, I've never done parallel port projects that went beyond the capabilities of the SPP.

Certainly the thing you've describes as "EPROMr 27C801 v2.0" uses the parallel port in SPP mode.

Are you specifically trying to support programming the 27C801 ? It'd be much easier if you didn't.

Looking for information, I found a example "breakout" schematic that basically shows the EPP as nothing more than two multiplexed 8-bit bidirectional ports via the standard pinout. Think of pin 1=/C0=/Strobe as "Read//Write", and /AddrStrobe and /DataStrobe as inverted forms of NES's +M2.

For read-only, you want something more like
Pin 1 = /C0 = Read//Write = /Strobe → inverter → EPROM Vpp//OE
Pin 11 = /S7 = /Wait = /Busy ← inverter ← RC delay from /DataStrobe (should be set to match the ROM's access speed)
Pin 14 = /C1 = /DataStrobe = /ALF → EPROM /CE and also '4040 clock
Pin 16 = +C2 = /Reset = +Init → what you said
Pin 17 = /C3 = /AddrStrobe = /SelP — unneeded

Programming is a bit more complicated, because the UVEPROM programming protocol requires reading and writing the same address repeatedly until either the data read back matches, or it times out.
User avatar
FARID
Posts: 499
Joined: Wed Apr 07, 2010 1:14 am
Location: Iran
Contact:

Re: LPT EPROM Reader?

Post by FARID »

Are you specifically trying to support programming the 27C801 ?
For now I am testing it with AT27C080
It'd be much easier if you didn't.
What do you mean?
lidnariq wrote: Pin 11 = /S7 = /Wait = /Busy ← inverter ← RC delay from /DataStrobe (should be set to match the ROM's access speed)
Pin 14 = /C1 = /DataStrobe = /ALF → EPROM /CE and also '4040 clock
How can I invert the signal?
Will this circuit do the job? :
Attachments
inverter.png
inverter.png (1.76 KiB) Viewed 7201 times
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: LPT EPROM Reader?

Post by lidnariq »

FARID wrote:
It'd be much easier if you didn't.
What do you mean?
If you didn't add support for programming/burning. If you only supported reading.
How can I invert the signal?
74'04, e.g.

There's a huge variety of parts that can be used as an inverter. 74'00 through 74'07, '10, '12-'14, '18, '22-'30 ... and, yes, the simple single-BJT inverter you made also.

The "trivial breakout" schematic I found was just
* 74'00 (generating /RD=NOT(READ//WRITE) and /WAIT=NAND(/DSTROBE,/ASTROBE) )
* 74'32 (generating all four possible combined strobes: /WRDATA=OR(/DSTROBE,R/W), /WRADDR=OR(/ASTROBE,R/W), /RDDATA=OR(/DSTROBE,/RD), /RDADDR=OR(/ASTROBE,/RD))
* two 74'244s (relaying two external 8-bit buses to the parallel port's D pins on /RDADDR and /RDDATA)
* two 74'273s (latching two external 8-bit buses from the parallel port's D pins on /WRADDR and /WRDATA)
User avatar
FARID
Posts: 499
Joined: Wed Apr 07, 2010 1:14 am
Location: Iran
Contact:

Re: LPT EPROM Reader?

Post by FARID »

I want to use 5v from USB and boost it to 12.75v (VPP) and 6.25v (VCC) for programming the EPROM.
I found these two chip :

MC34063
Image

LM2577
Image

Which one is better to use?
Any better option?
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: LPT EPROM Reader?

Post by lidnariq »

Easier to start with a higher voltage power source and use linear regulators to drop it down to the two operational voltages. I know, wall warts are déclassé.

Anyway, both are capable of more current than programming will need, both require the same number of external parts. I'd pick based on price or ease of obtaining.

A little caveat: parallel ports switched to operating at 3.3V about the same time as PCI slots started being used. 27xxx UVEPROM programming appears to use TTL voltages so you're probably safe. Do be careful during the read phase of programming that you don't expose the parallel port to 6.5V. (It won't like that)
User avatar
FARID
Posts: 499
Joined: Wed Apr 07, 2010 1:14 am
Location: Iran
Contact:

Re: LPT EPROM Reader?

Post by FARID »

Reading EPROM works fine on windows xp.
Reading a AT27C080 takes 40 seconds.
To be able to access LPT port under windows xp I had to use inpout32.dll
I use MS visual C++ v6.0 to compile the code.
Attachments
Test.jpg
Code_Schematic.zip
(19.7 KiB) Downloaded 164 times
User avatar
FARID
Posts: 499
Joined: Wed Apr 07, 2010 1:14 am
Location: Iran
Contact:

Re: LPT EPROM Reader?

Post by FARID »

So I decided to use MC34063 to boost 5v to 12.75v, because it is inexpensive and small.
I checked it's datasheet and in page 13 there is an example circuit for 12v --> 28v but I want 5v --> 12.75v so I have to recalculate the parts value.
In page 14 there are some great and awesome formula for calculation the values, but calculation manually is a real pain in the @$$!
Fortunately I found this online calculator for MC34063
There are four parameters :
V_in : 5v
V_out : 12.75v
I_out : 50mA (according to page 15 of M27C801 datasheet : Ipp)
V_ripple : ?
f_min : ?

There is a note in MC34063a datasheet page 13 :
fmin = Minimum desired output switching frequency at the selected values of V_in and I_out
Vripple = Desired peak-to-peak output ripple voltage. The ripple voltage directly affects the line and load regulation and, thus, must be considered. In practice, the actual capacitor value should be larger than the calculated value, to account for the capacitor's equivalent series resistance and board layout.

So how to find the correct value for them?!
Post Reply