Easiest Keyboard Solution for Development?

Discussion of developmental aspects of the MiSTer Project.
tonymichaelhead
Posts: 8
Joined: Fri Jun 17, 2022 4:22 am
Has thanked: 11 times
Been thanked: 1 time

Easiest Keyboard Solution for Development?

Unread post 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!
User avatar
aberu
Core Developer
Posts: 970
Joined: Tue Jun 09, 2020 8:34 pm
Location: Longmont, CO
Has thanked: 203 times
Been thanked: 313 times
Contact:

Re: Easiest Keyboard Solution for Development?

Unread post 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.
birdybro~
tonymichaelhead
Posts: 8
Joined: Fri Jun 17, 2022 4:22 am
Has thanked: 11 times
Been thanked: 1 time

Re: Easiest Keyboard Solution for Development?

Unread post 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.
dshadoff
Core Developer
Posts: 479
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 13 times
Been thanked: 119 times

Re: Easiest Keyboard Solution for Development?

Unread post 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.
User avatar
aberu
Core Developer
Posts: 970
Joined: Tue Jun 09, 2020 8:34 pm
Location: Longmont, CO
Has thanked: 203 times
Been thanked: 313 times
Contact:

Re: Easiest Keyboard Solution for Development?

Unread post 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
birdybro~
dshadoff
Core Developer
Posts: 479
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 13 times
Been thanked: 119 times

Re: Easiest Keyboard Solution for Development?

Unread post 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…).
tonymichaelhead
Posts: 8
Joined: Fri Jun 17, 2022 4:22 am
Has thanked: 11 times
Been thanked: 1 time

Re: Easiest Keyboard Solution for Development?

Unread post 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.
User avatar
aberu
Core Developer
Posts: 970
Joined: Tue Jun 09, 2020 8:34 pm
Location: Longmont, CO
Has thanked: 203 times
Been thanked: 313 times
Contact:

Re: Easiest Keyboard Solution for Development?

Unread post 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/
birdybro~
tonymichaelhead
Posts: 8
Joined: Fri Jun 17, 2022 4:22 am
Has thanked: 11 times
Been thanked: 1 time

Re: Easiest Keyboard Solution for Development?

Unread post 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!
Post Reply