Problems with ParallelPort and FEZ_Rhino

Hi.
Trying to use the new ParallelPort feature in the new firmware on a FEZ Rhino. But i’m stumbling on some problems. In the beta documentation it stands that you use LSb, [IO61, IO62, IO63, IO64, IO65, IO21, IO66, IO67]. That is easy enough, but when i try to find the IO61 pin in the pin reference (Broch_FEZ_Rhino.pdf) i cant find it. And when i look in the Reference in FEZ_Pin.Digital i cant find the IO61 pin.
Did i do anything wrong or is this maybe a reason why we got betas, or did anyone steal my IO61 pin.

May someone enlighten me? :slight_smile:

ParallelPort can be used on any pins and it is much faster than managed code… But those listed are even faster as explained in documentation. They are used for internal reasons on certain platforms. So don’t mind them.
IO61 on Rhino is connected actually to USB client power.

ahh…
I see it now, was a little fast in the reading of the documentation, and got little hanged on the line “Data pins [italic]must[/italic] be, starting from LSb, [IO61…”

Going managed parallel to native parallel, it is hundreds of times faster. Now using those specific pins it is even 10 times faster. Not using the “special pins” will still be very fast compared to managed.

It’s nice that you get 10 times faster speed when you use pin IO61, but not that nice when I’m unable to use it on the Rhino.

Well I’m still a little stuck on the parallelPort part. I’m trying to read 8 bits but i don’t quite understand what the writePin and readPin are doing. The API says
"readPin
Type: Pin
This pin must be provided when the read functionality is used. Otherwise, it can be Cpu.Pin.GPIO_NONE. The pin is active low."

Ok, so i have to provide it, but what to do with it?
Under is the code i use.


Cpu.Pin[] parPin = new Cpu.Pin[8] {   (Cpu.Pin)FEZ_Pin.Digital.IO51, 
                                      (Cpu.Pin)FEZ_Pin.Digital.IO52, 
                                      (Cpu.Pin)FEZ_Pin.Digital.IO53, 
                                      (Cpu.Pin)FEZ_Pin.Digital.IO54, 
                                      (Cpu.Pin)FEZ_Pin.Digital.IO55, 
                                      (Cpu.Pin)FEZ_Pin.Digital.IO56, 
                                      (Cpu.Pin)FEZ_Pin.Digital.IO57, 
                                      (Cpu.Pin)FEZ_Pin.Digital.IO58 };

ParallelPort pp = new ParallelPort(parPin, Cpu.Pin.GPIO_NONE, (Cpu.Pin)FEZ_Pin.Digital.IO16);
byte[]bb = new byte[1];
pp.Read(bb, 0, 0);
Debug.Print("Data: " + bb.GetValue(0));

Anyone that might enlighten me?

If the device, you are using parallel port with, has a dedicated pin that has to be pulled high to switch into the “read” mode, then you can specify it there. Read method will pull it high internally for you.

What are you using ParallelPort with? Is there a spec sheet?

No, I’m just sniffing slow parallel data between two other devices. I should therefor just let the readPin be? Could i use “Cpu.Pin.GPIO_NONE” on both read and writepin?

Yes, you can use GPIO_NONE for both.

http://www.ghielectronics.com/beta_01979/Library%20Documentation/html/5ec7d62a-e6d6-0e84-cec2-aea1349b6c39.htm

These are used to latch data for read/write.

For example in writing, the data is written to the data pins and then write pin is toggled to make the other end read the data.
Similarly, when you need to read, you toggle the read pin first and then read the data from the data lines.
Parallel devices should have a write or read pin… It doesn’t make sense to have both as NONE, how would you otherwise signal that you need to write or read?

I’m going to use it as a logic analyzer on a slow 8 bit parallel bus. I’m not going to interfere with the devices only sample the communication 20-30+ times/s.

I guess you have to provide a dummy read pin in this case. Put one of the IOs you are not using.