Hi David. I might ask for some help here.
I’m pretty much happy with my bidirectional PS/2 software implementation, so far, and the scope measured operation.
I now get pretty much identical commands and response handshake, when comparing my CreatiVision keyboard to my generic PS/2 keyboard, when my attached computer (Host) is reset.
This is what my Host to generic PS/2 keyboard handshake looks like after a computer reset:
Code: Select all
Host - Reset (0xFF)
Device - Acknowledge (0xFA)
~380ms delay
Device - BAT Success (0xAA)
~150ms delay
Host - Set Key Type Typematic - Disable Break Codes (0xFB)
Device - Acknowledge (0xFA)
Host - Read ID (0xF2)
Device - Resend (0xFE)
Host - Read ID (0xF2)
Device - Resend (0xFE)
Host - Read ID (0xF2)
Device - Resend (0xFE)
Host - Read ID (0xF2)
Device - Resend (0xFE)
Host - Read ID (0xF2)
Device - Resend (0xFE)
Host - Read ID (0xF2)
Device - Resend (0xFE)
i.e. The generic PS/2 keyboard (that I have) seems to only respond with a “resend” when asked for it’s ID. With the Host giving up after 6 attempts. But the generic Keyboard then operates perfectly. I've also tried responding correctly from the CreatiVison Keyboard (0xAB & 0x83), as well as duplicating the generic Keyboards "Resend" only (0xFE) response.
I also get virtually identical key-press Scancode transmission, when comparing (on the scope), between the CreatiVision keyboard and my generic PS/2 keyboard, when connected to the Host
In fact, the only real difference, is that the CreatiVision Keyboard connection is very clean (nice!), whereas my generic PS/2 keyboard is quite noisey, but the levels are identical etc.
Below are scope captures of the ‘Q’ key (0x15 Scancode), from both the generic PS/2 keyboard (first), and the CreatiVision keyboard (second), when connected to my Computer (Host).
As you can see, essentially an identical transmission! Despite the apparent clean and tidy transmission, I was still getting random character errors and repeating keys registering when using the CreatiVision keyboard with my retro PS/2 input computer.
So… this lead me back to the electrical interface. Just measuring the unpowered interface’s apparent pull-up resistance, from the Clock / Data lines to the PS/2 connection 5V line, I was seeing: 1.2M on the generic Keyboard, 4.7K on the Computer (Host), and my current 10K pull-ups on the CreatiVision Keyboard!
This lead me to think that the generic keyboard perhaps infact had no pull-ups? And the Host computer appears to have it's own 4.7K pull-ups.
This, leading to the combination with my CreatiVision Keyboard 10K pull-ups, perhaps being too strong a pull-up for the Host to consistently register the signal low levels? (assuming some series resistance also in the Host computer's interface).
So… I’ve snipped my 2x 10K pull-ups to take them “out of circuit” on my CreatiVision Keyboard, and I’m now getting a lot closer!
I now have significantly improved character accuracy, but still getting occasional random incorrect characters and repeats (perhaps key release code not interpreted?).
I noticed the Clock / Data edge timing has altered a bit with the 10K pull-ups removed, meaning only the Host's 4K7 pull-ups are in play.
I will experiment further with fine-tuning the Data level transition timing, although this timing may also potentially vary with different Hosts?
But, this is where I need some help. I currently only have the one retro PC with a PS/2 input. So only one “Host” to test with!
I’m curious if you were to also take the 10K pull-up resistors out of play, whether you’d see any difference with your PS/2 host tests? (albeit, still a unidirectional interface, with the original code).
It really shouldn’t be this hard, but I do like a good challenge. I’m now off to read more on the appropriate PS/2 interface pull-up implementation (Host? / Device? / Values etc.). Perhaps only the host device should implement the Open Collector pull-ups?
Anyway, tomorrow is another day.
