PDA

View Full Version : XInput -> JVS IO adapter



SpamYouToDeath
09-14-2018, 11:55 PM
I had been playing NAOMI games on my TV using a supergun and JAMMA converter board, but of course that gets pretty unwieldy. I was frustrated with the giant pile of electronics necessary to run it all. The NAOMI has its own PSU and already outputs VGA video and stereo line-level audio... so really, the supergun and JAMMA converter were only necessary to provide the input. I figured I could make a much smaller solution - something that would just act as a JVS IO slave, and provide the switch inputs from some kind of game controller.

The JVS IO protocol isn't documented anywhere in English, but there's a Japanese spec floating around, and some people have made working implementations.
This guy made a IO slave out of an Arduino-type board:
https://github.com/charcole/TeensyJVS

These two guys have pretty good documentation:
https://github.com/TheOnlyJoey/openjvs/wiki/Protocol
http://wiki.pcbotaku.com/wiki/JVS_I/O

So with those resources, the Japanese copy of the spec, and Google Translate, I was able to get a working implementation mocked up on my computer in an hour or two. It responded correctly to the sample frames on those web pages, and was reasonably simple to run.

So I started looking for a microcontroller that could handle it, and also poll some kind of game controller for input. It would have been trivial to support an SNES or PSX controller or something, but those are actually getting hard to find now. Most consoles for the last 10 years have been USB-based, so I decided to go with something that could host a USB bus.

I settled on the PIC32MX220, which was convenient because I already had a development kit from a college class.

With the PIC32 and a MAX485 transceiver, I was able to make up a prototype that could poll an Xbox controller and relay the results to a JVS game:

51612

(Seen here amongst a very messy workspace)

So I made up a circuit board and ordered a batch from DirtyPCBs. The whole thing fits in 40x80mm - really tiny, though I used all through-hole parts to make the soldering easy.

51613


The parts got here today, and I put one together - including a little aluminum case for it. (I didn't have anything to properly cut the end caps, though.)

51614
51615

There's two LED lights. I use one to indicate whether a USB gamepad device has been enumerated, and one to indicate that the JVS master has assigned an address to the adapter.

51616

It works great for one player right now, but it's still a bit unfinished. Obviously I need to support USB hubs to handle multiple controllers, and it's a real pain to write all that USB driver code from scratch. I'm working on it, though. Also, there's an EEPROM on board for saving control settings, but the software doesn't yet support that.

51617

shadowkn55
09-16-2018, 06:01 PM
Awesome work. Makes me want to brush off the dust of a similar project I set aside ages ago.

fisk
09-16-2018, 08:24 PM
Will you be selling these in the future? I have a couple NAOMI's that I have consolized and would love to try this out on them.

SpamYouToDeath
09-16-2018, 08:55 PM
I worked a bit more on this over the weekend - I got support for the EEPROM working, and set it up so I can rebind controls on-the-fly and have them saved across power cycles. With that, I've confirmed that all of the design is functional - so I went ahead and assembled the rest of the boards.

51632

I still don't have hub support implemented - I'm dreading that mess. According to Microsoft, there's all kinds of ways that a hub can misbehave, and they just handle it all in the drivers. So, that's going to be fun.


Will you be selling these in the future? I have a couple NAOMI's that I have consolized and would love to try this out on them.

Well, I've got 10 of them. I just can't guarantee that they'll work with a given USB device in advance. Let's say... I'll sell them to anyone who has their own PIC programmer. They cost me about $30/each to make.

nam9
09-17-2018, 05:31 AM
Would a PicKit 3 be sufficient to program with?
This looks interesting for a TTX2 buil I am working on, as well as the Naomi...

SpamYouToDeath
09-17-2018, 05:50 PM
Would a PicKit 3 be sufficient to program with?
This looks interesting for a TTX2 buil I am working on, as well as the Naomi...

Yeah, it's just a PIC32MX220 and I've got their standard programming connector on the board (should be the same 6-pin port as on the PICKit3).

I mainly want to avoid implementing a firmware update feature - it would be technically possible to reflash the thing using a file on a USB drive, but that would probably triple the amount of code needed on the PIC. Programmers for the PIC are super-cheap anyway. I assume anyone who wants something like this doesn't mind getting familiar with it.

kuze
09-17-2018, 06:03 PM
Pretty damn cool! Nice project.

bubba966
09-17-2018, 06:04 PM
Awesome work. Makes me want to brush off the dust of a similar project I set aside ages ago.

Dust it off and sell me one at PRGE

SpamYouToDeath
09-17-2018, 10:02 PM
I'm working on PS3/PS4 controller support, but they're not as obvious as an XInput controller. They seem to just look like regular HID-class devices, and I'm not sure how to properly determine that something "is a PS3 controller" or "is a PS4 controller". I can detect and use the first-party DualShock 4, though.

I hooked up analog controls as a hack, and got very distracted playing Crazy Taxi...

SpamYouToDeath
09-21-2018, 07:04 PM
After a bit more frustration, I've got USB hubs working now. So, I can connect 4 controllers, and play 4-player games (i.e. Power Stone 2) with them. I light up the XInput LEDs according to the player number; I still haven't gotten around to making the DS4 LEDs work.

51711

I'm still a bit confused as to exactly what distinguishes a PS3 or PS4 controller from a usual USB HID.

Epyc
01-30-2020, 11:10 AM
We briefly chatted, any updates on this? I’m particularly interested in the JVS to Discrete adapter you mentioned.

JoeAwesome
01-30-2020, 12:46 PM
Wow. This would be crazy with a TTX2 multi setup.

SpamYouToDeath
02-01-2020, 08:38 PM
I'm working on a better approach (i.e. not hosting the USB myself) but my PCB order ran into the New Year holiday. The factory re-opens on the 4th so I should be able to test the new boards soon. I'll post a new thread about those when I've got them working.

SpamYouToDeath
03-02-2020, 10:23 PM
The factory finally re-opened and shipped the PCBs. So, that's coming as soon as I get some assembled and tested.

Epyc
03-05-2020, 08:01 PM
The factory finally re-opened and shipped the PCBs. So, that's coming as soon as I get some assembled and tested.

Exciting news. Looking forward to seeing the results.