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)
registervalue (hexadecimal)
data55555555
control7c7c7c7c
statusbcbcbcbc
dma control01010101
interrupt status00000000
interrupt maskfcfcfcfc
timer 100000000
timer 200000000
timer 300000000
timer 400000000

Experiment 8

Connect pin 3 (D1, low) to pin 12 (+paper end)
registervalue (hexadecimal)
statusdcdcdcdc

Experiment 9

Connect pin 3 (D1, low) to pin 13 (+select)
registervalue (hexadecimal)
statusecececec

Experiment 10

Connect pin 3 (D1, low) to pin 15 (-error)
registervalue (hexadecimal)
statusf4f4f4f4

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)
registervalue (hexadecimal)
data55555555
control3f3f3f3f
statusbcbcbcbc
dma control01010101
interrupt status00000000
interrupt maskfcfcfcfc
timer 100000000
timer 200000000
timer 300000000
timer 400000000
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

registervalue (hexadecimal)
dataf1f1f1f1
control3f3f3f3f
statusfcfcfcfc
dma control01010101
interrupt status00000000
interrupt maskfcfcfcfc
timer 100000000
timer 200000000
timer 300000000
timer 400000000
pinvalue (volt)signal name
15-strobe
25+d0
30+d1
40+d2
50+d3
65+d4
75+d5
85+d6
95+d7
pinvalue (volt)signal name
105-ack
115+busy
125+paper end
135+select
145-auto feed
155-error
165-initialize
175-select input
18-250ground
Some remarks: Now let's try to have strobe go active...

Experiment 2

registervalue (hexadecimal)
dataabababab
control3e3e3e3e
statusfcfcfcfc
dma control01010101
interrupt status00000000
interrupt maskfcfcfcfc
timer 100000000
timer 200000000
timer 300000000
timer 400000000
pinvalue (volt)signal name
10-strobe
25+d0
35+d1
40+d2
55+d3
60+d4
75+d5
80+d6
95+d7
pinvalue (volt)signal name
105-ack
115+busy
125+paper end
135+select
145-auto feed
155-error
165-initialize
175-select input
18-250ground
Now let's finish with the remaining outputs: afd, init, and slin.

Experiment 3

registervalue (hexadecimal)
dataabababab
control3d3d3d3d
statusfcfcfcfc
dma control01010101
interrupt status00000000
interrupt maskfcfcfcfc
timer 100000000
timer 200000000
timer 300000000
timer 400000000
pinvalue (volt)signal name
15-strobe
140-auto feed
165-initialize
175-select input

Experiment 4

registervalue (hexadecimal)
dataabababab
control3b3b3b3b
statusfcfcfcfc
dma control01010101
interrupt status00000000
interrupt maskfcfcfcfc
timer 100000000
timer 200000000
timer 300000000
timer 400000000
pinvalue (volt)signal name
15-strobe
145-auto feed
160-initialize
175-select input

Experiment 5

registervalue (hexadecimal)
dataabababab
control37373737
statusf8f8f8f8
dma control01010101
interrupt status00000000
interrupt maskfcfcfcfc
timer 100000000
timer 200000000
timer 300000000
timer 400000000
pinvalue (volt)signal name
15-strobe
145-auto feed
165-initialize
170-select input
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 namebit name
76543210
control SEL  /SLIN/INIT/AFD/STROBE
status/BUSY/ACKPEONLINE/ERRORNOINK
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.


Copyright © 2001-2008 Vincent Stehlé ( vincent.stehle@free.fr).
GNU Free Documentation License 1.2