Page 1 of 1

Easiest Keyboard Solution for Development?

Posted: Fri Sep 09, 2022 6:03 pm
by tonymichaelhead
Hey all, I'm working on implementing CHIP-8 on the DE10 Nano with the analog IO addon. This is a project for learning digital design/computer architecture, so I will not be using the mister framework on this project. (That'll change in upcoming projects!)

For CHIP-8, I'll need some sort of 16-key input. My question is, what would be the easiest solution in terms of hardware to implement this? I was considering just plugging a USB keyboard into the external USB hub. But I wasn't sure if going through that external hub added complexity. I also understand implementing USB can be it's own time consuming project, but I'd be totally fine with importing an open source module for this to save time - it's not the learning focus of this project anyway.

Another solution could be to buy a dedicated 16 button keyboard, but I'm not sure what my options would be for connecting it to the Nano/IO board. USB + adapter? Pmod?

Would love to hear if anyone has done something similar. Thanks!

Re: Easiest Keyboard Solution for Development?

Posted: Fri Sep 09, 2022 7:13 pm
by aberu
A PS2 interface is probably the simplest, you can just use the headers on the de10-nano directly. There are PS2 input decoder cores that are merely 20-30 lines of code.

Then, after you make the decoder, you take that data in and assign it to keycodes for the machine, in your core.

Re: Easiest Keyboard Solution for Development?

Posted: Fri Sep 09, 2022 8:30 pm
by tonymichaelhead
Thanks for the suggestion, sounds like a doable solution. Just to confirm, the PS2 compatible header on the de10-nano would be that black 2x5 pin header? I'm using the analog IO addon for VGA, so it seems that connector might be a bit obstructed by the IO board. I wonder if it's possible to connect directly to the IO board, or maybe I could find a way to extend that 2x5 pin header.

Re: Easiest Keyboard Solution for Development?

Posted: Sat Sep 10, 2022 12:41 am
by dshadoff
If you use a USB keyboard, the framework does decoding for you... you only need to look at another existing computer core to see how it's handled.

Re: Easiest Keyboard Solution for Development?

Posted: Sat Sep 10, 2022 3:49 pm
by aberu
dshadoff wrote: Sat Sep 10, 2022 12:41 am If you use a USB keyboard, the framework does decoding for you... you only need to look at another existing computer core to see how it's handled.
I was about to say the same thing earlier, but they mentioned they were not going to use the framework :D

Re: Easiest Keyboard Solution for Development?

Posted: Sat Sep 10, 2022 4:34 pm
by dshadoff
Well then it becomes a question of what portions of the system are deemed “off limits”. Fundamentally, USB is handled by the HPS (ARM-based hard processor), and passed to the FPGA side via the framework.
Without the framework, you can give up on USB use, as reimplementing all of that is a high bar.
Most early microcomputers implemented an array of keys across I/O lines (write a line and read the columns to see which keys are pressed), but that will require quite a few GPIOs, which are in short supply after you are using the analog board (unless you repurpose the other bank of GPIOs to be used for your own uses rather than for the SDRAM board).
I suppose that PS/2 is another option, but you would need to figure out where to connect it (and implement the signalling system…).

Re: Easiest Keyboard Solution for Development?

Posted: Sat Sep 10, 2022 4:37 pm
by tonymichaelhead
Yeah, I chose to leave out the framework to try and keep things simple as I'm still working on the fundamentals of fpga/digital design.

However, at this point, my CHIP-8 implementation is nearly complete (minus controls). Integrating the framework might be a solid learning experience, since contributing to mister is the ultimate goal anyway. And I'd able to use my current hardware rather than needing a custom solution for key input. Seems like it might actually be the more straightforward solution at this point anyway.

Re: Easiest Keyboard Solution for Development?

Posted: Sat Sep 10, 2022 5:23 pm
by aberu
If you use discord, feel free to join the discord (https://discord.com/misterfpga/) and ask questions in #dev-talk if you need any help integrating into the MiSTer framework. If you want documentation --> https://mister-devel.github.io/MkDocs_M ... loper/emu/

Re: Easiest Keyboard Solution for Development?

Posted: Wed Sep 14, 2022 8:26 pm
by tonymichaelhead
aberu wrote: Sat Sep 10, 2022 5:23 pm If you use discord, feel free to join the discord (https://discord.com/misterfpga/) and ask questions in #dev-talk if you need any help integrating into the MiSTer framework. If you want documentation --> https://mister-devel.github.io/MkDocs_M ... loper/emu/
Will do! I'm already a lurker of the discord, so will definitely speak up if any questions arise in the future. And thanks for the links to the docs!

Re: Easiest Keyboard Solution for Development?

Posted: Fri Dec 08, 2023 1:45 pm
by tcdev

+1 for PS/2. It's trivial to implement and only 2 I/O lines - a couple of resistors for pull-up and current limit on each pin.

Most PS/2 keyboards will work with a 3V3 I/O voltage too...