Live data from Hacker News

Building a USB SNES Controller

blog.chybby.com

91–100 of 101 posts

Re: Building a USB SNES Controller

#91
post #86
post #74

Is Arduino real-time? I.e. is a 6 millisecond delay guaranteed to actually be 6 milliseconds?

Yes, it is real time, but due to interrupts you have to manage critical sections with cli() and sei() and your time base is a 16.000 MHz crystal. Most instructions for ATmega and ATtiny execute in 1 clock cycle so writing deterministic, time-critical code is straightforward.

Thanks for the tip to turn off interrupts when working with precise timing!

Re: Building a USB SNES Controller

#92
post #84

I think the project is cool, but since a usb snes controller is, what 5$ on ebay (or more to have quality one), I find it too bad that you damage a working, vintage real snes controller that there will be less and less of.

The way I saw it, I'd rather have a memento of the past that I can actually use than one that will sit around in a drawer.

Re: Building a USB SNES Controller

#94

my very first electronics projects were classic controller to USB conversions. I remember struggling with PIC after just wrapping my head around BASIC Stamps, and trying to follow raphnet tutorials https://www.raphnet.net/electronique/multiuse_tiny1/index_en... going to show this article when people ask 'how do i get started with a fun electronics project' :)

Thank you! Glad you liked it :)

Re: Building a USB SNES Controller

#95
post #26

Looking at the described protocol it seems the SNES controller uses a simple 16-bit parallel-in-serial-out shift register - and a quick Google confirmed that. This means the timing is almost certainly quite loose, and there's a pretty decent chance you might even be able to poll it as the 1kHz "needed" for "serious" gaming. And it'd be pretty trivial to offload the readout to the MCU's SPI peripheral.

Thanks for teaching me about SPI, I might have a play around and see if I can get that working.

Re: Building a USB SNES Controller

#96
post #41

This is really cool! One thing I'm wondering is how the SNES implemented its Multitap support[1] with such a simple "wire protocol". Could it be that the two missing wires and/or 4 unused slots in the polling cycle are used for some kind of adressing scheme when a multitap is plugged in? https://nintendo.fandom.com/wiki/Super_Multitap

The schematics for the multitap are out there in the SNES developer manual [1]. I actually made one on a breadboard for fun [2] and eventually turned it into a PCB. It's a pretty simple circuit with an analog mux and some tri-state buffers.

[1] https://archive.org/details/SNESDevManual/book2/page/n385/mo...

[2] https://www.downtowndougbrown.com/2013/04/homebrew-snes-4-pl...

Re: Building a USB SNES Controller

#97
I prefer a nondestructive approach. I set up an ATTINY85 clone to serve as a DIY USB adapter. Just solder a controller extension cable to the microcontroller to donate the right port, and you have everything you need. You have enough GPIO pins and the requisite 5v logic to make it a great fit. Mine was made for NES controllers, but it uses the same shift logic as the SNES controller, just with fewer buttons.

Re: Building a USB SNES Controller

#98
Not sure if this has been mentioned already:

https://github.com/MickGyver/DaemonBite-Retro-Controllers-US...

It's how to build your own demon bite adapters using Arduino, for various console. These are super low lag.

If you Google demon bite you can find various sites selling premade adapters.

These are really popular with mister fpga users:

https://en.m.wikipedia.org/wiki/MiSTer

This is a bit of a rabbit hole, the mister is the best retro related thing I've bought / built.

Here's a useful listing of various usb adapters and their latency:

https://rpubs.com/misteraddons/inputlatency

Re: Building a USB SNES Controller

#99
post #90

Earlier quoted context omitted.

Yeah I too wondered why the author would target 60Hz at all. The fact that the SNES controller is polled at 60Hz is simply a consequence of the game reading the input at that rate. As mentioned in the other comment in this setup the polling of the controller is not in sync with the game reading the input at all. Thus even if you target a polling rate of 60Hz perfectly you'd actually have worse input latency than the…

I had a feeling the polling rate was probably to do with the frame rate of the SNES rather than some requirement of the controller. I'll try out a higher polling rate and see what happens.

Yeah I wouldn't be worried about the hardware at all. The only chips on there are two 8-bit shift registers and according to the datasheet at 5V they can run up to 3MHz. You're much more likely to run into the limits of the USB protocol than the SNES controller hardware.

Re: Building a USB SNES Controller

#100
I recently made an xbox 360 chatpad work with windows using an esp32. It's kind of a grail moment when you search about it. A bit late to the party as the modern chatpad + controller do work, but 360 controllers and chatpads are very inexpensive. It's chatpad > esp32 > bluetooth > anything, stuck neatly on the back you hardly notice it's there.
Post reply on HN