2
\$\begingroup\$

I am curious to know if the communication between the computer and keyboards is unidirectional or bidirectinal.

Until a few days ago i thought the communication is unidirectional because only the keyboard sends data to the computer and the computer interprets this data.

Also the article from which I learned about simplex,duplex and half-duplex gave as simplex communication example the communication between the keyboard and the computer. http://www.iec-usa.com/Browse05/DTHFDUP.html

However I discovered that using virtual keyboard programs such as On-Screen keyboard you can actually tun on the caps lock, num lock or the scroll lock and the LED indicator turns on or OFF accordingly on the keyboard. This has to mean that the computer also sends data to the keyboard. Is this correct?

\$\endgroup\$
1

2 Answers 2

4
\$\begingroup\$

There is a difference how USB and PS/2 devices operate.

A USB keyboard doesn't send any data on its own unless the host makes a request. So the communication is definitely half duplex: host sends IN request on (differential) data line, keyboard responds with data which key was pressed or depressed, on same data wires. If data were received successfully, the host returns "ACK". If no key was pressed, the keyboard returns "NAK", and does nothing until next inquiry. Although it is a case of polling, it is called "interrupt pipe". Since the USB host is always in control (except waking up from sleep/suspend state), it can send commands to keyboard to change its configuration, like setting Numlok or Caplock.

In PS/2 protocol things are different. The communication is controlled by device. The device generates the clock and a packet of data whenever an event occurs. Still the PS/2 host can send some control data; it first toggles the clock, then the device takes over the clock, and host synchronizes its data to device clock. Then the device takes ownership of data line, and asserts "ACK" bit.

So, in both cases the single data channel is shared in both directions, so the communication is "half-duplex".

\$\endgroup\$
1
  • \$\begingroup\$ is it possible to establish serial port communication over ps2 ? \$\endgroup\$
    – CS QGB
    Feb 2, 2023 at 12:44
3
\$\begingroup\$

Yes, both PS/2 and USB are half-duplex.

(Except for USB 3.0 super speed, which is full-duplex.)

\$\endgroup\$
2
  • \$\begingroup\$ all USB 3.0 is super speed or there is a specific type of USB 3.0 that is super speed? \$\endgroup\$
    – yoyo_fun
    Aug 25, 2017 at 14:50
  • 1
    \$\begingroup\$ The USB 3.0 specification adds the definition of superspeed to the set of supported speeds, so a USB 3.0 compatible device can operate at low speed, full speed, high speed or super speed. \$\endgroup\$
    – Dave Tweed
    Aug 25, 2017 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.