Home
Forewords
This is a little blog of my parport experiments. All raw facts and no talk :)
2004/07/14
Things seem to be reliable today. I am able to transfer loads of bytes with the tester, from the sgi to the pc:
received 10000 bytes in 721 ms (13869 Bps)
received 10000 bytes in 720 ms (13888 Bps)
received 10000 bytes in 783 ms (12771 Bps)
received 10000 bytes in 875 ms (11428 Bps)
The contrary also works, but slower. From pc to sgi:
received 10000 bytes in 1546 ms (6468 Bps)
received 10000 bytes in 1415 ms (7067 Bps)
received 10000 bytes in 1582 ms (6321 Bps)
received 10000 bytes in 1417 ms (7057 Bps)
After some thinking, this is normal. That is the receiver that drives the whole thing in the protocol, and my 150 Mhz r4400 sgi is way slower than my 1 GHz C3 pc :)
Bad news, however, as plip seems to be bOrken on my 2.6 box.
2004/07/10
I continued my parport tester. This is a little user-space program, that can read and write from the parallel port. See
here.
The following is an example output of this tool:
PLIP WIRES STATES
local | remote | value
----------+----------+-------
d0 | error | 0
d1 | select | 0
d2 | paperout | 0
d3 | ack | 0
d4 | busy | 0
error | d0 | 1
select | d1 | 1
paperout | d2 | 0
ack | d3 | 1
busy | d4 | 1
control: init select
It demonstrated I can successfully read and write to the parallel port on my indigo2. Plip should work, then.
2004/07/04
There has been a long time since I fiddled with pi1 parport. Still, this week-end I setup a decent cvs and some cross-compilers. Mips kernel compiles are way shorter, when done on 5 cpus. I plan to produce an updated patch soon...
2003/10/14
Back on track. Soldered a mode0 plip cable. Up for some more experiments !
--- 10.0.0.2 ping statistics ---
244 packets transmitted, 40 packets received, 83% packet loss
round-trip min/avg/max = 11.8/446.0/4013.3 ms
Not that good a ping, heh ?
As seen from the pc:
plip0 Link encap:Ethernet HWaddr FC:FC:0A:00:00:02
inet addr:10.0.0.2 P-t-P:10.0.0.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:616 errors:0 dropped:0 overruns:0 frame:0
TX packets:324 errors:390 dropped:0 overruns:0 carrier:390
collisions:0 txqueuelen:10
RX bytes:53011 (51.7 KiB) TX bytes:26221 (25.6 KiB)
Interrupt:7 Base address:0x378
...and from the sgi:
plip0 Link encap:Ethernet HWaddr FC:FC:0A:00:00:01
inet addr:10.0.0.1 P-t-P:10.0.0.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:324 errors:0 dropped:9 overruns:0 frame:0
TX packets:616 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:26221 (25.6 KiB) TX bytes:53011 (51.7 KiB)
Interrupt:255 Base address:0x9803
Yes, there is something wrong. It seems the indigo2 fails to see some packets, but the sgi -> pc path seems correct, at least. That must be that damned ACK again...
dmesg on the pc contains loads of:
plip0: transmit timeout(1,80)
...and on the sgi:
plip0: receive timeout(2,80)
...which means basically that the pc waits for an ack to come back, while the sgi waits for the first half of the transfer size. Looks like they missed each other :)
2002/09/04
Some progress ! Look at those logs:
Sep 3 07:43:51 mood-indigo kernel: parport0: SGI Indigo2 built-in port
Sep 3 07:43:51 mood-indigo kernel: parport0: Printer, Canon BJC-3000
Sep 3 07:43:51 mood-indigo kernel: lp0: using parport0 (polling).
(Ok, the date is wrong on my indigo, so what ? :)
Now for the somewhat bad news: I am almost able to print. Almost. This reads: I can print maybe 1cm, then it stops, in the middle of the page (by the way, not re-initing the printer between each write helps :).
2002/08/08
Back from (nice) vacation. Up for some more experiments !
Experiment 7
Connect pin 3 (D1, low) to pin 11 (+busy)
register | value (hexadecimal) |
data | 55555555 |
control | 7c7c7c7c |
status | bcbcbcbc |
dma control | 01010101 |
interrupt status | 00000000 |
interrupt mask | fcfcfcfc |
timer 1 | 00000000
|
---|
timer 2 | 00000000
|
---|
timer 3 | 00000000
|
---|
timer 4 | 00000000
|
---|
Experiment 8
Connect pin 3 (D1, low) to pin 12 (+paper end)
register | value (hexadecimal) |
status | dcdcdcdc |
- Other registers unchanged
- PE goes low
Experiment 9
Connect pin 3 (D1, low) to pin 13 (+select)
register | value (hexadecimal) |
status | ecececec |
- Other registers unchanged
- ONLINE goes low
Experiment 10
Connect pin 3 (D1, low) to pin 15 (-error)
register | value (hexadecimal) |
status | f4f4f4f4 |
- Other registers unchanged
- ERROR goes low
So, all our input bits are non-inverted.
2002/07/16
Silly me; I do not need any resistor to test the input pins. Connected a Dn to an Sn is sufficient (thanks to the local electronics resseler for pointing that). I was fooled by some schematics I had found, which used pull-up resistors:
4.7K
Sn ----+--^^^^-- +5V
|
/ ON/OFF
|
GND ---+-------- GND
...but in my case, this is sufficient:
Sn ----.
|
Dn ----'
Experiment 6
Connect pin 3 (D1, low) to pin 10 (-ACK)
register | value (hexadecimal) |
data | 55555555 |
control | 3f3f3f3f |
status | bcbcbcbc |
dma control | 01010101 |
interrupt status | 00000000 |
interrupt mask | fcfcfcfc |
timer 1 | 00000000
|
---|
timer 2 | 00000000
|
---|
timer 3 | 00000000
|
---|
timer 4 | 00000000
|
---|
- ACK goes low as expected. It seems input bits are non inverted.
2002/07/15
I have made several attempts at fiddling the parport driver during the past few days. All have failed. Some made my printer (a canon bjc3000) wake up and emit some noise at last, some had no result at all.
I need more method in the tests. A friend of mine was right: time to grab the multimeter (hi Christian !)
Experiment 1
register | value (hexadecimal) |
data | f1f1f1f1 |
control | 3f3f3f3f |
status | fcfcfcfc |
dma control | 01010101 |
interrupt status | 00000000 |
interrupt mask | fcfcfcfc |
timer 1 | 00000000
|
---|
timer 2 | 00000000
|
---|
timer 3 | 00000000
|
---|
timer 4 | 00000000
|
---|
|
pin | value (volt) | signal name |
1 | 5 | -strobe |
2 | 5 | +d0 |
3 | 0 | +d1 |
4 | 0 | +d2 |
5 | 0 | +d3 |
6 | 5 | +d4 |
7 | 5 | +d5 |
8 | 5 | +d6 |
9 | 5 | +d7 |
|
pin | value (volt) | signal name |
10 | 5 | -ack |
11 | 5 | +busy |
12 | 5 | +paper end |
13 | 5 | +select |
14 | 5 | -auto feed |
15 | 5 | -error |
16 | 5 | -initialize |
17 | 5 | -select input |
18-25 | 0 | ground |
|
- pin 25 taken as voltage reference
- pin numbering and names as described here
- input pins are in red
Some remarks:
- We see the data on the wire, so the parallel port is actually in "forward" mode after reset. Good.
- strobe is inactive. so control bit 0 is non inverted.
- idem for autofeed (control bit 1)
- idem for init (control bit 2)
- idem for select input (control bit 3)
Now let's try to have strobe go active...
Experiment 2
register | value (hexadecimal) |
data | abababab |
control | 3e3e3e3e |
status | fcfcfcfc |
dma control | 01010101 |
interrupt status | 00000000 |
interrupt mask | fcfcfcfc |
timer 1 | 00000000
|
---|
timer 2 | 00000000
|
---|
timer 3 | 00000000
|
---|
timer 4 | 00000000
|
---|
|
pin | value (volt) | signal name |
1 | 0 | -strobe |
2 | 5 | +d0 |
3 | 5 | +d1 |
4 | 0 | +d2 |
5 | 5 | +d3 |
6 | 0 | +d4 |
7 | 5 | +d5 |
8 | 0 | +d6 |
9 | 5 | +d7 |
|
pin | value (volt) | signal name |
10 | 5 | -ack |
11 | 5 | +busy |
12 | 5 | +paper end |
13 | 5 | +select |
14 | 5 | -auto feed |
15 | 5 | -error |
16 | 5 | -initialize |
17 | 5 | -select input |
18-25 | 0 | ground |
|
- Changes are in yellow
- ok, it seems we are done for strobe
- no doubt for data
Now let's finish with the remaining outputs: afd, init, and slin.
Experiment 3
register | value (hexadecimal) |
data | abababab |
control | 3d3d3d3d |
status | fcfcfcfc |
dma control | 01010101 |
interrupt status | 00000000 |
interrupt mask | fcfcfcfc |
timer 1 | 00000000
|
---|
timer 2 | 00000000
|
---|
timer 3 | 00000000
|
---|
timer 4 | 00000000
|
---|
|
pin | value (volt) | signal name |
1 | 5 | -strobe |
14 | 0 | -auto feed |
16 | 5 | -initialize |
17 | 5 | -select input |
|
Experiment 4
register | value (hexadecimal) |
data | abababab |
control | 3b3b3b3b |
status | fcfcfcfc |
dma control | 01010101 |
interrupt status | 00000000 |
interrupt mask | fcfcfcfc |
timer 1 | 00000000
|
---|
timer 2 | 00000000
|
---|
timer 3 | 00000000
|
---|
timer 4 | 00000000
|
---|
|
pin | value (volt) | signal name |
1 | 5 | -strobe |
14 | 5 | -auto feed |
16 | 0 | -initialize |
17 | 5 | -select input |
|
Experiment 5
register | value (hexadecimal) |
data | abababab |
control | 37373737 |
status | f8f8f8f8 |
dma control | 01010101 |
interrupt status | 00000000 |
interrupt mask | fcfcfcfc |
timer 1 | 00000000
|
---|
timer 2 | 00000000
|
---|
timer 3 | 00000000
|
---|
timer 4 | 00000000
|
---|
|
pin | value (volt) | signal name |
1 | 5 | -strobe |
14 | 5 | -auto feed |
16 | 5 | -initialize |
17 | 0 | -select input |
|
- Spurious status change ? Corresponds to NOINK ?
- We know more than enough about the outputs to try SPP again without checking the inputs (I lack a small resistor). My best guess is that no input is inverted.
2002/07/11
Just to double check, I tried my preceding experiment with my pc I currently use to type this text. Here are the results:
No printer connected:
data = 0x4
status = 0x7f
control = 0xcc
Printer connected, no paper:
(Only status changes)
status = 0x5f
Printer connected, with paper:
(nothing changes)
Now for the meaning of the values:
strangely, the only bit, which has changed is paper out !
Anyway, I put my first patch online here. It is against the cvs tree at oss.sgi.com, on the linux_2_4_branch.
2002/07/07
I have a parport skeleton that I can "insmod" now. I try to have CUPS/lp print through it. After all, this is the goal from the beginning :)
I wonder if I got hpc3/pi1 BUSY polarity right or wrong. My information are contradictory... It seems to be normal (high-active) after all.
2002/07/04
Well, today is my lucky day. A friend sent me some more information about
the parallel port. Thank him !
register name | bit name |
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
control | | SEL | | | /SLIN | /INIT | /AFD | /STROBE |
status | /BUSY | /ACK | PE | ONLINE | /ERROR | NOINK | DEVID(2bits) |
Note that slashed (/) signals denote 0-active signal
2002/07/03
I am trying to write a parallel port driver for Linux on an Indigo2. This is no trivial task, as the harware registers are not very well documented.
Here follows a summary of the information I have...
First, a brief summary of the available documentation:
The chip responsible for the parallel port is called IOC. It also handles serial, and much more.
Inside this chip, a macro named PI1 handles the parallel port specifically.
This chip is controled by 10 32-bit hardware registers. Their physical addresses range from 0x1fbd9800. The three first registers are: data, control and status. Unfortunately, their bit description is unknown (to me at least !)
Ok, what do we have now ?
The 3 first registers are promissing, from an SPP mode point of vue. All we have to do is guess the function of each bit of those registers. Data should not be the most difficult, if it is named correctly :)
Here are the values I have measured in three cases.
No printer attached:
data = 0
control = 0x3f3f3f3f
status = 0xfcfcfcfc
From this, I guess that our 32-bit registers are in fact 8-bit registers. Copies should have been made to avoid endianess' troubles. I also hope that, by default, data is in output mode.
Printer attached (only status changes):
status = 0x5c5c5c5c
Printer attached, no paper (only status changes):
status = 0xdcdcdcdc
I suppose that bit 7 means "no paper" when true, and that bit 5 means "error" when true. My guessing is largely inspired by the PC parallel port implementation, as the SGI people had no reason to change thinks completely.