OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 7:21 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Using the PS/2 Ports as General Ports
PostPosted: Wed Nov 26, 2014 1:44 am 
Offline
Member
Member
User avatar

Joined: Fri May 14, 2010 3:46 pm
Posts: 62
Location: New York, NY
So I was flipping through the 8042 spec.
You can turn the clock off it would seem, and set the data bit from the controller output port.
Does that technically mean that I can bitbang serial data over the two PS/2 Ports?
I know this is not technically standard... but it'd be cool for serial data other than PS/2 usage. (MIDI comes to mind)

_________________
"On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."
Image


Top
 Profile  
 
 Post subject: Re: Using the PS/2 Ports as General Ports
PostPosted: Wed Nov 26, 2014 4:05 am 
Offline
Member
Member

Joined: Tue Nov 08, 2011 11:35 am
Posts: 453
Using LPT port (8255) is much simpler for this task and real LPT port is much easily to find than "close-to-real 8042" (PS/2 controller that is emulated by LPC chip or south bridge may lack such "disable clock" feature). Btw, bit-banging often requires very good timekeeping (I mean that you should keep width of pulses with a good accuracy unless you want to play with 1-wire interface devices that are very tolerant to changing pulse width), I'm not sure if you can easily achieve it with such interface.

Btw, using external GPIO board (based on FTDI232, CP21xx or Atmel or Cypress MPU) that is connected via USB would be a much better solution (no usage of legacy ports that are becoming rare, no efforts to implement low-level port manipulations, no wasted CPU time and bus bandwidth to keep synchronization, higher possible data rate).

TL;DR: you can try it but real 8042 can be found only on Pentium1 and older motherboards. On newer boars it's emulated and emulation chip may lack features that are rarely used. I should also notice that it would be rather hard to implement and data rate would be very low.


Top
 Profile  
 
 Post subject: Re: Using the PS/2 Ports as General Ports
PostPosted: Wed Nov 26, 2014 11:49 am 
Offline
Member
Member
User avatar

Joined: Fri May 14, 2010 3:46 pm
Posts: 62
Location: New York, NY
One thing that struck me that I could do was the Apple Desktop Bus Connector. It'd just take a PS/2 to SVideo Adaptor (I'm not above splicing wires)
The LPT port probably would work better, but the thought was "Lots of computers have unused PS/2 Ports, What's a good use for them?"

_________________
"On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."
Image


Top
 Profile  
 
 Post subject: Re: Using the PS/2 Ports as General Ports
PostPosted: Wed Nov 26, 2014 6:36 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

Primis wrote:
One thing that struck me that I could do was the Apple Desktop Bus Connector. It'd just take a PS/2 to SVideo Adaptor (I'm not above splicing wires)
The LPT port probably would work better, but the thought was "Lots of computers have unused PS/2 Ports, What's a good use for them?"


For bit banging purposes, the 8042 doesn't give you enough control over clock or data (and the signals on clock and data need to be synchronised - e.g. you can't send without the receiving device providing the clock signal).

The main problem is that "PS/2 serial" is quite different to "RS232 serial". For PS/2 there's one data line that's used for both transmitting and receiving, and one clock line that's used for both transmitting and receiving. For RS232 there's one "data and clock" line for transmitting, and one "data and clock" line for receiving. The other problem is PS/2 has almost nothing else; while RS232 has a bunch of other signals (CTS/RTS, ring indicator, etc).

Finally, there's a speed difference. PS/2 runs at a fixed speed of about 10 Khz, but that's shared for sending and receiving, so it's more like ~5 Khz per direction. Serial is typically faster - e.g. between 9.6 KHz and 115 KHz in both directions. This means that (even with a special electronic "PS/2 to RS232 converter" circuit) PS/2 simply doesn't have the bandwidth to run RS232 devices properly (although by using both PS/2 ports you might get enough bandwidth to do 9600 baud serial without much buffering).

As far as I know, MIDI is very similar to RS232, except MIDI is even faster (about 32 KHz).

The funny part is that for user input devices (e.g. keyboard, mouse, touchpad, joystick, etc) where you rarely need to send data to the device and the amount of data is relatively tiny; it's the latency (and not bandwidth) that matters most. For USB, the controller does polling and the bus is potentially shared by many devices; so the latency suffers. What this means is that for user input devices, PS/2 is typically better than USB.

I guess what I'm saying here is that you can't really use PS/2 for anything other than user input devices; and for user input devices you'd be struggling to find anything better.


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 32 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group