USB keyboard not working

40 views
Skip to first unread message

Pierluigi Rolando

unread,
Mar 15, 2018, 3:57:56 AM3/15/18
to MEGA65 Development
Hi everyone,
Apologies for the N-th email about stuff not working (on the positive side, I guess this is something anybody might get).

Still here trying to get a working system. Long story short, the original USB keyboard I'm using doesn't work with M65; I got another one, and it still doesn't work; so, I'm a SOL unless I start sampling everything Fry's has in store until I find a good one (not really an option) or I figure out what's going on.

I observe 2 symptoms:
1) when I press a key, 99% of the time nothing happens.
2) if I keep the key pressed, after it registers, it never ever stops registering. I keep getting repeats forever, even if I disconnect the keyboard, even if I reset the CPU with the CPU RESET switch.

This leads me to think that there's something seriously wrong with either the PS/2 emulation of the nexys4ddr (is that documented anywhere?) or the handling of the PS/2 data/clock lines. I don't know which one it is. Unfortunately all the non-M65 examples I could find assume the PS/2 clock is THE clock, so their sampling/debouncing code is minimal, but I'll try and install vivado and run some of them to check if it's a USB->PS/2 issue.

I've also tried to see how this stuff works in VHDL (not my forte, let's say). I reckon ps2_to_matrix does the actual sampling, then it gets fed to keymapper and from then onwards to other stuff (keyboard_complex, etc) until it ends in iomapper. I hope I'm at least looking at the right stuff.

Questions:

1) is the current ps2 timeout correct? It seems it should be right for 48 MHz, but maybe we're running at 100?
2) is there a way to print/display raw PS2 scancodes when they get received? Maybe using the seven segment display?
3) is there a way to compile only the keyboard stuff? I'd like to try a few things related to PS/2 timings, and it's really hard to have 3-hours compile cycles :-)
4) shouldn't there be something that handles the case where ps2clock is falling but no ps2data can be debounced? It looks to me in that case the last good bit received is duplicated if that happens, which is not necessarily a good idea?
5) who is supposed to disable a key after it's been pressed so that it doesn't show again in the next scan? I can see the code that wants to do that in the C64 CIAs, but that's not where keyboard data comes from. It seems like it stays latched forever in practice.

Thanks,
- P

Pierluigi Rolando

unread,
Mar 15, 2018, 4:07:39 AM3/15/18
to MEGA65 Development
Sorry, one more thing: I went to look and both ps2 clock and data are pulled up in the nexys4 (non DDR). On the DDR they are not. Which seems correct according to the xcd file. However, the manual states:

"The clock and data signals are only driven when data transfers occur; otherwise, they are held in the idle state at high-impedance (open-drain drivers). This requires that when the PS/2 signals are used in a design, internal pull-ups must be enabled in the FPGA on the data and clock pins. "


Should I suspect foul play?

- P

Paul Gardner-Stephen

unread,
Mar 15, 2018, 6:15:42 AM3/15/18
to Pierluigi Rolando, MEGA65 Development
The NExys4 boards only work with USB keyboards in "bios mode". Also, any keyboard with a USB hub in it won't work.

If you can't get a USB keyboard working, it is possible to remote control using monitor_load -t and -T options.  It would also be possible to make an interactive remote keyboard function.

Paul.

--
You received this message because you are subscribed to the Google Groups "MEGA65 Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to c65gs-development+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pierluigi Rolando

unread,
Mar 16, 2018, 12:46:40 AM3/16/18
to MEGA65 Development
I've managed to install Vivado and try the Nexys 4 DDR keyboard demo (https://reference.digilentinc.com/learn/programmable-logic/tutorials/nexys-4-ddr-keyboard-demo/start). This also fails. So, both my keyboards must be bad. I'll try to get yet another one...

- P
To unsubscribe from this group and stop receiving emails from it, send an email to c65gs-developm...@googlegroups.com.

Paul Gardner-Stephen

unread,
Mar 16, 2018, 1:16:00 AM3/16/18
to Pierluigi Rolando, MEGA65 Development
Hello,

Glad you were able to get a definitive answer on the keyboard, and good luck finding one.
Old Sun keyboards work, as do HP SK-2885 keyboards. Here is a HP keyboard with free mouse for AU$10 on ebay, for example:

https://www.ebay.com.au/itm/Genuine-HP-USB-Keyboard-SK-2885-and-HP-Laser-Mouse/253489985175?epid=2256130927&hash=item3b052e3697:g:S~kAAOSwgLlac-ei

Paul.

To unsubscribe from this group and stop receiving emails from it, send an email to c65gs-development+unsubscribe@googlegroups.com.

Vedran Vrbanc

unread,
May 23, 2018, 10:04:14 AM5/23/18
to MEGA65 Development
> if I keep the key pressed, after it registers, it never ever stops registering.

In case anyone runs into this same issue... this kind of behavior is almost certainly a sign that the keyboards is not compatible.

I had the same problem with one of my keyboards. It had some "bells and whistles", like the sleep/shutdown buttons.

Replaced it with the plain old Logitech K120 and it worked like a charm.


LGB Gábor Lénárt

unread,
May 25, 2018, 5:43:18 AM5/25/18
to MEGA65 Development
Indeed. I bought the cheapest "shit" I could get (it was about 2 EUR worth of money ...), to have a dedicated keyboard for the Nexys4 board. It didn't worked, oddly, sometimes it worked, but I had to press a key 4-5 times to react, then it worked. Till the next different key pressed :-P It had no problem with my PC though. Then I got a Logitech K200 from my workplace (they wanted to throw it away because of being a bit "worn") and no problem since then.

Konrad B

unread,
May 25, 2018, 7:45:15 AM5/25/18
to MEGA65 Development
Tested: Dell KB212-B, works fine.

Regards,
Konrad
Reply all
Reply to author
Forward
0 new messages