USB mice and keyboads on the Propeller and other micro-controllers.
LoopyByteloose
Posts: 12,537
I have a mouse and keyboard set aside with DIN connectors... just to use with my dearly beloved Propellers.
But I also have a gadget with two DIN plugs on one end and a USB connector on the other that will make both the DIN mouse and DIN keyboard interface via one USB port.
For the life of me, I can't quite figure out if the the mouse and the keyboard are internally USB enabled, or if the USB port just has code that reverts to a serial mode that is really much simpler.
I suspect that the latter is the case. After all, the splitter words with mice and keyboards that were around long before USB ports.
And that leads to a second and more dire question.
How does the USB port know that there are two devices and which device is presenting data?
If we could sort this all out, I suspect I could get rid of the DIN mouse, the DIN keyboard, and the splitter and just use USB mice and USB keyboards with the Propeller.
The USB port has 4 wires.. right Or are the extra unused pin in play with the mouse and the keyboard?
If only 4 wires are in play... they are +5, ground, Sio and Sclk. Could it be that the roles of the Sio and the Sckl are reversed on the mouse and the keyboard.
Or if it is 5 wires, do they share the clock and have separate io lines, or do they share the i/o lines and have separate clk lines?
But I also have a gadget with two DIN plugs on one end and a USB connector on the other that will make both the DIN mouse and DIN keyboard interface via one USB port.
For the life of me, I can't quite figure out if the the mouse and the keyboard are internally USB enabled, or if the USB port just has code that reverts to a serial mode that is really much simpler.
I suspect that the latter is the case. After all, the splitter words with mice and keyboards that were around long before USB ports.
And that leads to a second and more dire question.
How does the USB port know that there are two devices and which device is presenting data?
If we could sort this all out, I suspect I could get rid of the DIN mouse, the DIN keyboard, and the splitter and just use USB mice and USB keyboards with the Propeller.
The USB port has 4 wires.. right Or are the extra unused pin in play with the mouse and the keyboard?
If only 4 wires are in play... they are +5, ground, Sio and Sclk. Could it be that the roles of the Sio and the Sckl are reversed on the mouse and the keyboard.
Or if it is 5 wires, do they share the clock and have separate io lines, or do they share the i/o lines and have separate clk lines?
Comments
I still wonder about two devices on one USB port and if there is an exploit of the extra USB pin.
I suppose that just providing two special use USB ports for a Propeller - one for keyboard and one for mouse is the optimal way forward. The software should be the same synchronous serial that was used with PS2 devices.
http://technix.free-message-board.com/t49-ps-2-to-usb-wiring-diagram
What you are saying is that all mice and keyboards are essentially synchronous serial with USB connectors instead of PS/2 connectors.
But if I use a splitter, it seems to also manage recognizing whether the mouse or the keyboard is active. Hows does that happen? And could I do the same with a Propeller?
It would certainly be handy to have the i/o for keyboard and mouse share pins with all the code using one Cog.
A note about the backward PS/2 compatibility in USB devices, I've read that some newer USB mouse and keyboard devices may no longer support the PS/2 connection (HP and Dell?).
Yeah, I have a bunch of tiny keyboards that are USB only.
I have not seen any code for the propeller that will work with USB only keyboards.
I've read that there is some kind of simple USB protocol that USB keyboards use (for example when you go into the bios setup) but I don't know enough about USB to figure it out.
If anyone has done this, or knows how to do it, please let me know.
Bean
The the USB uses differential signaling ( 4 pins: 5v, gnd, V+, V-), PS2 uses synchronous seral (TTL?) (4 pins: 5v, gnd, ser, clk).
I believe this is opposite of what happens. The controller in the KB or MOUSE figures out if it attached to a USB port or serial port, and sends its signals according to what it sees. Really old kb/mice will ONLY operate in serial mode. Medium old devices know to look to see if they are attached to USB or serial ports and use the appropriate communication protocol (USB or serial). Apparently some devices never even look to see if they are attached to a serial port, will only communicate via differential signaling (USB).
If it was the computer USB port deciding on whether to use serial or USB, then the marketing guys at FTDI are geniuses....
So to answer your original question, the USB is a communication bus. Whenever a device is plugged in, there is a enumeration process where the device is (hopefully) recognized by the USB bus controller. When any device on the USB bus communicates with the computer, the data packets are labeled as from a certain device.
Yes, this is how it works. The decision (if any) is made by the keyboard/mouse. It was done this way in order to ease the transition to USB devices. Consumers could buy a newer USB device and plug it into their older computer's PS/2 port using a simple pass-thru adapter and it would still work.
FTDI chips (and others, I believe) have this + ability to do enumeration for pretty low cost....
Not saying the prop couldn't do it with some circuitry, but I think you get into the 're-inventing the wheel' thing when there is already a cost-effective solution out there. I thought about it for awhile long ago, but then read 'USB Complete' by Axelson and decided perhaps my time would be more profitably spent on other projects. Would be thrilled to see if someone from here could prove me wrong....
The complexity of the enumeration process and understating pipes and endpoints.
Someone that understand it on a PC should be able to port it, but this person is probably already to busy in the corporate IT world.
http://setcomp.pl/akcesoria-do-produktow-sieciowych/34061-planet-adapter-dla-kabli-do-kvm-usb-to-ps-2.html
I seems to me that you don't need to have USB protocol to have two PS/2 devices on one set of clk and data pins via synchronous serial. And it does seem that USB mice and keyboards are NOT using USB, but legacy synchronous serial. D- as Data and D+ as Clock, while V+ and GND remain the same.
So why bother with USB overhead if it can be done with less code? As far as replicating USB in any form, I suspect that there are proprietary problems with doing so. Bean said a USB to PS/2 doesn't work for him, but there are also one to one adapters in both directions available.
I have used the 2 PS/2 to USB with a netbook. And I even have a few PS/2 to USB adapters that came with PS/2 mice. So why wouldn't the USB to PS/2 interface work if you got the right clock and data lines?
http://www.5kw.dk/Hobby/electronics/connectors/usb.htm
http://shop.acquirepc.com/product/path/66/product_id/125
And here is someone that recommends 10K pullups to avoid problems.
http://pinouts.ru/InputCables/usb_ps2_mouse_pinout.shtml
I am not sure where reality lies. non-USB keyboards are likely less costly to manufacture due to older chip sets.... even if you put a USB plug on end of the cord.
http://www.usb.org/developers/devclass_docs/HID1_11.pdf
Anytime you connect a PS/2 plugged device to a USB port (and have successful communication), either the device IS sending USB signals, or the conversion plug has an internal conversion device that is acting as a bridge between the 2 protocols/signaling voltages.
USB was designed as an 'open' standard, pretty much anyone can come and play. It was brought into being mostly to solve speed bottlenecks (differential signaling can be VERY fast and has high noise immunity), which in turn allowed for 'plug n play' as enumeration was possible/fast.
And that is about the extent of my knowledge of USB :blank:
Well there is a clock line and an synchronous serial mode. And, I believe the clock originates from the PC via the USB port. Read the pdf link in #14 above. The conversion plug seems to have bupkis. nada. zilch.....
What seems to happen is the BIOS will survey the PC's serial plug, determine if there is a USB device or a PS/2 device with adapter, and then the PC will either provide a USB host or a synchronous serial service via alternative chips on the motherboard.
But thanks... I wasn't aware that it was supposed to be an open standard.
"Appendix F: Legacy Keyboard Implementation
The boot and legacy protocols for keyboards in USB allow a system which is not
USB-aware (such as PC BIOS or IEEE 1275 boot firmware) to support a USB
HID class keyboard without fully supporting all required elements of USB. The
Boot/Legacy Protocol does not limit keyboards to this behavior. Instead, it is
anticipated that keyboards will support full HID-compatible item-based protocols
, as well as boot and legacy protocols.
F.1 Purpose
This specification provides information to guide keyboard designers in making a
USB Boot/Legacy keyboard. It provides information for developers of the system
ROM so that they can use such a keyboard without fully parsing the HID Report
descriptor. The motivation is that while the full HID class capability is
enormously rich and complex, it is not feasible to implement the required HID
class adjustable device driver in ROM. But, operator input may still be required
for either boot or legacy support."
See what is really going on with legacy devices... try here ====> http://www.computer-engineering.org/ps2protocol/
http://www.hobbytronics.co.uk/usb-host-board-v2
Well, I'm an engineer, not lawyer, but I think your quote is saying there may be some USB keyboards that do not follow the complete USB standard? As Tonyp12 implied earlier, the enumeration protocol will make your head spin....
To be clear, in your post #2, where you show someone's idea of converting a PS2 plug to a USB plug, this will only work if the device is one that does both serial and differential signaling (ie the chip in the device knows how to determine if it is on a USB or serial port). That wiring is exactly what happens when you put a PS/2-to-USB adaptor on a PS/2 plug. If you simply stick a USB plug on a device that only talks serial, it's not going to function when you plug it into a computer USB port.
The above adaptor has brains in the little box to convert between the USB signal to PS/2. It's not a pass through adaptor that comes with many keyboard capable of using either PS/2 or USB.
You can have a USB to PS/2 adapter as long as the PS/2 side connects to the PC. In this case, it's as homosapien has been explaining, the keyboard or mouse with the USB plug on it can detect if it's plugged in to a USB port or a PS/2 port and tailors the signal appropriately. This will only work with keyboards and mice which look for a possible PS/2 signal.
If you have a USB only keyboard or mouse, there's nothing to be done without some sort of intelligent convertor. The convertor would need to be more intelligent than the adaptor in the link quoted above since it would require the adaptor to be a USB host device.
(BTW, I'm pretty much saying the same thing as homosapien as others are saying.)
Done in asm so porting(getting ideas) to pasm should be possible.
The USB may officially be an open-standard, but if this is open source documentation ... it seems as if it is trying to make it as difficult as possible to read. I have similar problems trying to interpret info on SDcards.
The MAIN idea was that I was hoping that there were keyboards and mice that had a USB plug, but were really able to support PS/2 protocol.
This would make my life simpler. If that were true as I wouldn't have to save a PS/2 mouse and keyboard for use with the Propeller. And I wouldn't have to hang onto Propeller Proto Boards for the PS/2 plugs.
I have no ambitions of making a Propeller work as a USB Host. I think that has been discussed before and has been abandoned. It would just be easier to have an FTDI chip provide the USB Host services.
The muddle is that there are all sorts of USB to PS/2 and PS/2 to USB adapters floating around in the after-market. Some, such as the USB to PS/2 appear to be a useless deception.
Yes, the vast majority of keyboards and mice made work this way. It has been stated as such several times in this thread. When they are connected to a computer, if they do not get queried by the computer's USB controller they automatically fall back to PS/2 compatibility mode.
These devices need a simple pass-thru USB to PS/2 adapter to work correctly on a computer PS/2 port, but only to fit mechanically. The adapter has no effect on the electrical functioning. Bear in mind that they are all actually USB devices, not just PS/2 device with a USB plug. It would not make sense to have a USB plug on something that wouldn't work if plugged into a USB port.
There is no simple pass-thru adapter to go the other way, from PS/2 to USB. Something with active electronics, like an FTDI chip, is required for that.
Note that it is certainly possible to use a USB type plug on a PS/2 device (or anything that needs 4 wire or less to connect), but that would be very non-standard and does not make it a real USB device. The potential for end user confusion would be considerable.
You may find this post at Quinn Dunki's Blondihacks blog interesting.
http://quinndunki.com/blondihacks/?p=1347
And I find it a real pity that the mouse and the keyboard appear to be migrating over to USB only interface. If the splitter does indeed have a PS/2 to USB converter chip within, that won't save the day when the stores no longer sell PS/2 mice and keyboards.
Both the mouse and the keyboard are important and extremely useful to the Propeller via the PS/2 protocol. A USB solution will likely cost more in either Propeller resources to support or a USB host chip between the Propeller and the mouse or keyboard.
If you think you don't need PS/2, consider the fact that the optical mouse can also be set up on a rotating disk as a rotation encoder that works very well, and the disk can be an old standard CD or a smaller 3.5" CD.
Also having a bar code reader that provides data via PS/2 makes the Propeller a powerful data accumulator.
Forgive me, but I was hoping for something that is not meant to be... preserving a legacy protocol for the sake of its usefulness to students and hobbyist.
So buy some with the PS/2 plug and stop worrying about it. Newegg currently sells dozens of different PS/2 keyboards and mice, in addition to those that work with either PS/2 or USB. I'm sure they're available almost everywhere.
There have been millions and millions of PS/2 devices built in the last 20 years and it looks like they'll be around for quite a bit longer. It's not much of a gamble to buy a USB version and hope it works as PS/2 also, odds are highly in your favor that it will. Honestly, I fail to see any reason to go on and on about this. As far as I can tell it's a non-issue.
I will definitely vouch for that happening in Taiwan. I've seen dozens of stores with those older GPU cards going for about $20. When I decided which ones I wanted and which ones had the proper bus and which ones I could program, and went back with cash to buy a truckload to build a bigger supercomputer, none could be found. They were all replaced with just one thing, the newest GPU cards to hit the market at up to $1,200 bucks a wack. If you need PS/2 keyboards and you see one at the store, you better grab it while it's there. Yes there are visitors from all over the world in HK but I never saw $20 GPU cards at their computer parts stores. I think they were phased out when prime before Taiwan's.
how else is Mini display port able to break out to VGA DVI/HDMI
Depending on the port that is used .... the Pins are Digitally routed to the correct side of the chip and its Line drivers .