Author Topic: Keyboard polling rate. 125hz vs 1000hz?  (Read 162279 times)

0 Members and 1 Guest are viewing this topic.

Offline Fragil1ty

  • Thread Starter
  • Posts: 551
  • Location: England
  • Abre los ojos.
Keyboard polling rate. 125hz vs 1000hz?
« on: Sun, 12 October 2014, 20:56:33 »
So with the KUL you have the option to change the polling Hz of the keyboard, but I've never really understood what that is for, I've had it on a lot of my gaming mice and what not, so does the same principle apply? does it just make the cpu collect data more often and more frequently and what not?
你搞砸了

Offline 0100010

  • Posts: 1127
  • Location: DFW, TX, US
  • Not Sure
Re: Keyboard polling rate. 125hz vs 1000hz?
« Reply #1 on: Sun, 12 October 2014, 21:43:34 »
Polling rate on a keyboard refers to how often the rows and columns are strobed to check for a key down/up event. 
  Quoting me causes a posting error that you need to ignore.

Offline Hyde

  • Posts: 2643
  • Location: Toronto, Canada
  • White Tofu Extraordinaire
Re: Keyboard polling rate. 125hz vs 1000hz?
« Reply #2 on: Sun, 12 October 2014, 21:48:02 »
Yeah polling rate refers to how frequent the computer checks the USB for data.

125 hz = 8 milliseconds and 1000 hz = 1 milliseconds.

Oh mouse it's important because you want fast and accurate movement.  But on keyboard it's mostly a gimmick because keyboards have built in delay on key strokes.

What happens is that when you press a key, the contact metal (to complete the circuit) will actually vibrate a little bit before it settles and it will register as a few keystrokes even though you only press it down once.

So they implement a delay to basically kill off all the extra keystrokes after the initial one.  It's generally a really short delay until it takes another command.

The delay typically is long enough to kill off any benefit of having 1000 hz polling rate, so people don't bother with it on keyboards.

However if you want fastest input possible then use PS2 connection since it's interrupt based, so the moment your keyboard sends a signal your computer will gets it.

Archiss ProgresTouch Retro - Gateron Yellow  |  Topre Realforce 104UW - 45g Silent  |  Topre Type Heaven  |  Beige Filco Ninja 104 - MX Red  |  Das Keyboard - MX Brown  |  Poker II - MX Red  |  Race II - MX Brown  |  Matias Quiet Pro - Matias Dampened ALPS  |  Logitech K840 - Romer G  |  Cherry MX Board 2.0 - MX Red  |  Cherry G84-4100 - ML  |  IBM Model M
Roccat Kone Pure  |  Logitech G203  |  Logitech G303  |  Logitech G302  |  Razer Naga  |  CM Storm Xornet  |  Razer Goliathus Mobile Stealth  |  Razer Goliathus Control  |  Artisan Hien  |  Artisan Hayate  |  Artisan Shiden

Offline dorkvader

  • Posts: 6288
  • Location: Boston area
  • all about the "hack" in "geekhack"
Re: Keyboard polling rate. 125hz vs 1000hz?
« Reply #3 on: Mon, 13 October 2014, 09:55:44 »
the latency from when you press a key past the actuation point and when the computer registers it is comprised of a few different things, the polling rate is a small one of them.

Basically, there's the debounce time, matrix scan rate (what 0100010 is referring to) and poll rate. If you have a quicker poll rate, then it decreases the maximum latency by a little, but it is still dominated by the debounce time.

Offline Grendel

  • Posts: 462
  • Location: OR, USA
    • Firmware for Costar Replacement Controllers
Re: Keyboard polling rate. 125hz vs 1000hz?
« Reply #4 on: Mon, 13 October 2014, 11:12:59 »
USB is a host driven bus. If a device (ie. keyboard) wants to send data (ie. a new key was pressed) it has to wait until the host (the PC) asks it to do so. During initialization a device will tell the host how often it should ask for new data, this is the USB poll-rate. Most non gaming keyboards will ask for a 10ms interval (plenty fast enough for typing.) Note that the USB poll-rate has nothing to do w/ the matrix scan rate (usually 1ms) or the debounce time (somewhere betw. 5 and 10ms), it's just how often the keyboard is asked if new data is available.
« Last Edit: Mon, 13 October 2014, 11:29:40 by Grendel »
Currently using: RK-9000WH/GR, CMS QFXT w/ Ghost Squid
- I'm game !

Offline FRD

  • Posts: 11
...
« Reply #5 on: Mon, 13 October 2014, 12:44:42 »
...
« Last Edit: Tue, 02 December 2014, 14:40:36 by FRD »

Offline Findecanor

  • Posts: 5035
  • Location: Koriko
Re: Keyboard polling rate. 125hz vs 1000hz?
« Reply #6 on: Mon, 13 October 2014, 13:14:20 »
However if you want fastest input possible then use PS2 connection since it's interrupt based, so the moment your keyboard sends a signal your computer will gets it.
The speed difference between PS/2 and full-speed USB (1000 Hz) is negligible. Sure, PS/2 is faster than 125Hz USB.

More details: A keyboard can send a key press slightly faster over PS/2 than over full-speed USB, but some keys need two or three bytes in a message in which case USB wins. On the other hand, over USB, a keyboard could update the state for all keys at once, so USB wins also if you produce more than one key event (key up/down) within the same millisecond ... and if the keyboard controller is smart enough to coalesce multiple events in the same message, which is very difficult to find out unless you have access to the source code.

Offline Grendel

  • Posts: 462
  • Location: OR, USA
    • Firmware for Costar Replacement Controllers
Re: Keyboard polling rate. 125hz vs 1000hz?
« Reply #7 on: Mon, 13 October 2014, 13:14:42 »
Does KUL even have 1000hz polling rate to begin with? I thought the requirement for higher than 125hz polling is to be a USB 2.0 device (also High Speed?).

Correct, the device has to be USB 2.0 full-speed (12Mb/s.) Windows will limit low-speed (1.5Mb/s) devices to a minimum poll-rate of 8ms (125Hz), even if the device asks for less.

While specs on the site clearly states "USB 1.1 Low Speed and PS/2 with included passive interface". I remember same case being with CM Quick Fire, advertised as having 1000hz polling rate while in reality it was same 125hz USB 1.1 Low Speed as Filco (Camo version also comes to mind). There was Soarer thread somewhere, where he brought or commented on the issue. So i'm not sure if 1000hz polling rate and PS/2 support on the keyboard mutually exclusive or not, could anyone confirm?

AFAIK full-speed and PS/2 compatibility are mutually exclusive. Any keyboard I know of supporting PS/2 via a passive USB adapter is USB 1.1 low-speed.

Also, from the Grendel reply as i understand some keyboard are still better then others in terms of overall response times. It just has to have low matrix scan rate and high polling rate still, with potential applied firmware to shorten debounce time. From all that it implies some of the gaming brands keyboards might have it. Is there any list of such keyboards?

I don't think such a list could be easily compiled because manufacturers generally don't disclose their firmware internals (matrix scan rate and debounce algorithm), my guess is that the fastest scan rate will be 1ms w/ a debounce time of 8ms (unless you are allowed to mess w/ the timing.) Just for giggles I implemented a 500us scan-rate (2kHz) w/ an individual 2ms stable debounce and 1ms polling rate in my version of the Costar Replacement Controllers firmware (default is 3ms debounce and 2ms poll rate tho, reconfigure and recompile for max. rates.) Plays well, but I couldn't tell you if it makes a difference, maybe in a pro-tournament it would ;)
Currently using: RK-9000WH/GR, CMS QFXT w/ Ghost Squid
- I'm game !

Offline Findecanor

  • Posts: 5035
  • Location: Koriko
Re: Keyboard polling rate. 125hz vs 1000hz?
« Reply #8 on: Mon, 13 October 2014, 13:33:31 »
USB is a host driven bus.
USB HID devices use Interrupt mode, which means that the keyboard can send a report without being asked. Over "full-speed" USB a report can be sent at most often every 1/1000 s, I.e. max 1000 Hz polling rate.

During initialization a device will tell the host how often it should ask for new data, this is the USB poll-rate.
No, the host can at any time tell the USB HID device how often it wants to be reminded of the current state, but the keyboard can choose to report it more often.
Most OS:es set this time interval to 0 - which means "Only when the keyboard state has changed".

I thought the requirement for higher than 125hz polling is to be a USB 2.0 device (also High Speed?).
Nope. "Full speed" = 1000Hz polling rate is in USB 1.1. "High Speed USB" introduced in USB 2.0 is even faster, and used mostly for bulk transfers.

So i'm not sure if 1000hz polling rate and PS/2 support on the keyboard mutually exclusive or not, could anyone confirm?
There is no theoretical limit, no, only engineering decisions.
The PS/2 interface is serial, driven by the device at around 1000 bytes per second. (that's bytes, not bits) The device is allowed to run slightly faster - which is how PS/2 can be faster than USB in certain situations.
If I were to write a firmware that supports both PS/2 and USB, it would polling and reporting in a main loop at 1000Hz, regardless of whether it communicates via PS/2 or USB.
« Last Edit: Mon, 13 October 2014, 13:40:05 by Findecanor »

Offline Grendel

  • Posts: 462
  • Location: OR, USA
    • Firmware for Costar Replacement Controllers
Re: Keyboard polling rate. 125hz vs 1000hz?
« Reply #9 on: Mon, 13 October 2014, 14:20:23 »
USB is a host driven bus.
USB HID devices use Interrupt mode, which means that the keyboard can send a report without being asked. Over "full-speed" USB a report can be sent at most often every 1/1000 s, I.e. max 1000 Hz polling rate.

Nope -- quote from the page I linked: "One device at a time is able to transmit to the host, in response to a direct request from the host." Further down it talks about interrupt transfers: "Interrupt transfers have nothing to do with interrupts. The name is chosen because they are used for the sort of purpose where an interrupt would have been used in earlier connection types. Interrupt transfers are regularly scheduled IN or OUT transactions, [..]."

During initialization a device will tell the host how often it should ask for new data, this is the USB poll-rate.
No, the host can at any time tell the USB HID device how often it wants to be reminded of the current state, but the keyboard can choose to report it more often.
Most OS:es set this time interval to 0 - which means "Only when the keyboard state has changed".

Wrong again. The time interval you are talking about is part of the HID specification that sits on top of the USB transport mechanism. Plus, even with a set interval the device will always create a report if the state changes. Again, the device can't report w/o being asked to report. If the device has new data it has to wait until the host is asking for it. This the host will try to do at the rate the device specifies in its endpoint descriptors, aka the USB poll rate.

I thought the requirement for higher than 125hz polling is to be a USB 2.0 device (also High Speed?).
Nope. "Full speed" = 1000Hz polling rate is in USB 1.1. "High Speed USB" introduced in USB 2.0 is even faster, and used mostly for bulk transfers.

Like I said: "Windows will limit low-speed (1.5Mb/s) devices to a minimum poll-rate of 8ms (125Hz)". And no, USB 2.0 is not "used mostly for bulk transfers". How did you get that idea ?

So i'm not sure if 1000hz polling rate and PS/2 support on the keyboard mutually exclusive or not, could anyone confirm?
There is no theoretical limit, no, only engineering decisions.

Because Windows limits the max. poll rate for low-speed devices and because there are no full-speed keyboards supporting PS/2, 1kHz USB poll-rate and PS/2 support are mutually exclusive unless you use a different OS.

The PS/2 interface is serial, driven by the device at around 1000 bytes per second. (that's bytes, not bits) The device is allowed to run slightly faster - which is how PS/2 can be faster than USB in certain situations.
If I were to write a firmware that supports both PS/2 and USB, it would polling and reporting in a main loop at 1000Hz, regardless of whether it communicates via PS/2 or USB.

You should give it a try, it's very entertaining.
Currently using: RK-9000WH/GR, CMS QFXT w/ Ghost Squid
- I'm game !

Offline Findecanor

  • Posts: 5035
  • Location: Koriko
Re: Keyboard polling rate. 125hz vs 1000hz?
« Reply #10 on: Mon, 13 October 2014, 15:07:08 »
Nope -- quote from the page I linked: "One device at a time is able to transmit to the host, in response to a direct request from the host."
Well, at the low level it is host-controlled, yes. At the higher level, the keyboard sends the reports. It can do so only at the regularly scheduled IN transactions - which in full-speed USB is every 1/1000 s, but it should not do so if it is not asked to, if the interval has not run out or if nothing has changed.

The time interval you are talking about is part of the HID specification that sits on top of the USB transport mechanism.
Yes. This is at the HID spec level, not at low level USB. See my answer above.

And no, USB 2.0 is not "used mostly for bulk transfers". How did you get that idea ?
I didn't write that. I wrote that "high speed mode" is used mostly for bulk transfers.
USB 2.0 is a superset of USB 1.1,  and USB 2.0 adds high speed mode. You can do low speed, or full speed in USB 2.0 as well.

You should give it a try, it's very entertaining.
I have written my own firmware for the ATmega32u4 (Teensy), but I am still using PRJC's USB handler. My own USB code is not ready yet.

Offline nanovolt

  • Posts: 8
Re: Keyboard polling rate. 125hz vs 1000hz?
« Reply #11 on: Sat, 16 February 2019, 10:42:32 »
I felt an urge to "refresh" this very old post
I was very curious about it, and what is all these talk about 1kHz polling rates.


first, i do play some games. the term APM is very interesting.
second, how many APM could anyone do?

lets test

mouse click only
https://jenniferdewalt.com/click_challenge.html
60s, I managed to do 180 clicks sustained. for PS controller mashers, this should be easy !

keypress only
https://scratch.mit.edu/projects/27310194/
10s alternating 2 finger on left hand only. 110 presses total.
10s alternating 1 finger each hand. 134 presses total.

this 1 is fun, mash those keys !

in reaction, everything becomes slower by at least 10x.
https://www.humanbenchmark.com/tests/reactiontime/statistics

there is a comment that in the above website, over the years, reaction time latency increased. the perception is that our new OS and complexity of browsers added latency?

some university research on people using keyboards (pdf)
https://www.google.com/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&cad=rja&uact=8&ved=2ahUKEwjpgZTi1cDgAhXHbX0KHYhOCnsQ5TV6BAgBEAg&url=https%3A%2F%2Fuserinterfaces.aalto.fi%2F136Mkeystrokes%2Fresources%2Fchi-18-analysis.pdf&psig=AOvVaw0vmPiLa2DEKensO8qW4-BC&ust=1550420798359907
average key to key interval is 120ms (8.3Hz = approx 500 APM in game terms)

including debounce and anti-ghosting, I think a 50Hz polling could be plenty (which is 3000 APM in game terms, keypress only)
if in order to have a generous key wear and tear debounce (at 10ms?), the polling rate in theory could be as slow as 100Hz. 20ms as some manufacturer datasheet suggest for extremely worn switches would mean 50Hz. which means, taking the switch to over 50million keypress?

what do you guys think about the above self tests + papers and stats, esp to influence on further designs of DIY keyboards?
this is interesting because, instead of using faster MCU, with more pins, it could be just a matter of expanding the multiplex and not have the 1kHz
« Last Edit: Sat, 16 February 2019, 10:50:54 by nanovolt »
join the resistance, it is called ... "the ohmmmmmmmmmm"

Offline tp4tissue

  • * Destiny Supporter
  • Posts: 13551
  • Location: Official Geekhack Public Defender..
  • OmniExpert of: Rice, Top-Ramen, Ergodox, n Females
Re: Keyboard polling rate. 125hz vs 1000hz?
« Reply #12 on: Sat, 16 February 2019, 11:18:59 »
For me, on the new megaman 11 game, some jumps have really small input windows. I noticed that I can not easily replicate these jumps when using 125hz.

I don't know how many hz is required, but it's definitely become easier to time, after I applied the 1000hz usb patch.


For fighting games with 1 frame or 2 frame input windows, it's been known that the 1000hz patch helps greatly.

Offline nanovolt

  • Posts: 8
Re: Keyboard polling rate. 125hz vs 1000hz?
« Reply #13 on: Sat, 16 February 2019, 14:00:57 »
yea that game requires analog controls man  :))
join the resistance, it is called ... "the ohmmmmmmmmmm"

Offline tp4tissue

  • * Destiny Supporter
  • Posts: 13551
  • Location: Official Geekhack Public Defender..
  • OmniExpert of: Rice, Top-Ramen, Ergodox, n Females
Re: Keyboard polling rate. 125hz vs 1000hz?
« Reply #14 on: Sat, 16 February 2019, 16:13:17 »
yea that game requires analog controls man  :))

what are you talking about, none of these games use analog control.

Offline nanovolt

  • Posts: 8
Re: Keyboard polling rate. 125hz vs 1000hz?
« Reply #15 on: Sun, 17 February 2019, 07:06:29 »
i know, going to the realm of 1kHz is asking for analog controls, which is why the need i just am saying
join the resistance, it is called ... "the ohmmmmmmmmmm"

Offline tp4tissue

  • * Destiny Supporter
  • Posts: 13551
  • Location: Official Geekhack Public Defender..
  • OmniExpert of: Rice, Top-Ramen, Ergodox, n Females
Re: Keyboard polling rate. 125hz vs 1000hz?
« Reply #16 on: Sun, 17 February 2019, 09:14:53 »
i know, going to the realm of 1kHz is asking for analog controls, which is why the need i just am saying