3.05K views
0 Comments

Since the boards work over a USB converter, what is the polling rate for the keyboards? I assume it’s either 250Hz or 500Hz.

2 Answers

Jacob Brashears (anonymous) 0 Comments

According to xwhatsit’s post at https://deskthority.net/post146397.html#p146397, the controller uses an ATmega32U2 microcontroller clocked with a 16 MHz quartz crystal.

scan.c, line 39:

/* set up primary timer for column-scan interrupt */
TCCR0A |= (1 << WGM01);
OCR0A   = 25;
TIMSK0 |= (1 << OCIE0A);
TCCR0B |= (1 << CS01) | (1 << CS00);

Timer control registers are documented on page 105 of the ATmega32U2 datasheet: http://www.atmel.com/images/doc7799.pdf#page=105

First line: Timer restarts when it reaches its target.
Second line: Target = 25.
Third line: Call a function when the timer restarts.
Fourth line: Increment timer every 64 clock cycles.

It looks like the number of columns depends on this counter:

scan.c, line 98:

uint8_t maxLoops = KBD_COLS;
do {
currCol++;

} while (–maxLoops);
currCol = KBD_COLS;

KBD_COLS is defined in a separate file.

kbd_defs.h, line 20:

# if defined(BEAMSPRING)
# define KBD_COLS 23
# define KBD_ROWS 4

# elif defined(MODEL_F)
# define KBD_COLS 16
# define KBD_ROWS 8

To summarize:

Polling Frequency = 16 MHz / 64 / 25 / Number of Columns

Beam Spring USB Controller: 434 Hz.

Model F USB Controller: 625 Hz.

You are viewing 1 out of 2 answers, click here to view all answers.
Shopping cart0
There are no products in the cart!
Continue shopping
0