Subject: Re: interrupting parallel port lossage
To: None <bakul@netcom.com, bde@zeta.org.au, kenh@cmf.nrl.navy.mil>
From: Bruce Evans <bde@zeta.org.au>
List: port-i386
Date: 03/25/1995 00:09:06
>> >C->D == *STROBE high to DATA tri-state == 0.5 us min.

>bruce says:
>> Do you think the software needs to delay for C->D?

>Strictly speaking, yes!  Unless we set bit5 of the control
>port of a bidir.  PIO port right after taking *STROBE away
>we don't have to worry about it.

I was thinking of always checking for *BUSY to go low before
changing the data.  Then the *BUSY timing guarantees the delay.
But tmm's mail explains why you don't necessarily want to wait
for *BUSY to go low before changing the data.

The M2518 printer manual ((c) 1987) gives the incomplete timing

	A->D (data setup, strobe and hold) 3 us min.
	B->C (strobe): 1 us min.
	E->G (ACK strobe): 6 us.

So 0.5 us is too small for a general spec.

>> >E->F == *ACK low to BUSY low == 7 us min.
>> >F->G == BUSY low to *ACK high = 5 us min.

>> This is worse than I thought.  I thought F <= E for "good" printers.
>> Many printer manuals hint that F == E (approximately) but don't specify
>> exact enough timing.  The PC interface has the interrupt line connected
>> to **ACK, so the interrupt is acknowledged soon after *ACK is asserted

>I think that you are wrong about interrupt line, it is connected
>to *ACK, not **ACK.  Thus you should get the interrupt when
>*ACK is _deasserted_; i.e. at time G for a good printer.

I checked.  Unfortunately I was right.  *ACK from the printer is inverted
for the IRQ line although it is not inverted for the data register.  Sending
*ACK directly to the IRQ would also have fixed the problem of the strobe
being too short.  OTOH, interrupting on the leading edge gives better
latency.  The interrupt handler should wait 7 us (or whatever the spec
really is) for E->F.

>The more I think about it, the more I am convinced that the
>key is to keep the STROBE asserted until we see BUSY being
>asserted by the printer.  Software should not worry about
>*ACK at all.

I don't like this.  You won't be able to see BUSY change unless
it goes high for a few us, and the spec doesn't seem to guarantee
that it goes high at all.

Bruce