Author Topic: SNES controller IC tester project  (Read 2496 times)

0 Members and 1 Guest are viewing this topic.

Offline 68010msxTopic starter

  • Newbie
  • Posts: 7
  • Country: us
SNES controller IC tester project
« on: December 29, 2023, 09:09:18 pm »
Hi all,

I have a reason for a different project that I want to be able to rapidly test the function of ICs for SNES pads whilst separate from the PCB.  My plan is to get one of these https://www.adafruit.com/product/1795?gad_source=1&gclid=CjwKCAiA-bmsBhAGEiwAoaQNmpEgZHtuYhS_s5zHdu71ZX5KvaYv0u9CFlR3CciCISD-tH9r1Lb-aRoCwFMQAvD_BwE(I hope it fits need to make sure later) and use an MCU to write a program to test inputs vs outputs on the data line. 

I *think* it should be pretty straight forward, I need to have a truth table and then have the MCU do an input on the IC and check the data line...but how much testing do I need to do?  Just every input individually would be the basic function test, but what about combinations?  Is it possible for the IC to fail w/ certain combinations while individual inputs seem fine? 

The reason I want to do this is because they would be a part of a separate product I would sell, and I have heard these ICs have poor ESD protection and sometimes fail, and I would like to rapidly test them in a test setup first before soldering them to a DIP adapter and then function testing by hand with the human error factor.  And of course, this is overkill for my needs but I think I would learn a lot doing this and then can apply it on a couple different personal projects.

Any ideas on this welcome, thanks!
 

Offline Andy Chee

  • Super Contributor
  • ***
  • Posts: 1717
  • Country: au
Re: SNES controller IC tester project
« Reply #1 on: December 30, 2023, 05:06:13 am »
It sounds like you want to do something like this, except instead of Z80 you want to test SNES chips?

 

Offline the_cake_is_a_lie

  • Contributor
  • Posts: 32
  • Country: us
Re: SNES controller IC tester project
« Reply #2 on: December 30, 2023, 05:15:04 am »
That's cool, I can be supportive of your effort. I think you really just buy a SNES controller extension cord and cut end that plugs into the console off and solder the wires to the PCB and avoid any expensive test sockets. Maybe use a DIN connector or JST. I see SNES controller extension cords go for $5 USD apiece on AliExpress but I don't know the quality. Probably easy to buy extension cables from Japanese sellers where the Super Famicom (and Famicom) controller cables are short as hell.

People have been making push button indicators for their Twitch streams for years using Arduino Unos or clones. They split the signal using an extension cord to send one line to the microcontroller and the original line to the console. You don't need to send to the console since I'm sure the point is having a portable tester that doesn't need a console. Copy the design - conveniently MIT licensed - and add an LCD or OLED screen on the PCB to display the button(s) being pressed versus send to computer over USB. Well, you'd have to emulate the data clock and latching but that's very doable with a microcontroller. You need 12uS square waves at 50% duty cycle, or about 83 kHz, which is again is very doable.

Problem is the cost of Arduino Uno or a clone. If that's $15 and you sell for double the cost to manufacture to make some min profit then no one is going to buy this for over $40 before shipping. Anyone with a $15 controller to USB adapter + computer can use that to check. I learned microcontrollers on 8-bit PICs which are super cheap and heavily used by professionals, cause well they're super cheap.

The way the SNES controller works has been known forever and is extremely electrically similar to NES, so I recommend supporting NES as well. Can use the same setup and double the market base. Interestingly, +5V means no button is pressed while 0V means it's pressed. The B button on SNES is checked first, which is important because one controller issue is only being able to register B. I assume that means the serial data line is stuck to 0V from oxidation. Honestly, I don't think there is much research in controller issues when they're relatively cheap and plentiful and wireless replacement controllers exist.

There is some SNES PAL controller lockout mechanism that keeps them from working on NTSC consoles. Not sure if that's relevant here or not. Just be sure to test NTSC and PAL controllers.
 

Offline the_cake_is_a_lie

  • Contributor
  • Posts: 32
  • Country: us
Re: SNES controller IC tester project
« Reply #3 on: December 30, 2023, 05:15:03 pm »
The no solder SMT socket is pretty cool though. I want one. Poor ESD protection noted.

For economic feasibility, I think you're forced into a USB controller adapter product but that also gives way to more open source software. Downside of GNU license here is you have to release your source so people can easily clone you, unlike the MIT license.

That USB controller adapter uses an Arduino Pro Micro (ATMega32U4) versus NintendoSpy push button indicator with the Arduino Uno ATMega328P. The Micro is more reasonably priced at $9 USD with all the bells and whistles and is not end of life'd like the ATMega328P. Sorry I didn't include earlier.

I'm amused by the reverse project of using an expensive Arduino Mega 2560 to emulate a real SNES controller and work on a real console. So you can have the microcontroller test itself as a controller for the console and use the discarded half of the controller extension cable. Going full circle.

Would be nice to break out of this Arudino stranglehold though. These are the most expensive (!!) microcontrollers that are popular anyway but legal clones exist due to permissive licensing.
 

Offline 68010msxTopic starter

  • Newbie
  • Posts: 7
  • Country: us
Re: SNES controller IC tester project
« Reply #4 on: December 30, 2023, 09:34:53 pm »
That's cool, I can be supportive of your effort. I think you really just buy a SNES controller extension cord and cut end that plugs into the console off and solder the wires to the PCB and avoid any expensive test sockets. Maybe use a DIN connector or JST. I see SNES controller extension cords go for $5 USD apiece on AliExpress but I don't know the quality. Probably easy to buy extension cables from Japanese sellers where the Super Famicom (and Famicom) controller cables are short as hell.

In my application I need to test the IC after it has been thermo-cycled and removed from the SNES controller, especially since they have poor ESD protection.  I am removing the ICs for use in a different project outside of the SNES controller PCB so testing that the controller works isn't the best test for me.

Quote
People have been making push button indicators for their Twitch streams for years using Arduino Unos or clones. They split the signal using an extension cord to send one line to the microcontroller and the original line to the console. You don't need to send to the console since I'm sure the point is having a portable tester that doesn't need a console. Copy the design - conveniently MIT licensed - and add an LCD or OLED screen on the PCB to display the button(s) being pressed versus send to computer over USB. Well, you'd have to emulate the data clock and latching but that's very doable with a microcontroller. You need 12uS square waves at 50% duty cycle, or about 83 kHz, which is again is very doable.

Ah VERY helpful, thank you!  So step one would be a version of the button tester (I can definitely hookup a character LCD easily), do you know other than testing the individual buttons and confirming if there's anything else to check to be safe?  Not trying to be overly-navel gazey but while I'm at it I might as well test the "proper" way as much as possible, I just don't know what that is.  I guess I could implement some kind of current check too once I've established a range of normal.

Quote
Problem is the cost of Arduino Uno or a clone. If that's $15 and you sell for double the cost to manufacture to make some min profit then no one is going to buy this for over $40 before shipping. Anyone with a $15 controller to USB adapter + computer can use that to check. I learned microcontrollers on 8-bit PICs which are super cheap and heavily used by professionals, cause well they're super cheap.

Oh that's not an issue for me, I'm not planning on selling the IC tester, just using it to test ICs and pass them so that I can use them in another application, so it's an internal use tool.  I already have plenty of arduinos to use.

Quote
There is some SNES PAL controller lockout mechanism that keeps them from working on NTSC consoles. Not sure if that's relevant here or not. Just be sure to test NTSC and PAL controllers.

I wasn't aware of this, thanks!  I'm in an NTSC region but my project is using RGB only for arcade use, so I never really thought about that.  It's actually MUCH cheaper to import a bunch of Japanese dirty SNES controllers (I don't care about the condition obviously) than it is to buy individual ICs from Aliexpress.  PAL stuff is not common around here.
 

Offline 68010msxTopic starter

  • Newbie
  • Posts: 7
  • Country: us
Re: SNES controller IC tester project
« Reply #5 on: December 30, 2023, 09:35:30 pm »
It sounds like you want to do something like this, except instead of Z80 you want to test SNES chips?



Very interesting and might prove helpful, thanks!
 

Offline 68010msxTopic starter

  • Newbie
  • Posts: 7
  • Country: us
Re: SNES controller IC tester project
« Reply #6 on: December 30, 2023, 09:38:40 pm »

I'm amused by the reverse project of using an expensive Arduino Mega 2560 to emulate a real SNES controller and work on a real console. So you can have the microcontroller test itself as a controller for the console and use the discarded half of the controller extension cable. Going full circle.

I actually did something very similar and rolled my own Sega Genesis controller on protoboard from 74 series chips so that arcade controls could be used on Sega Genesis w/o having to padhack real Genesis controllers.  I'm sure there's a way to do similar with SNES and NES but I haven't figured out exactly how the cascade works, that would be nice to not need customs.  Unfortunately for Genesis I think the 6 button controller is not 100% reverse engineered yet to be able to replace the IC with generics (I haven't looked into this stuff in a few years so don't shoot the messenger if I'm out of date!)
 

Offline abeyer

  • Frequent Contributor
  • **
  • Posts: 700
  • Country: us
Re: SNES controller IC tester project
« Reply #7 on: December 30, 2023, 11:44:23 pm »
In my application I need to test the IC after it has been thermo-cycled and removed from the SNES controller, especially since they have poor ESD protection.  I am removing the ICs for use in a different project outside of the SNES controller PCB so testing that the controller works isn't the best test for me.

Wasn't the SNES controller just based around a shift register? Wouldn't it be easier and cheaper to buy some cheap modern shift register?
 

Offline 68010msxTopic starter

  • Newbie
  • Posts: 7
  • Country: us
Re: SNES controller IC tester project
« Reply #8 on: December 31, 2023, 12:12:08 am »
I believe the SNES is based on the NES IC so it's some sort of cascading shift register (I think early SNES pads have two ICs before they got integrated, even), I have not seen a circuit for using standard shift registers though.
 

Offline the_cake_is_a_lie

  • Contributor
  • Posts: 32
  • Country: us
Re: SNES controller IC tester project
« Reply #9 on: December 31, 2023, 12:13:26 am »
In my application I need to test the IC after it has been thermo-cycled and removed from the SNES controller, especially since they have poor ESD protection.  I am removing the ICs for use in a different project outside of the SNES controller PCB so testing that the controller works isn't the best test for me.

Wasn't the SNES controller just based around a shift register? Wouldn't it be easier and cheaper to buy some cheap modern shift register?

Yes, you beat me to it.


Thanks for explaining! I didn't really understand why you would remove the chip(s) from the controllers versus just test the controllers. Really though, just buy new flop-flop parallel to series shift registers. They're cheap and plentiful and no one going to notice if they're the real thing or not. Can use 3.3V to be more power efficient. Real thing probably has thousands of hours of wear and tear and of course needs testing. New ones are just going to work.

NES needs one 8-bit shift register for up, down, left, right, B, A, Select, Start. SNES needs two (or one 16-bit) with 4 leftover bits that indicate peripherals like the 16th bit for SNES mouse. Would be nice to support the mouse or Super Scope (lol) or Konami Justifier but then they would need 15 kHz CRT monitors for light gun syncing.

As NES and SNES are extremely popular consoles, controller circuits have been reverse engineered long ago. NES B is SNES Y and NES A is SNES B. Seems you can use NES and SNES controllers on the other console just by changing the adapter but I didn't know NES and Famicom wiring were different. I use a Super Famicom Hudson Super Joy Card turbo controller on North American SNES, so no issue there. May as well support NES with minimal extra effort for the arcade game ROM variants.

If you wanted a test suite in any case, 12 buttons which can be on or off in almost any combination is 2^12 = 4096 combinations and at 1 NTSC frame to test each would take 69 seconds. There is the important point of illegal controller input. Lots of games glitch by hitting left + right or up + down directions at the same time, which is impossible on normal controllers and speedrunning communities don't allow it...except for Super Mario Kart. They grind down the pad to cheat but since everyone cheats, it's fair. Emulators usually have a box to check to allow illegal input. You might want to have a toggleable option on your device with LED indicator light so fair play can be confirmed.

You know what, I've been meaning to get around to checking what the turbo frequencies are. Hudson Soft added cheat codes to Super Bomberman 2-5 using the timing on their Super Joy Card. Presumably, if another turbo controller has a different frequency then it won't work. Really hard to trigger manually. Lockout at its finest.

The only errors I know of are the controller latching on B like I was saying and people saying controller port 1 or 2 doesn't work and the other does, which seems obviously from the console circuity being oxidized and probably repairable with isopropyl alcohol.

Genesis 6 button controllers, interesting to me how those have a 3-button compatibility mode to be compatible with all games. If the timing and circuitry still have some unknowns, I can't imagine the rules being hard to figure out with a digital logic analyzer. We're talking kHz speed. Maybe there's a custom chip.
 

Offline the_cake_is_a_lie

  • Contributor
  • Posts: 32
  • Country: us
Re: SNES controller IC tester project
« Reply #10 on: January 06, 2024, 10:30:00 am »
The time for original research has come. I took the easy way out of testing turbo controllers with SNES to USB adapter + online Gamepad tester that records timestamps of buttons being pressed or unpressed. I used OBS to capture then frame advanced in VLC to record the times. Very annoying thing on the tester is the three numbers to the left of the decimal are milliseconds and seconds to the left of that. First digit to the right is 100 microseconds.

I used the SFC Super Joy Con by Hudson Soft who made Super Bomberman 2 and Hori's SFC Fighting Commander. The only way to unlock the 2 extra battle mode stages in Super Bomberman 2 is holding X down with the Super Joy Con's low speed turbo option enabled for the ring to go off at just over 6 seconds. Done at the game option screen. High speed turbo doesn't work. Hori is locked out since its turbo is at a different frequency. The ring tone means you get Power Zone and Jump Zone from Super Bomberman 1.

Super Joy Con low speed turbo toggles every 4 frames for 8 frames to a full period of 128 ms for 7.5 Hz
Super Joy Con high speed turbo toggles every 2 frames for 4 frames to a full period of 64 ms for 15 Hz

Fighting Commander slow motion 1 toggles the pause button every frame for 2 frames to a full period of 32 ms for 30 Hz
Fighting Commander slow motion 2 toggles the pause button every 2 frames for 4 frames to a full period of 64 ms for 15 Hz
Fighting Commander turbo toggles every frame for 2 frames to a full period of 32 ms for 30 Hz

32 ms aka 30 Hz is the max possible turbo speed from SNES (and NES) and therefore the best if you're allowed to turbo in speedrunning through RPG text boxes or shootem ups. Japanese speedrunning is much more likely to allow turbo than Western rules.

Fighting Commander has T turbo for holding the button down for turbo like the Super Joy Con and also H reverse turbo where turbo is auto pressed without you holding the button down and holding it down turns the input off. The movement speed in slow mo is the same for both options since the game is paused half the time but the stuttering is noticeably longer in option 2. Genius design to me. Hori's Fighting Commander wins for fastest turbo and loses for getting locked out of Super Bomberman 2-5 perks. Unless you can achieve a real feat of dexterity and brute force tapping at 7.5 Hz for over 6 seconds.



Other thing I meant to say in last reply is this is low kHz frequency stuff, you can breadboard the entire controller circuit with through hole components. No need for the $35 SMT Test Socket but it's still nice to have. The bit shift registers are cheaper in surface mount form, as is typical in IC pricing. The 16-bit ones cost much more than 2x 8-bit so I'd go the 2x route. Well, you could use a microcontroller with 13-15 digital IO pins and forgo the registers if you're decent enough at programming.
 
The following users thanked this post: abeyer


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf