Closed nand2mario closed 11 months ago
It is OK to support the DS2 gamepad. I use a USB Keyboard with my Tang Primer (Anlogic), just for reusing my old keyboard and do not need to buy an additional gamepad. And if you do not use it, you can insert it into a computer for reusing.
@nand2mario I will try to work out a way to make it work with a generic USB gamepad, it is a nice feature to have in the project
@nand2mario I will try to work out a way to make it work with a generic USB gamepad, it is a nice feature to have in the project
That'll be great.
@nand2mario the USB implementation in was made with UKP - USB Keyboard Processor (only works in low speed USB devices, which I do not have anyone here to test, although I could build and test the TG9 NES core successfully).
The good part is that it has been already tested by @hi631 and it takes ~430 LUTs:
The bad part is about devices compatibility, I do not believe it should be a nice idea to use this way.
I believe could help us better with UTMI implementation, taking about ~580 LUTs:
what do you think about?
@Chandler-Kluser Thanks for the pointer and I'll take a look at core_usb_host.
Very quickly it seems to use AXI_lite and requires a CPU to function, which the nano 20K does not have. USB is designed with software drivers in mind so making a usb host with FPGA is kinda hard.
maybe a cheap microcontroller is a better option, I know the intention is to make the board to do all the stuff and USB Gamepad support would be such a nice feature...
but thinking about your suggestion, ukp is also a cpu written in verilog so I do not see any alternative for that
I know its not intended to be done but I have connected an ESP32 with a blueretro firmware in FPGANES project in Tang Nano 9k exchanging the UKP USB module DS2 interface and it worked pretty well in TG9K.
The pros of doing that are:
It has its drawbacks:
what do you think, @nand2mario ?
another option is using tinyusb lib with some cheap microcontroller to get the desired USB interface.
in my opinion, adding this kind of functionality directly in FPGA will take great number of FPGA resources.
maybe a cheap microcontroller is a better option, I know the intention is to make the board to do all the stuff and USB Gamepad support would be such a nice feature...
but thinking about your suggestion, ukp is also a cpu written in verilog so I do not see any alternative for that
https://github.com/nand2mario/nestang/assets/3775235/058f10be-c9ce-4109-b957-c255db68bfc9
I have posted a by merging NES core with the DS2 from project.
There's now a working first version of USB gamepad support on the usb_gamepad branch. At least it works with my gamepad.
Connect D+ to pin 41 and D- to 42, and add two 15k pull-down resistors as shown below.
Todo: gamepad type detection as apparently there are many different kinds; and 2nd player, and autofire.
This is just released in v0.6. Thanks @Chandler-Kluser for your help.
It may be possible to add USB gamepad support through hi631's usb-ukp technique: https://qiita.com/hi631/items/4f263ca676e4be14b9f8 and http://kwhr0.g2.xrea.com/hard/pc8001.html
We probably need both HID and XINPUT.