Author Topic: XT/AT/PS2/Terminal to USB Converter with NKRO  (Read 1078191 times)

0 Members and 5 Guests are viewing this topic.

Offline hasu

  • Posts: 3491
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: XT/AT/PS2/Terminal to USB Converter with NKRO
« Reply #1650 on: Sat, 14 August 2021, 09:48:26 »
No probably. Keyboard converter doesn't/can't debounce in general.


Offline mech0nly

  • Posts: 197
  • Location: ID
Re: XT/AT/PS2/Terminal to USB Converter with NKRO
« Reply #1651 on: Sun, 15 August 2021, 11:05:58 »
No probably. Keyboard converter doesn't/can't debounce in general.

Thanks hasu!
356mini | 360C | G81-3000SAT | G81-3000SAU | G80-3000LPCXY-2 | G80-3485LWNUS-2

Offline Matty

  • Posts: 4
Re: XT/AT/PS2/Terminal to USB Converter with NKRO
« Reply #1652 on: Sat, 21 August 2021, 00:25:18 »
Does anyone know how I can adapt this to the Arduino Beetle board/Arduino Leonardo Tiny? The only pins I have available for clock and data are A0, A1, A2, D9, D10, D11.

Any advice is greatly appreciated  :D

Cheers

Offline Zefix

  • Posts: 14
Re: XT/AT/PS2/Terminal to USB Converter with NKRO
« Reply #1653 on: Fri, 22 October 2021, 11:02:24 »
HELP REQUESTED
I'm trying to compile a empty.sc file that I moved into my Soarer_sctools_v1.10_macosx folder to test and then eventually remap keys using my own sc file.

when I run

$ ./scas empty.sc empty.scb

"zsh: bad CPU type in executable: ./scas"

Anybody know how to troubleshoot this?
(imac 2019 running macOS Big Sur)
« Last Edit: Fri, 22 October 2021, 11:10:53 by Zefix »
my babies

Offline hasu

  • Posts: 3491
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: XT/AT/PS2/Terminal to USB Converter with NKRO
« Reply #1654 on: Fri, 22 October 2021, 21:20:00 »
The tools for Mac are 32-bit executable binary files and recent versions of MacOS(10.15-) doens't support 32-bit anymore.
You will have to compile binary files from srouce codes with Xcode yourself  or you can find them here.

https://deskthority.net/viewtopic.php?f=7&t=25309

Offline Zefix

  • Posts: 14
Re: XT/AT/PS2/Terminal to USB Converter with NKRO
« Reply #1655 on: Fri, 22 October 2021, 22:49:00 »
The tools for Mac are 32-bit executable binary files and recent versions of MacOS(10.15-) doens't support 32-bit anymore.
You will have to compile binary files from srouce codes with Xcode yourself  or you can find them here.

https://deskthority.net/viewtopic.php?f=7&t=25309

Perfect. Thanks for the link the zip file listed near the top works great! Rip soarer's outdated code haha

PS. this message was brought to you courtesy of a 1985 IBM Model F AT keyboard :P
my babies

Offline sofakng

  • Posts: 23
Re: XT/AT/PS2/Terminal to USB Converter with NKRO
« Reply #1656 on: Wed, 17 November 2021, 18:30:51 »
What's the cleanest way (ie. case, parts) to make one of these adapters?

I'm looking for an atmega32u4 that would fit inside a USB male connector house but can't find anything.

I see that some people have found parts (ie. sudoboy, orihalcon, etc) but are selling their cables for $40 which seems a bit much.

Offline sofakng

  • Posts: 23
Re: XT/AT/PS2/Terminal to USB Converter with NKRO
« Reply #1657 on: Fri, 19 November 2021, 15:38:00 »
Another question ... do I connect the PS/2 shield wire and GND pins together?

Offline edlee

  • Posts: 22
Re: XT/AT/PS2/Terminal to USB Converter with NKRO
« Reply #1658 on: Sat, 20 November 2021, 07:26:21 »
That sounds similar to what I did with my first custom Soarer's converter.  The issue I had with my first custom Soarer's converter was it did not reliably work with an IBM Model M keyboard or with an active USB to PS/2 converter in series with Soarer's converter.  So, my second Soarer's converter had the optional pull up resistors that Soarer mentions in his documentation where you put extra 1K Ohm resistors between Clock and +5V and between Data and +5V.  I used a Teensy++ 2.0 for extra macro memory on a perf board with traces made with wire glue between conductors on the perforations for the extra resistors.  Wire glue is a black, I think carbon-based, substance, so no soldering was required.

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: XT/AT/PS2/Terminal to USB Converter with NKRO
« Reply #1659 on: Sun, 01 May 2022, 06:23:48 »
I've locked this thread as it keeps being spammed - if you want to post in it please report this post and someone will unlock it.  Sorry for the inconvenience!
« Last Edit: Sun, 01 May 2022, 06:25:43 by suicidal_orange »
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline flipkey

  • Posts: 1
Re: XT/AT/PS2/Terminal to USB Converter with NKRO
« Reply #1660 on: Tue, 18 July 2023, 16:36:41 »
I guess Soarer's Converters are being manufactured now, because the ones I found online are from sellers who don't know what microcontroller is inside, and the listings all seem to share the same photos. Here's an example:



I bought one of these and wrote up what I learned about it over at deskthority. I'm sharing it here in case others find themselves in a similar situation and want to identify what they have on their hands.

The one I bought responded to scinfo as running code version 1.12, which is the latest version number, but I wanted to overwrite it with Soarer's original hex file because I don't trust preinstalled firmware from random sellers. Also, the device was producing key events when plugged in, which showed up in my terminal as repeating F7 until I pressed a key, and I hoped that clean firmware might fix it.

Forum consensus was that the microcontroller was most likely an ATmega32U4, but none of dfu-loader, avrdude, or teensy-loader-cli recognized it as that MCU, nor as any of the other MCU names found in Soarer's docs. To make this work, I would have to figure out which firmware hex file to use, and find a tool that could upload it.

To narrow down the microcontroller possibilities, I compared the data sheets for each of the chips supported by Soarer's firmware with these values reported by scinfo:
 
SRAM Size: 2816 bytes
SRAM Free: 1806 bytes
EEPROM Size: 1024 bytes
EEPROM Free: 1020 bytes

The AT90USB1286, AT90USB646, and ATmega16U4 data sheets all list sizes significantly different from those. The ATmega32U4 sheet matches that 1K EEPROM size exactly, but lists only 2.5K SRAM, which doesn't quite match the 2.75K shown by scinfo. However, it lists a start address at the 0.25K mark, which could explain the discrepancy. That seemed like my best bet.

The device showed up as USB ID 16c0:047d in normal mode and 16c0:05df in bootloader mode (after running the scboot tool). That second ID appears in several unrelated projects online, probably because it's a popular ID to use for homebrew projects. Among them, I found these BootloadHID instructions. That's no guarantee, of course, but I decided to risk bricking the device and try the bootloadHID command line tool.

The guesswork and risk paid off. It worked.

Keyboard input was broken after flashing the firmware, but uploading a blank config with scwr restored it.

Some of scinfo's reported values changed after flashing the official firmware. I'll highlight the fields that were different when the pre-installed version was running:

Protocol Version: v1.00 (unchanged)
Code Version: v1.12 (unchanged)
Max Settings Version: v1.01 (unchanged)
Current Settings Version: v0.00 -> v1.01
SRAM Size: 2816 -> 2560 bytes
SRAM Free: 1806 -> 1809 bytes
EEPROM Size: 1024 bytes (unchanged)
EEPROM Free: 1020 -> 1016 bytes

What's more, the flood of F7 keystrokes when plugging it in is now gone. I wonder why the firmware this device shipped with was doing that. Corrupted data? Malware? It's too bad I had no way of dumping that firmware before replacing it; a comparison with Soarer's files might have revealed something interesting.

In any case, the sleuthing and a little risk paid off. It's working well now. I hope this info helps someone else. :)
« Last Edit: Tue, 18 July 2023, 16:45:36 by flipkey »

Offline arakula

  • Posts: 50
Re: XT/AT/PS2/Terminal to USB Converter with NKRO
« Reply #1661 on: Sat, 06 July 2024, 10:33:19 »
6 years late, I know, but I've been absent from the clicky keyboard scene for quite a while ...

I did some researches on XT keyboard protocol including Soarer's converter these a few days.
https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-XT-Keyboard-Protocol

Noticed your keyboard(microtec) has different timing on its signaling, but it is compatible to XT protocol.
After emulating different XT keyboard signals with tweaking AT2XT code I came to think Soarer's converter read data line on rising edge of clock and this is problem here. (Also my tmk converter does wrongly at this point :p)

I can confirm this. Here's Soarer's code to set up interrupt handling for the PC/XT protocol:
Code: [Select]
        cli                             ; 0D4A: F8 94       '..'
        ldi     R30,LOW(EICRA)          ; 0D4C: E9 E6       '..'
        ldi     R31,HIGH(EICRA)         ; 0D4E: F0 E0       '..'
        ld      R24,Z                   ; 0D50: 80 81       '..'
        ori     R24,0x0c                ; 0D52: 8C 60       '.`'
        st      Z,R24                   ; 0D54: 80 83       '..'
        sbi     EIMSK,1                 ; 0D56: E9 9A       '..'
        sei                             ; 0D58: 78 94       'x.'
        ret                             ; 0D5A: 08 95       '..'
(from Soarer_at2usb_v1.12_atmega32u4.hex, addresses slightly different in the others)
"ori R24,0x0c" is the line of interest - it sets ISC10 and ISC11 to 1, i.e., the rising edge of INT1 generates an interrupt.

Unfortunately, this can't be fixed with a simple patch, since setting it to ISC11=1, ISC10=0 for falling edge interrupt would need 2 instructions (one to clear ISC10, one to set ISC11) instead of the one OR. In the default AT/PS2 mode, it is set up as ISC11=0 ISC10=1, so setting ISC10 to 0 can't be omitted.

[Edit:] as an afterthought - it should be possible. There's another routine just before that which also ends with sei/ret:
Code: [Select]
; ====================================================
; disable_kbd_int :
; ====================================================
disable_kbd_int:
        cli                             ; 0D3E: F8 94       '..'
        cbi     EIMSK,1                 ; 0D40: E9 98       '..'
        ldi     R24,0x02                ; 0D42: 82 E0       '..'
        out     EIFR,R24                ; 0D44: 8C BB       '..'
        sei                             ; 0D46: 78 94       'x.'
        ret                             ; 0D48: 08 95       '..'

; ====================================================
; enable_kbd_int_rising :
; ====================================================
enable_kbd_int_rising:
        cli                             ; 0D4A: F8 94       '..'
        ldi     R30,LOW(EICRA)          ; 0D4C: E9 E6       '..'
        ldi     R31,HIGH(EICRA)         ; 0D4E: F0 E0       '..'
        ld      R24,Z                   ; 0D50: 80 81       '..'
        ori     R24,0x0c                ; 0D52: 8C 60       '.`'
        st      Z,R24                   ; 0D54: 80 83       '..'
        sbi     EIMSK,1                 ; 0D56: E9 9A       '..'
        sei                             ; 0D58: 78 94       'x.'
        ret                             ; 0D5A: 08 95       '..'
(label names are mine, of course, not Soarer's)
so, in theory, it would be possible to modify the function to something like that:
Code: [Select]
; ====================================================
; disable_kbd_int :
; ====================================================
disable_kbd_int:
        cli                             ; 0D3E: F8 94       '..'
        cbi     EIMSK,1                 ; 0D40: E9 98       '..'
        ldi     R24,0x02                ; 0D42: 82 E0       '..'
        out     EIFR,R24                ; 0D44: 8C BB       '..'
jump_here:                              ;                   <---
        sei                             ; 0D46: 78 94       'x.'
        ret                             ; 0D48: 08 95       '..'

; ====================================================
; enable_kbd_int_rising :
; ====================================================
enable_kbd_int_rising:
        cli                             ; 0D4A: F8 94       '..'
        ldi     R30,LOW(EICRA)          ; 0D4C: E9 E6       '..'
        ldi     R31,HIGH(EICRA)         ; 0D4E: F0 E0       '..'
        ld      R24,Z                   ; 0D50: 80 81       '..'
        andi    r24,0xf3                ; 0D52: 83 7F       <---
        ori     R24,0x08                ; 0D54: 88 60       <---
        st      Z,R24                   ; 0D56: 80 83       '..'
        sbi     EIMSK,1                 ; 0D58: E9 9A       '..'
        rjmp    jump_here               ; 0D5A: F5 CF       <---

Unfortunately, I got no XT keyboard to try it.
« Last Edit: Sun, 07 July 2024, 03:41:18 by arakula »

Offline joshstevens

  • Posts: 10
Re: XT/AT/PS2/Terminal to USB Converter with NKRO
« Reply #1662 on: Thu, 17 October 2024, 19:57:21 »
Would this be compatible with the ATmega 16u2 onboard the 2560?