Ways to achieve NKRO?

mcmaxmcmc

26 Dec 2018, 10:11

I'd like to make an NKRO keyboard in whatever ways I can; what are the ways to achieve this? I heard that USB has some limitations, but I don't know much about that. I know the fact that I'd need diodes for the matrix, but that's all I really know and I feel like there's more to that.

User avatar
matt3o
-[°_°]-

26 Dec 2018, 10:28

TMK and QMK firmwares both supports NKRO. Diodes are required to have a matrix of switches work properly and that has nothing to do with NKRO.

So basically just use one of the MCU that either of those firmwares support and you are good to go.

maartenwut

26 Dec 2018, 12:00

For QMK you have to enable NKRO in your rules.mk and add

Code: Select all

#define FORCE_NKRO
to your config.h.

Findecanor

26 Dec 2018, 14:01

There are two things you need to achieve N-key rollover:
* At each junction in your keyboard matrix, you would put a diode and a switch in series.
Spoiler:
Keyboard matrices are scanned by strobing one column at a time and reading all rows at once each time. Without diodes, if three switches in a rectangle in the matrix are activated at the same time, the current can flow backwards through them into the wrong row making it appear as if the fourth corner of the rectangle is also activated. The controller is then unable to tell whether the third, fourth or both keys have been a genuine press. A fourth key activated in this way would be called a "ghost key". All methods for avoiding ghost keys are called "anti-ghosting". They way keyboards without diodes achieve anti-ghosting is to detect these rectangles and block both opposite corners from being registered (2-key rollover: only two keys in the rectangle). Practically all commercial keyboards produced in the last 30 years or so have anti-ghosting either in firmware or by using diodes. The last commercial keyboards that didn't have anti-ghosting were maybe some numeric keypads for 8-bit computers.
(See also the wiki article on "Rollover, blocking and ghosting".)
Electrocapacitive keyboards (Topre, IBM Model F etc.) don't need anti-ghosting, but because they work in completely different ways.
* The firmware needs to support NKRO over USB. QMK, TMK and Kiibohd should all provide NKRO in all major operating systems.
Spoiler:
The USB protocol has formally always supported NKRO in its specification. However, because the protocol is a bit complex and free-form, actual USB host software (operating systems and BIOS:es) are known to have many different bugs that make it difficult.
Pretty much all of these kinks have been identified and worked around by programmers in the mech keyboard community and shared between them. Soarer was one of them, but I don't think his firmware is actively maintained.

Post Reply

Return to “Workshop”