Rollover, blocking and ghosting

From Deskthority wiki
Jump to navigation Jump to search
Diodes on the Zenith Supersport SX keyboard

Rollover, blocking and ghosting are inter-related terms which often come up in discussions of a keyboard's ability to register multiple keys at once. Often confusion exists over what exactly they correspond to, which is exacerbated by overzealous marketing departments using them in misleading ways, or using the terms interchangeably.

Ghosting

Ghosting is a potential issue where certain combinations of three or more keys can cause an additional key to be registered. Ghosting is a rare problem, and is a sign of a serious design flaw in the keyboard. Many manufacturers misuse the term "ghosting" to refer to blocking, or use the term "anti-ghosting" to refer to a gaming optimized matrix.

To simplify the circuitry, the keys on the keyboard are wired into a grid, known as the keyboard matrix. The keyboard controller applies current to each column in the matrix in turn, and checks to see which rows output current. This indicates which grid intersections within that column are closed switches, i.e. depressed keys. Ghosting occurs when current flows the wrong way around the matrix and causes a row to output current when it should not.

The following highly simplified example matrix shows three keys depressed, W, E, and D:

Matrix scan current flow without diodes.svg

The matrix has applied current to column B to test which keys in that column are depressed. Current is flowing through switch B1 and out of row 1, so the B1 intersection—the W key—is detected.

Current also flows the wrong way through switch C1, then down through C2 and out of row 2. Since the keyboard controller is only applying current to column B, it mistakes current in row 2 as being an indication that switch B2 in that column—the S key—is depressed. This switch is the "ghost": the computer will see the S key (switch B2) as being depressed when it is not.

This reverse current flow can be prevented in some keyboards with the use of diodes. Diodes are electronic circuit components that only pass current in one direction. The diode protecting switch C1 prevents current flowing through it, and switch B2 is no longer mistakenly detected:

Matrix scan current flow with diodes.svg

A longer explanation of this process can be found at dribin.org.

Diodes can only be used on keyboards which have a rigid printed circuit board. Membrane keyboards such as rubber dome and most buckling spring keyboards have nowhere to mount diodes, and cannot support diode protection. Capacitive keyboards do not have electrical switches and as such are immune to this problem from the start, although typically they do have a PCB.

Keyboards without a PCB solve this problem using blocking: the controller will limit the number of keys pressed concurrently to a safe limit. Since ghosting occurs when three out of four keys are pressed within a square section of the matrix (which typically does not correspond to a group of four physical keys), the safe limit is considered to be two keys: any third key pressed after that is simply not registered, to protect against the third key causing ghosting to occur. Such keyboards are referred to as two-key rollover, or 2KRO. Keyboards with diode protection that can detect an unlimited number of simultaneous keypresses are termed N-key rollover, or NKRO.

Blocking

Blocking is a means of preventing ghosting where the controller is programmed to detect combinations of key presses that can cause ghosting, and ignore all of the keys that could be the result of ghosting. Blocking is a simple and common way of solving the ghosting problem, but leads to dropped/ignored key presses, which is problematic for gamers.

Game optimized matrix

This term, and others like it, are used by manufacturers to describe a keyboard whose switching matrix has been designed in such a way to prevent blocking occurring on certain commonly used gaming combinations. It does not eliminate blocking, it merely tries to avoid it for certain uses. In many instances, it is little more than marketing hype, and does not provide a tangible benefit over a regular keyboard. However, on some keyboards the quality of optimisation means that it is almost as good as a NKRO keyboard for most usage.

See controller matrix traces for specific matrixes and their quirks.

Key rollover

Key rollover is a measure of how many keys can be simultaneously registered by the keyboard. There are a number of types of rollover that keyboards can have, and any limitations they have arise from different problems and have different effects.

n-key rollover

n-Key Rollover, usually called NKRO, refers to a keyboard that suffers from neither blocking nor ghosting. In a true NKRO keyboard, any number and or combination of keys can be pressed simultaneously, and all will be registered correctly.

A technical explanation of NKRO

Implementing NKRO involves preventing ghosting from happening on the electrical level, there are two ways in which this can accomplished -

  • The keyboard can be built with switches that don't allow current to find its way through unintended paths, such as capacitive or Hall effect switches.
  • Insert diodes along the the switching matrix's columns to ensure that current can only flow in the correct direction.

Both of these were common practice up till the mid eighties, where cost cutting led to blocking becoming the standard way to prevent ghosting.

Interface-limited NKRO

The USB Human Interface Device (HID) protocol fully supports N-key rollover. However, the compatibility version of HID that all present systems implement limits USB keyboards to reporting a mere six regular keys together with four modifiers. Additional keys pressed beyond the limit will generally cause some of the other keys to be dropped.

Many USB keyboards implement workarounds to bypass this limit; the most common trick is to simulate multiple endpoints, e.g. the keyboard pretends to be a USB hub with several keyboards attached. When more than six keys are pressed simultaneously, the keyboard controller simulates up to six keys coming from one of its virtual keyboards, and the rest coming from its other virtual keyboards.

These sorts of tricks lead to compatibility issues with certain systems; see NKRO-over-USB issues for a workaround to this problem.

2KRO, 6KRO and others

Sometimes, key rollover is described using a number. This practise is somewhat confusing because it means different things in different contexts. The convention used by all serious keyboard brands is to use a number that represents the worst case of all possible key combinations on a keyboard.

2KRO is often used to describe a keyboard with blocking, and is meant to be read as "any combination of two keys are guaranteed to work, and some combinations of three or more keys will work, but others will not".

6KRO is often used to describe a keyboard that is NKRO inside but which is limited by the variant of the USB protocol it uses. This variant is often chosen because it has the least problems with finicky hosts. It allows six arbitrarily chosen keys plus any combination of the four pairs of modifiers (Shift, Control, Alt and Windows/Command).

Some rollover quantities greater than 6, such as 12KRO, 18KRO or 22KRO are used to refer to heavily optimised matrices, or interface-limited NKRO keyboards that have got around the 6 key limit.

10KRO and 14KRO are sometimes used by brands that don't adhere to the industry-standard convention for counting rollover. It most often means 6KRO over USB but counted as 6 keys + modifiers (4 or 8)

Transposition errors

Transposition errors are when a number of keys entered in rapid succession are registered in the wrong order. For example, typing A then B then C, and the keyboard registering ACB or BAC. As with ghosting, this is the result of a design flaw in the controller, and is not considered acceptable failure. These errors have been spotted in certain low quality mechanical keyboards.

Testing key rollover

External links