Easiest Keyboard Solution for Development?
-
- Posts: 8
- Joined: Fri Jun 17, 2022 4:22 am
- Has thanked: 11 times
- Been thanked: 1 time
Easiest Keyboard Solution for Development?
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!
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!
- aberu
- Core Developer
- Posts: 1161
- Joined: Tue Jun 09, 2020 8:34 pm
- Location: Longmont, CO
- Has thanked: 244 times
- Been thanked: 404 times
- Contact:
Re: Easiest Keyboard Solution for Development?
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.
Then, after you make the decoder, you take that data in and assign it to keycodes for the machine, in your core.
birdybro~
-
- Posts: 8
- Joined: Fri Jun 17, 2022 4:22 am
- Has thanked: 11 times
- Been thanked: 1 time
Re: Easiest Keyboard Solution for Development?
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.
-
- Core Developer
- Posts: 537
- Joined: Sun May 24, 2020 9:30 pm
- Has thanked: 19 times
- Been thanked: 143 times
Re: Easiest Keyboard Solution for Development?
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.
- aberu
- Core Developer
- Posts: 1161
- Joined: Tue Jun 09, 2020 8:34 pm
- Location: Longmont, CO
- Has thanked: 244 times
- Been thanked: 404 times
- Contact:
Re: Easiest Keyboard Solution for Development?
I was about to say the same thing earlier, but they mentioned they were not going to use the framework
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
birdybro~
-
- Core Developer
- Posts: 537
- Joined: Sun May 24, 2020 9:30 pm
- Has thanked: 19 times
- Been thanked: 143 times
Re: Easiest Keyboard Solution for Development?
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…).
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…).
-
- Posts: 8
- Joined: Fri Jun 17, 2022 4:22 am
- Has thanked: 11 times
- Been thanked: 1 time
Re: Easiest Keyboard Solution for Development?
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.
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.
- aberu
- Core Developer
- Posts: 1161
- Joined: Tue Jun 09, 2020 8:34 pm
- Location: Longmont, CO
- Has thanked: 244 times
- Been thanked: 404 times
- Contact:
Re: Easiest Keyboard Solution for Development?
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~
-
- Posts: 8
- Joined: Fri Jun 17, 2022 4:22 am
- Has thanked: 11 times
- Been thanked: 1 time
Re: Easiest Keyboard Solution for Development?
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!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/
Re: Easiest Keyboard Solution for Development?
+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...