Author Topic: Soarer's Keyboard Controller firmware  (Read 4270 times)

0 Members and 1 Guest are viewing this topic.

Offline Soarer

  • * Moderator
  • Thread Starter
  • Posts: 2672
  • Location: UK
Soarer's Keyboard Controller firmware
« on: Sun, 03 November 2013, 08:10:08 »
Here is my Controller firmware for AVR microcontrollers with hardware USB, e.g. Teensy 2.0, Teensy++ 2.0.

The main difference between this and other controller firmwares is that all configuration is performed using a config file, rather than modifying the C source code. A few example matrix configs are included, covering some very different keyboards.

Retrete was the initial guinea pig with his vintage Kevex terminal - the discussion there serves as an example walk-though of how to apply this firmware to a keyboard. Two videos as well!

The best way to approach making the matrix config is to first set it up with all keys set to 'UNASSIGNED', then to use hid_listen to see which matrix code fires for each key and debug any wiring problems. That way you don't get unintended keystrokes sent to your OS, which could be painful!

All of the features of my Converter (NKRO, remapping, layer, macro, etc) are supported (except, of course, 'ifset').

Matrix scans can include 'classic' matrix (direct connections to rows and columns), multiplexed (strobes are driven through a decoder), and unstrobed (where individual keys are connected to pins). Various polarity and mode settings are available to cover many requirements. There's also options for scan rate, debouncing time and mode, including turbo mode which adds no delay, and a blocking flag to enable de-ghosting.

Currently at beta stage, with only bugfixes and minor changes expected before the first proper release. There is a single .html page included in the zip describing the Controller specific configuration - you'll also need the docs from my Converter (available on DT and GH).

Required hardware is an AVR microcontroller with more than 16KB RAM, and hardware USB with a decent amount of buffer memory. This includes the ATmega32U4 and better, but does NOT include the ATmega32U2.
« Last Edit: Sun, 03 November 2013, 09:10:57 by Soarer »

Offline metalliqaz

  • * Maker
  • Posts: 4942
  • Location: the Making Stuff subforum
  • Leopold fanboy
Re: Soarer's Keyboard Controller firmware
« Reply #1 on: Sun, 03 November 2013, 08:14:01 »
Geekhack is a tinkerers paradise :cool:

Online Grendel

  • Posts: 496
  • Location: OR, USA
    • Firmware for Costar Replacement Controllers
Re: Soarer's Keyboard Controller firmware
« Reply #2 on: Sun, 03 November 2013, 16:09:18 »
Thanks for releasing it !
Currently using: RK-9000WH/GR, CMS QFXT w/ Ghost Squid
- I'm game !

Offline xavierblak

  • Posts: 243
  • Location: NY
Re: Soarer's Keyboard Controller firmware
« Reply #3 on: Sun, 03 November 2013, 22:06:21 »
Nice. I've been too lazy to finish writing some firmware to get my 5291 bigfoot working. I see you have support for it in here. I'll try it out.

Edit:
Success. :)
« Last Edit: Sun, 03 November 2013, 22:26:38 by xavierblak »

Offline Soarer

  • * Moderator
  • Thread Starter
  • Posts: 2672
  • Location: UK
Re: Soarer's Keyboard Controller firmware
« Reply #4 on: Mon, 04 November 2013, 06:56:47 »
Excellent!

I was looking for your thread last night, but couldn't find it because it doesn't say 'bigfoot' in it anywhere. Should've searched on 5291 - d'oh! All the info anyone might need to wire up the 5291 'bigfoot' is there :D

Offline JBert

  • Posts: 1188
Re: Soarer's Keyboard Controller firmware
« Reply #5 on: Tue, 05 November 2013, 06:30:31 »
Ah, hopefully this can be run on a GH60 as well, that way I can keep using my layers and macros for the Poker.

Is the Pxx notation the way the Atmel headers specify port bits or is it something Teensy-specific?
IBM Model F XT + Soarer's USB Converter || Cherry G80-3000/Clears

The storage list:
IBM Model F AT || Cherry G80-3000/Blues || Compaq MX11800 (Cherry brown, bizarre layout) || IBM KB-8923 (model M-style RD) || G81-3010 Hxx || BTC 5100C || G81-3000 Sxx || Atari keyboard (?)


Currently ignored by: nobody?

Disclaimer: we don\'t help you save money on [strike]keyboards[/strike] hardware, rather we make you feel less bad about your expense.
[/SIZE]

Offline Soarer

  • * Moderator
  • Thread Starter
  • Posts: 2672
  • Location: UK
Re: Soarer's Keyboard Controller firmware
« Reply #6 on: Tue, 05 November 2013, 07:37:07 »
It's how Atmel label the pins in the datasheet :)

Online Hellmark

  • Posts: 396
  • Location: Maryland Heights, Mo, USA
Re: Soarer's Keyboard Controller firmware
« Reply #7 on: Wed, 06 November 2013, 10:17:52 »
Will the source be released for this? I know you have the source available for the SC tools to be used with it, just didn't know about the firmware itself.

Online dorkvader

  • ** Civil Servant Emeritus
  • Posts: 7419
  • Location: NE Massachusetts
  • ipse se nihil scire id unum sciat
Re: Soarer's Keyboard Controller firmware
« Reply #8 on: Wed, 06 November 2013, 13:39:51 »
Wow excellent! thanks for the release, soarer.

Geekhack is a tinkerers paradise :cool:
It's the "hack" part of Geekhack

let me put together your keyboard! Nut&bolt mod (many pictures)
"One should watch a film adaptation of a favorite book only after considering, very carefully, the fact that the casting of the film may very well become the permanent casting of the book in one's mind. This is a very real hazard."

Offline Soarer

  • * Moderator
  • Thread Starter
  • Posts: 2672
  • Location: UK
Re: Soarer's Keyboard Controller firmware
« Reply #9 on: Thu, 07 November 2013, 06:41:08 »
Did somebody try it on 3178 display terminal keyboards ?

I doubt it, yet!

Not sure what the 3178 has inside it... in general, it should be feasible to convert any IBM that uses the 4-channel capsense chip. The 4-channel seems a LOT easier to drive than the 8-channel. If the controller has a CPU, it would need to be removed, and perhaps some circuitry added (in addition to the Teensy). The 5291 has a pair of decoders to drive the 24 strobes into the matrix - those with a CPU may not have the same arrangement, but whatever they have might be usable as-is. The extra bit they probably won't have is a little circuit to generate the capsense chip's gate signal from the strobe gate signal - the 5291 simply delays the signal slightly to do that (schematic).


Offline bcg

  • Posts: 129
Re: Soarer's Keyboard Controller firmware
« Reply #10 on: Mon, 25 November 2013, 20:43:11 »
Did somebody try it on 3178 display terminal keyboards ?

I doubt it, yet!

Not sure what the 3178 has inside it... in general, it should be feasible to convert any IBM that uses the 4-channel capsense chip. The 4-channel seems a LOT easier to drive than the 8-channel. If the controller has a CPU, it would need to be removed, and perhaps some circuitry added (in addition to the Teensy). The 5291 has a pair of decoders to drive the 24 strobes into the matrix - those with a CPU may not have the same arrangement, but whatever they have might be usable as-is. The extra bit they probably won't have is a little circuit to generate the capsense chip's gate signal from the strobe gate signal - the 5291 simply delays the signal slightly to do that (schematic).

(Attachment Link)

I just ordered a 3178 from feebay, I'll take pictures of the insides if you are interested.

Will I be able to use a Arduino Pro Micro to get this working, or will I require more pins?  I also have a Teensy 2.0 but I'd obviously prefer to use a $6 part if I can get away with it.

Thanks for releasing this Soarer!
:wq!

Offline Soarer

  • * Moderator
  • Thread Starter
  • Posts: 2672
  • Location: UK
Re: Soarer's Keyboard Controller firmware
« Reply #11 on: Tue, 26 November 2013, 06:51:56 »
Cool, yes, interested in pictures :)

We should be able to tell from its ICs whether a Pro Micro would be OK. I'd guess that it uses a decoder for at least some of its strobes, but if it's not all of them it could still run out of pins.

I might have to add some extra ways to set things up in the config file, since it could need separate control of the multiplexed sense (either for timing reasons or because not all strobes are decoded).

Offline agodinhost

  • Posts: 817
  • Location: Brazil, RJ
  • Soylent green is people ...
    • Dr Ian O Xaman
Re: Soarer's Keyboard Controller firmware
« Reply #12 on: Tue, 26 November 2013, 14:35:56 »
do you think it would work into the arduino micro soarer?
I know it has a different bootloader but I'm not sure what else could make it not work in one arduino micro - it uses the atmega32u4
Building one square I2C keyboard with those 1200 switches (thanks JDCarpe)
GH60 |GH60-Alps |GH60-BT |GHPad/GHPad Alps |GH60-Case |Alps TKL |EL Wire |OS Controller, Round 2 |My Custom Keyboard |WTT/WTB

Offline Soarer

  • * Moderator
  • Thread Starter
  • Posts: 2672
  • Location: UK
Re: Soarer's Keyboard Controller firmware
« Reply #13 on: Tue, 26 November 2013, 15:15:59 »
Yup, that should be fine :)

Offline bcg

  • Posts: 129
Re: Soarer's Keyboard Controller firmware
« Reply #14 on: Sat, 07 December 2013, 01:22:41 »
Cool, yes, interested in pictures :)

We should be able to tell from its ICs whether a Pro Micro would be OK. I'd guess that it uses a decoder for at least some of its strobes, but if it's not all of them it could still run out of pins.

I might have to add some extra ways to set things up in the config file, since it could need separate control of the multiplexed sense (either for timing reasons or because not all strobes are decoded).

Ok, so here it is... sorry about the quality of the photos... I'm terrible at taking pictures

47091-047093-147095-2

EDIT:  Also does anyone know what that blue and white coil on the right is?  Is it some kind of speaker or something?
« Last Edit: Sat, 07 December 2013, 01:25:58 by bcg »
:wq!

Offline Soarer

  • * Moderator
  • Thread Starter
  • Posts: 2672
  • Location: UK
Re: Soarer's Keyboard Controller firmware
« Reply #15 on: Sat, 07 December 2013, 09:04:07 »
Yeah, that's a solenoid to provide the key-click. Unfortunately it probably needs 12 volts to operate, so that's not easy to do from USB.

Well the pics give me an idea of what's there at least, but I can't read the numbers on the chips. The square silver one (bottom right) is key - if that's 5119699 then it's the 4-channel and should work with my code, but not if it's the 8-channel 8273565.

Offline metalliqaz

  • * Maker
  • Posts: 4942
  • Location: the Making Stuff subforum
  • Leopold fanboy
Re: Soarer's Keyboard Controller firmware
« Reply #16 on: Sat, 07 December 2013, 15:24:10 »
There was a keyboard that had a solenoid to make the click sound?  Wow, that's amazing.

Offline bcg

  • Posts: 129
Re: Soarer's Keyboard Controller firmware
« Reply #17 on: Sat, 07 December 2013, 19:35:54 »
Yeah, that's a solenoid to provide the key-click. Unfortunately it probably needs 12 volts to operate, so that's not easy to do from USB.

Well the pics give me an idea of what's there at least, but I can't read the numbers on the chips. The square silver one (bottom right) is key - if that's 5119699 then it's the 4-channel and should work with my code, but not if it's the 8-channel 8273565.

Bad news I  guess:

47196-0

Is it a lost cause with the 8 channel chip?

If so that's too bad because I really like the sound and feel of this board... guess I might just have to pony up the cash for a AT Model F after all.
:wq!

Offline Soarer

  • * Moderator
  • Thread Starter
  • Posts: 2672
  • Location: UK
Re: Soarer's Keyboard Controller firmware
« Reply #18 on: Sat, 07 December 2013, 19:47:58 »
Well, I haven't been able to drive it reliably with a Teensy replacing the 8049 CPU, yet :(

But it's not a lost cause; you'll just have to wait for the Model F controller replacement project from geekhack's secret skunk works to bear fruit, which should be fairly soon :D

Offline bcg

  • Posts: 129
Re: Soarer's Keyboard Controller firmware
« Reply #19 on: Sat, 07 December 2013, 20:04:36 »
Well, I haven't been able to drive it reliably with a Teensy replacing the 8049 CPU, yet :(

But it's not a lost cause; you'll just have to wait for the Model F controller replacement project from geekhack's secret skunk works to bear fruit, which should be fairly soon :D

Sweet!  Thanks for taking the time to look into this.  I'll have to keep my eyes open for the alternative F controller.  Is there a thread where that is being discussed?
:wq!

Offline Soarer

  • * Moderator
  • Thread Starter
  • Posts: 2672
  • Location: UK
Re: Soarer's Keyboard Controller firmware
« Reply #20 on: Sat, 07 December 2013, 20:45:30 »
Probably will be one soon, but until then some progress might get reported in the kishsaver threads, since that's a main target initially (amongst others).

Offline Soarer

  • * Moderator
  • Thread Starter
  • Posts: 2672
  • Location: UK
Re: Soarer's Keyboard Controller firmware
« Reply #21 on: Tue, 14 January 2014, 19:35:12 »
Here's some notes on replacing the CPU of an IBM 6112884 with a Teensy 2.0 running this hex.

The IBM 6112884 is this layout with Japanese legends:

50917-0

There are a couple of other variants, one with Chinese legends.

It has vintage Alps switches:

50919-1

The original 8048 CPU has pins used as follows:

50921-2

The bold labels are the interesting ones for converting, and the Teensy pins I wired them to are shown in blue.

I've gone with a plug in approach, first replacing the CPU with a socket. Then 8 pins made using bell wire connect the sense rows, and 2 more just hold the other side in place. More bell wire used to hook up power and ground, and then 4 lines to the multiplexed column strobes. Insulating tape under the Teensy prevents Teensy pins shorting to socket pins where the flying leads are attached.

Pin 1 of the original CPU is bottom left in this pic:

50923-3

You could just remove the CPU and wire the Teensy in without a socket - it would probably be easier, but I wanted to be able to replace the original CPU easily.

The basic config is already included in the controller 1.20 zip file as 6112884.sc :D
« Last Edit: Tue, 14 January 2014, 19:38:55 by Soarer »

Offline minium

  • Posts: 20
  • Location: Southern California
Re: Soarer's Keyboard Controller firmware
« Reply #22 on: Wed, 15 January 2014, 01:34:17 »
Here's some notes on replacing the CPU of an IBM 6112884 with a Teensy 2.0 running this hex.

The IBM 6112884 is this layout with Japanese legends:

(Attachment Link)

There are a couple of other variants, one with Chinese legends.

It has vintage Alps switches:

(Attachment Link)

The original 8048 CPU has pins used as follows:

(Attachment Link)

The bold labels are the interesting ones for converting, and the Teensy pins I wired them to are shown in blue.

I've gone with a plug in approach, first replacing the CPU with a socket. Then 8 pins made using bell wire connect the sense rows, and 2 more just hold the other side in place. More bell wire used to hook up power and ground, and then 4 lines to the multiplexed column strobes. Insulating tape under the Teensy prevents Teensy pins shorting to socket pins where the flying leads are attached.

Pin 1 of the original CPU is bottom left in this pic:

(Attachment Link)

You could just remove the CPU and wire the Teensy in without a socket - it would probably be easier, but I wanted to be able to replace the original CPU easily.

The basic config is already included in the controller 1.20 zip file as 6112884.sc :D

Mine literally arrived a few hours ago. I'm really excited to get it wired up. Thank you for this and the converter firmware that is driving my M122.

Online dorkvader

  • ** Civil Servant Emeritus
  • Posts: 7419
  • Location: NE Massachusetts
  • ipse se nihil scire id unum sciat
Re: Soarer's Keyboard Controller firmware
« Reply #23 on: Sat, 03 May 2014, 16:22:59 »
So I'm running this on my one-hand ergodox, working fine. and I have a cherry matrix KB that i'm trying to use with this firmware.

Right now everything works great, except for one column which is "stuck" down.

So I flash it, and right after, all keys in the column "press", and then one is "stuck" down. After that, they won't register in AQT.

Column is connected to PD6 on the corner.
--
So I'm trying to debug it and the matrix works A-OK 100% fine with a multimeter. I'm getting continuity where I should and none where I'm not supposed to.

Where should I continue the debugging process? The hardware seems fine, and tests fine all the way up to the teensy. The KB had been working fine with the stock controller before this.

I can provide pictures and a copy of my layout file if that will help you help me debug it.
let me put together your keyboard! Nut&bolt mod (many pictures)
"One should watch a film adaptation of a favorite book only after considering, very carefully, the fact that the casting of the film may very well become the permanent casting of the book in one's mind. This is a very real hazard."

Offline hasu

  • Posts: 1047
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Soarer's Keyboard Controller firmware
« Reply #24 on: Sat, 03 May 2014, 16:33:40 »
If you are using PJRC Teensy or Teensy++ PD6 has LED. I think you can NOT use the pin as input unfortunately.

EDIT:  You wll able to use PD6 as "strobe"(output) but not as "sense"(input). Anyway PD6 is to be avoided or the last pin to use.

EDIT2: ah, I forgot "NOT" :(
« Last Edit: Sat, 03 May 2014, 17:35:39 by hasu »
⚠ My Engrish is broken.    tmk keyboard firmware project(ADB,PS/2,X68K,PC98,M0110,HHKB,GH60)

Online dorkvader

  • ** Civil Servant Emeritus
  • Posts: 7419
  • Location: NE Massachusetts
  • ipse se nihil scire id unum sciat
Re: Soarer's Keyboard Controller firmware
« Reply #25 on: Sat, 03 May 2014, 19:24:16 »
If you are using PJRC Teensy or Teensy++ PD6 has LED. I think you can NOT use the pin as input unfortunately.

EDIT:  You wll able to use PD6 as "strobe"(output) but not as "sense"(input). Anyway PD6 is to be avoided or the last pin to use.

EDIT2: ah, I forgot "NOT" :(
I resoldered the pin to another unused one (very few unused pins on a 8*15 matrix) and now it works!

Thanks to Hasu and Wcass.
---
I would like to come up with a quick list of avaliable pins. One interior pin I am using, the other I don't think is usable. Also, some of the ones on the end are not usable I think either.
let me put together your keyboard! Nut&bolt mod (many pictures)
"One should watch a film adaptation of a favorite book only after considering, very carefully, the fact that the casting of the film may very well become the permanent casting of the book in one's mind. This is a very real hazard."

Offline poxeclipse

  • Posts: 324
  • Location: Toronto, Canada
  • Hit me with music ... yes, me friend
Re: Soarer's Keyboard Controller firmware
« Reply #26 on: Sun, 18 May 2014, 11:52:24 »
Cool, yes, interested in pictures :)

We should be able to tell from its ICs whether a Pro Micro would be OK. I'd guess that it uses a decoder for at least some of its strobes, but if it's not all of them it could still run out of pins.

I might have to add some extra ways to set things up in the config file, since it could need separate control of the multiplexed sense (either for timing reasons or because not all strobes are decoded).

Ok, so here it is... sorry about the quality of the photos... I'm terrible at taking pictures

(Attachment Link) (Attachment Link) (Attachment Link)

EDIT:  Also does anyone know what that blue and white coil on the right is?  Is it some kind of speaker or something?
It looks pretty close to my 3178 keyboard. It will work with xwhatsit's model F controller. Have a look:

http://geekhack.org/index.php?topic=57103.30

Offline berserkfan

  • Posts: 1887
  • I strive to be more Gutzy everyday!
Re: Soarer's Keyboard Controller firmware
« Reply #27 on: Mon, 18 August 2014, 02:48:56 »
Here's some notes on replacing the CPU of an IBM 6112884 with a Teensy 2.0 running this hex.

The IBM 6112884 is this layout with Japanese legends:

(Attachment Link)

There are a couple of other variants, one with Chinese legends.

It has vintage Alps switches:

(Attachment Link)

The original 8048 CPU has pins used as follows:

(Attachment Link)

The bold labels are the interesting ones for converting, and the Teensy pins I wired them to are shown in blue.

I've gone with a plug in approach, first replacing the CPU with a socket. Then 8 pins made using bell wire connect the sense rows, and 2 more just hold the other side in place. More bell wire used to hook up power and ground, and then 4 lines to the multiplexed column strobes. Insulating tape under the Teensy prevents Teensy pins shorting to socket pins where the flying leads are attached.

Pin 1 of the original CPU is bottom left in this pic:

(Attachment Link)

You could just remove the CPU and wire the Teensy in without a socket - it would probably be easier, but I wanted to be able to replace the original CPU easily.

The basic config is already included in the controller 1.20 zip file as 6112884.sc :D

ok I just got a similar keyboard and am happily working on it. I have a problem. There are 9 other non-standard keys which are unassigned and I'd like to program them to do something. But on the 6112884.sc document, there are way more than 9 unassigned places. Also the matrix isn't easily linear or grid so I have no idea which keys are located where.

How do I go about identifying the un=assigned keys and assigning them to do something or other?


Solved using brute force, by assigning lots of keycodes to the unassigned places and seeing what codes could be turned into real keypresses.

If anyone needs the document I can add to Soarer's contribution. Every key on my keyboard is now assigned, so all you need to do is to look at the .sc document and change the assignments. I have two right shifts to make up for the split right shift.
« Last Edit: Mon, 18 August 2014, 03:37:59 by berserkfan »
Finally that ridiculous lolicon Gigantomakhia is over, and Berserk will resume on April 11, 2014.

(For those who do not know, Gigantomakhia is about a magical little girl who can do anything with her urine, including heal fatal wounds and feed hungry men.)

Offline robskillz

  • Posts: 1
Re: Soarer's Keyboard Controller firmware
« Reply #28 on: Sat, 13 September 2014, 06:49:47 »
Thanks for this great firmware Soarer - so easy to configure!

I have a question about holding down shifted keys and making them repeat. When I hold down, for example, shift and 1 on my custom keyboard with 1.20 firmware I get a repeated ! as expected. But on keys where I've used a macro to remap the shifted character and I hold them down continuously the character doesn't repeat.
i.e. using this code:
Code: [Select]
macro 0 SHIFT
       PRESS 6
endmacro
to get a ^ by pressing shift and zero. When I press shift and 0 I get the ^ as intended. But if I keep holding them they don't repeat.
Any suggestions on getting the shifted keys to repeat?

Online fohat.digs

  • * Elevated Elder
  • Posts: 4239
  • Location: 34.04 N 84.47 W
  • Big and Strong But Gentle
Re: Soarer's Keyboard Controller firmware
« Reply #29 on: Sat, 13 September 2014, 09:13:57 »
Where is Soarer?

We keep seeing the question but no answer.

Does anybody know whether he is OK?
curmudgeon - and my Model F keyboards prove it