The NEW Build Your Own Arcade Controls

Main => Main Forum => Topic started by: fleskebacon on September 12, 2013, 03:27:06 pm

Title: Sanwa JFL / I-Pac USB
Post by: fleskebacon on September 12, 2013, 03:27:06 pm
I have a problem.

I've wired up the I-pac to a Sanwa JLF joystick, and I'm having a problem that I'm having a hard time finding the solution to.

The problem is, that sometimes I get a "double tap" from tapping the joystick in a direction. When tested in Notepad, I then get first one "tap" from the movement, and then another "tap" in the same direction when I release the joystick to the center.

In MAME games this doesn't seem to matter much, but in menus it's a real pain because the cursor often moves two steps with one tap.

The problem is intermittent and applies to various directions at various times, though most often in one specific direction. I haven't found a consistent way to provoke the problem to appear, but when I disconnect and reconnect the connector into the joystick a couple of times it sometimes goes away. But not always, and it reappears after a while.

I've checked everything in the I-Pac software, and I can't see any errors there - all buttons and joystick directions seem to be working perfectly.

I've also checked the Windows keyboard settings, disabled sticky keys, tried out various repeat settings and all that.

Tried two different joysticks of same make, they both have the same problem.

Checked all contacts, they seem good. Also tried to solder on the leads to the joystick to eliminate bad contacts there.

Tried searching various forums for a while without any luck...

Any ideas? Bad joystick or something else? Some sort of ghosting? The Sanwa joysticks are new, and are supposed to be "one of the best around", as I understand?
Title: Re: Sanwa JFL / I-Pac USB
Post by: zanna5910 on September 12, 2013, 05:41:59 pm
If this is only a problem with your front end, do you have the key double mapped? 

Other possible: wiring issues, shorts, incorrect hookup (since you say you reconnect connector several times and it works again.)

Try to clear the ipac setting, then reprogram it.  If that doesn't work, try to re-write entirely the switch.  Try a different microswitch to see if that is the problem.
Title: Re: Sanwa JFL / I-Pac USB
Post by: fleskebacon on September 14, 2013, 08:02:49 am
The error occurs everywhere, including Notepad. So the frontend setup is pretty much ruled out.

After some trial and error it's pretty clear that the joystick itself is the problem. When I press the microswitches manually everything's ok, and in 4-way mode the problem is not as noticeable as in 8-way.

I thought the Sanwas were top of the line?
Title: Re: Sanwa JFL / I-Pac USB
Post by: rCadeGaming on September 15, 2013, 01:23:10 pm
I doubt that the joystick is causing this.  I do agree that JLF's are top of the line, I've been using them for about 5 years, but with any brand I doubt the microswitches would cause an intermittent "double tap" like that.  If you want to be absolutely sure, replace the PCB on the JLF with the microswitches, or you could just wire up four to use for the four directions to rule it out.  I bet the problem won't change.

It's probably either a problem with your I-PAC hardware, or problems with it communicating with the PC.  What OS are you running?  How old is your motherboard?  Are the drivers up to date?  What kind of USB port are you using, 1.0/2.0/3.0?
Title: Re: Sanwa JFL / I-Pac USB
Post by: fleskebacon on September 16, 2013, 10:56:18 am
I agree that it seems strange, but I really can't see what else could be causing this, as manipulating the microswitches in various ways is the only thing I can see triggering or removing the problem. Of course, the problem could lie elsewhere, as pushing the microswitches in different ways probably could cause the I-Pac or other stuff to react differently.

I run Windows 7 64-bit, on a reasonably new 3 GHz Core2Duo, probably USB 2.0. All drivers are updated. But the PC has been used for other stuff for a while, I could always try installing a fresh copy of Windows. Any version in particular that is recommended?
Title: Re: Sanwa JFL / I-Pac USB
Post by: rCadeGaming on September 16, 2013, 05:37:15 pm
If your system is that new it should be fine, but something that new is likely to have USB 3.0 ports.  Try making sure its plugged into a 2.0, that's what the website says it's designed for in any case.  Just a guess...

How old is the I-PAC?  Is it a 2 or 4?  When's the last time you updated the firmware?

Try different microswitches, a different encoder, a different PC, etc.  You haven't yet isolated any of those three as the problem, as you will need to to troubleshoot this.
Title: Re: Sanwa JFL / I-Pac USB
Post by: fleskebacon on September 16, 2013, 06:13:14 pm
Ok, tried another PC, same problem. Wired up the buttons to the joystick inputs, problem gone. Wired the joystick back up to the same inputs, problem returns. Wired up another Sanwa JLF, still same problem. (This other Sanwa is usually hooked up to the player 2 inputs on the same boards, and it displays the same problem there.)

The I-Pac is a brand new I-Pac 2, haven't updated the firmware.

By different encoder, you mean like another I-Pac?

Sprayed electronics cleaner inside the switches, problem gone! For now, at least. I'll see how that works out and post back. :)
Title: Re: Sanwa JFL / I-Pac USB
Post by: rCadeGaming on September 16, 2013, 06:51:37 pm
Ah, it sounds like there was too much contact bounce and you reduced it by improving the connection between the contacts.  Nice.

What kind of cleaner did you use?  I keep DeoxIT around for cleaning rotary switches and such, but I hadn't thought of using it for button/stick switch contacts; makes perfect sense though.  Sorry to steer you in the wrong direction, I just had never seen this with my JLF's.  I'll keep it in mind now.

By different encoder, you mean like another I-Pac?

I did, but it sounds like you've successfully isolated it to the microswitches in the stick.  You should lube up all the contacting plastic parts while you've got it apart.

EDIT:  Well, you wouldn't have had to buy a whole other I-PAC, that would be a little much.  To help rule out your encoder as the problem you can see if anything changes by just wiring the microswitch(es) in question to a gamepad or keyboard.
Title: Re: Sanwa JFL / I-Pac USB
Post by: fleskebacon on September 16, 2013, 07:15:01 pm
Don't worry, I like to keep all options open until the problem's solved. Thanks for the input!

The JLF's are also brand new, so I kind of had a hard time thinking they could both be bad. But both the PCB and everything else was soaked in lube when I got them, maybe there was lube inside the switches which made them behave strangely? I don't know, I'm just hoping this solved it for good. It was an immediate improvement, so it's obvious that I'm at least onto something. :)

Lucky for me I didn't beat the sticks to death in frustration before I could solve it. That would be classic..

I used CRC electronics cleaner. I suppose the switches are supposed to work dry and don't require any lubrication at all?
Title: Re: Sanwa JFL / I-Pac USB
Post by: ahofle on September 17, 2013, 12:08:14 am
I have had this problem with Happ Supers + iPAC4 for quite a while and it is indeed bounce.  I typically reflow the solder and that fixes it for a while but it usually comes back eventually.  I was considering going with quick disconnects, but it sounds like that doesn't help.  I will definitely be trying your cleaner trick.  When you say you cleaned the inside of the switches, do you mean you took apart the actual microswitches and sprayed the delicate metal contacts inside?
Title: Re: Sanwa JFL / I-Pac USB
Post by: rCadeGaming on September 17, 2013, 10:35:45 am
both the PCB and everything else was soaked in lube when I got them

Aaaaah.  That's kind of a red flag.  Maybe it got stored somewhere hot between the factory and your house, and the lube that's just supposed to be around the shaft got warm and melted into everything.

I suppose the switches are supposed to work dry and don't require any lubrication at all?

Yeah it would probably be best if they're bone dry inside.  Contact cleaner sometimes leaves a beneficial residue that prevents corrosion and such, but other than that you don't want anything in there.

I was talking about lubing the moving parts around the shaft, especially the white nylon hemispherical pivot thing.  These sticks last a lot longer if properly lubed in the right places.  If left dry, you'll find plastic dust indicating heavy wear.

I have had this problem with Happ Supers + iPAC4 for quite a while and it is indeed bounce.

Contact bounce is an almost unavoidable reality with any kind of mechanical switch.  A lot of hardware and software have some kind of signal debouncing built in though.  Aholfe, what software are you noticing this with?  I'm thinking of switching to an I-PAC4, and you guys are getting me worried that they're especially sensitive to contact bounce.

Also, I'd guess that you'd get best results with something specifically designed for cleaning contacts, not just a general electronics cleaner.  Not saying that your CRC stuff doesn't fit this, just that I don't know.  I'd check the intended use on the can.
Title: Re: Sanwa JFL / I-Pac USB
Post by: ahofle on September 17, 2013, 11:51:56 am
I have had this problem with Happ Supers + iPAC4 for quite a while and it is indeed bounce.

Contact bounce is an almost unavoidable reality with any kind of mechanical switch.  A lot of hardware and software have some kind of debouncing built in though.  Aholfe, what software are you noticing this with?  I'm thinking of switching to an I-PAC4, and you guys are getting me worried that they're especially sensitive to contact bounce.

Also, I'd guess that you'd get best results with something specifically designed for cleaning contacts, not just a general electronics cleaner.  Not saying that your CRC stuff doesn't fit this, just that I don't know.  I'd check the intended use on the can.

Like the OP, I see the issue with pretty much all software -- can even duplicate it in notepad. 
Title: Re: Sanwa JFL / I-Pac USB
Post by: rCadeGaming on September 17, 2013, 04:02:19 pm
Even MAME?  I would expect it to show up more in something like notepad or a front-end, but something like Super Street Fighter 2 Turbo ought to have pretty good signal debouncing built into its code, shouldn't it?

It's possible that the I-PAC is sensitive to contact bouncing.  On their webpage it says it uses a "state method for key debouncing" which sounds like watching consecutive states in software to check for consistency.  I need to do more research...

Here is a great source that I found:

http://www.eng.utah.edu/~cs5780/debouncing.pdf (http://www.eng.utah.edu/~cs5780/debouncing.pdf)
Title: Re: Sanwa JFL / I-Pac USB
Post by: ahofle on September 17, 2013, 04:13:52 pm
Yeah I emailed back and forth with Andy from Ultimarc and he said there is debouncing logic, but it's difficult to make it perfect.  My IPAC is really old (like 2002-2003 timeframe) so I was hoping newer ones would work much better, but it sounds like there are still issues.
I do see the same in game, although it's not as noticeable in most circumstances.  Entering initials as the OP stated is when you can really see it happen.
Title: Re: Sanwa JFL / I-Pac USB
Post by: fleskebacon on September 18, 2013, 10:29:34 am
Yep, entering initials and navigating the MAME and frontend menus are where you really see it. I've had no issues while actually playing a game, but that might be because of the nature of the games I play - they rarely depend upon short taps. It also replicated in Notepad, and the I-Pac software when I looked closer.

The stick is now still behaving properly after the electronic cleaner job. :)

When I did get double taps, it mostly happened when i held the joystick like 1/4 of a second and then let go. If I tapped it really fast or held it for a little while and then let go, it generally didn't happen. Could this be because there is a weakness in the debouncing software in the I-Pac? The switches are Omron, which is supposed to be a quality brand, so I'm having a hard time believing that they alone can cause all this?

Btw, really good article on bouncing, I wasn't aware that this was such a big topic. :)
Title: Re: Sanwa JFL / I-Pac USB
Post by: rCadeGaming on September 18, 2013, 11:04:10 am
In a lot of fighting games, holding something down or tapping something quickly can make a big difference, so it's very important that the game engine can tell the difference.

It is possible that the I-PAC's software debouncing could be better.  I'm guessing it doesn't have any hardware debouncing, as I can only see on capacitor on the board, and it's probably the decoupling capacitor on the 5v line.

BUT, the arcade PCB's that MAME is emulating read button presses directly, without any encoder in between.  They must have had some debouncing, at least the more advanced games.  The question is if it's in hardware or software, and if MAME would do anything to emulate it if it was in hardware.

It could also be possible that the I-PAC's polling rate just doesn't line well with the way some of the game's software debouncing works.  Have you guys tried overclocking your USB polling rates?

To really get to the bottom of this we'd have to set something up to definitively test the I-PAC's debouncing versus other encoders, and also test suspect games in MAME versus other software.
Title: Re: Sanwa JFL / I-Pac USB
Post by: ahofle on September 19, 2013, 11:59:09 pm
The stick is now still behaving properly after the electronic cleaner job. :)

Can you elaborate a little on how you cleaned them?  Did you open up the switches and spray them inside?
Title: Re: Sanwa JFL / I-Pac USB
Post by: AndyWarne on September 20, 2013, 06:32:40 pm
Yeah I emailed back and forth with Andy from Ultimarc and he said there is debouncing logic, but it's difficult to make it perfect.  My IPAC is really old (like 2002-2003 timeframe) so I was hoping newer ones would work much better, but it sounds like there are still issues.
I do see the same in game, although it's not as noticeable in most circumstances.  Entering initials as the OP stated is when you can really see it happen.
There is nothing wrong with the debounce logic on the I-PAC. If a switch is breaking the contact and making it again when it is being released there is something wrong with the switch. It would be easy to greatly increase the debounce delay but this is not the right way to address a problem with switches. But if anyone wants firmware with a longer delay I can supply it. Not for a 2002 board though unfortunately which don't have upgradeable firmware.
Title: Re: Sanwa JFL / I-Pac USB
Post by: rCadeGaming on September 21, 2013, 04:24:41 pm
Andy, thanks for stopping by.  I'm looking forward to switching to an I-Pac as it seems to be agreed upon as the best encoder for MAME in terms of input lag.

As I understand it, the frequency and duration of contact bounce varies widely among different types of switches, so creating one debounce routine that would work perfectly for all cases would be very difficult.  Being able tweak this when updating our firmware would be amazing.

Could you explain a little bit how the I-Pac's debounce logic works?
Title: Re: Sanwa JFL / I-Pac USB
Post by: AndyWarne on September 22, 2013, 04:56:03 am
Andy, thanks for stopping by.  I'm looking forward to switching to an I-Pac as it seems to be agreed upon as the best encoder for MAME in terms of input lag.

As I understand it, the frequency and duration of contact bounce varies widely among different types of switches, so creating one debounce routine that would work perfectly for all cases would be very difficult.  Being able tweak this when updating our firmware would be amazing.

Could you explain a little bit how the I-Pac's debounce logic works?

On switch closure, there is a trigger and then a second check around 0.5 milliseconds later, to eliminate false triggering from ESD etc, then the input is registered. (note this is a shorter delay than any keyboard). Then, no further transitions of the SAME switch are reported for another 40 milliseconds or so. Different switches are registered during this time.
On switch open there is another delay of around 1 ms to filter out transients then if still open it is confirmed as open on the interface. So you will see that there is a much shorter wait on open than closed, before another transition can be detected. This is because switches don't generally bounce on open to any extent. Adding a debounce delay on open would be possible but might cause correct state changes to be missed.
A very long time ago there were a batch of Cherry switches on the market which, if you looked at the output on an oscilloscope, the contact would make and break very rapidly when the button was held in the close position and simply vibrated, rather than being let go. There were clearly faulty switches and I suspect these switches are also faulty, they likely have tarnished contacts, or possibly the secondary contact at the pivot point of the lever inside is flaky.
Note there are a lot of Sanwa copies out there which may have sub-standard switches.
Title: Re: Sanwa JFL / I-Pac USB
Post by: fleskebacon on September 22, 2013, 11:24:34 am
The stick is now still behaving properly after the electronic cleaner job. :)

Can you elaborate a little on how you cleaned them?  Did you open up the switches and spray them inside?

I did it the easy way and didn't open them or anything. First, I sprayed WD-40 into them, just letting it flow into every opening in the switch casing. Then I clicked the switches several times to let it work its way through as much as possible of the interior of the switch. (Yeah yeah, I know WD-40 is an amateur trick and doesn't at all belong inside a microswitch, but I was running out of options, and WD-40 does clean out tarnish and other ugly stuff that also doesn't belong inside the switches.)

I let them sit overnight to get thoroughly soaked inside, and then I repeated the same procedure with CRC electronics cleaner a couple of times, to clean out all the WD-40 and then let them dry.

Worked like a charm for me at least, haven't had a problem with them since. And the sticks move a lot more smoothly now as well, so obviously something wasn't running right in there. This strongly supports Andy's opinion that the problem here is faulty switches and not bad debouncing routines in the I-Pac.
Title: Re: Sanwa JFL / I-Pac USB
Post by: rCadeGaming on September 23, 2013, 12:50:14 pm
Andy, thanks for the explanation.

There were clearly faulty switches and I suspect these switches are also faulty, they likely have tarnished contacts, or possibly the secondary contact at the pivot point of the lever inside is flaky.

It certainly sounds that way from the OP's testimony.  How about you aholfe, does contact cleaner do the trick?
Title: Re: Sanwa JFL / I-Pac USB
Post by: ahofle on September 24, 2013, 10:02:23 am
I haven't had a chance to clean them yet, but I can say that they are indeed older cherry switches so perhaps they are from the crap batch.  Although I've seen the problem on the switches in my original Happ Supers as well as with some replacement cherry switches I picked up a while back.  I'm thinking of replacing several of them as a test.  What is a 'good' arcade microswitch these days?
Title: Re: Sanwa JFL / I-Pac USB
Post by: PL1 on September 24, 2013, 10:25:34 am
For the Supers (+ Zippyys + trigger sticks . . .), I use Paradise Arcade's LS-32 upgrade kit switches.

They have a much softer and quieter throw than the original switches.

Only downside I've noticed is if you release the stick while pushing in one direction, it will register a momentary blip in the other direction when the stick passes thru center and hits the other switch.   :dunno


Scott
Title: Re: Sanwa JFL / I-Pac USB
Post by: rCadeGaming on September 25, 2013, 10:31:04 am
Then, no further transitions of the SAME switch are reported for another 40 milliseconds or so.

Andy, I've been lookingn closer into this, and.. is this a typo!?  Do you mean 40 microseconds here?

I wrote something up with an Arduino that reads a single button at high speed and reports state changes back over the serial monitor on the computer.  I've been using it to measure bouncing, as well as trying different debouncing methods and timings.  It runs at around 58kHz polling rate, so it's pretty accurate.  Anyhow, some of my findings agree with the article I linked to.  No quality microswitch bounces for more than a few milliseconds. 

Anyhow, ignoring state changes for 40 milliseconds means ignoring new states for two and a half frames of video at 60Hz.  There are plenty of games in MAME which will accept new states every single frame, and in fact it's needed for certain things, like achieving the maximum firing in rate in some shmups.  This is easy to do with a turbo function triggered by the vertical sync pulse, so long as the encoder will allow it.