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