Ever wanted to reset a SNES with the controller?

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
User avatar
poorstudenthobbyist
Posts: 230
Joined: Fri Jun 24, 2016 4:20 pm

Re: Ever wanted to reset a SNES with the controller?

Post by poorstudenthobbyist » Thu Dec 17, 2020 10:36 pm

Oh you probably meant the clock pulse into the shift registers. Duh. I'm tired lol, I'll check in the morning.
Check out my website for NES, SNES, and Genesis tutorials here. And visit my store for some custom tools and boards for making games here.

You can also follow me on Twitter for infrequent updates and bad jokes!

lidnariq
Posts: 10425
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Ever wanted to reset a SNES with the controller?

Post by lidnariq » Thu Dec 17, 2020 11:19 pm

Alignment of clock pulse on the controllers relative to latch pin.

User avatar
poorstudenthobbyist
Posts: 230
Joined: Fri Jun 24, 2016 4:20 pm

Re: Ever wanted to reset a SNES with the controller?

Post by poorstudenthobbyist » Fri Dec 18, 2020 6:57 am

Ch1 (yellow) - Data
Ch2 (blue) - Latch
Ch3 (purple) - Strobe

The zoomed out capture is of DKC running while pressing L+R+START+SELECT.
The closer capture is zoomed in while pressing Y button so I can capture the button press and the latch signal at the same time.
The closest capture with the latch signal removed is zoomed in really close to a button press (yellow) and the strobe (purple).

I'd attach the ones for Zelda, but they're literally the exact same haha

I'm thinking that maybe the clock rising edge and the data rising edge are too close together. Maybe? For the zoomed in pictures, I'm pressing the Y button, and the second rising clock edge should detect the Y button being pressed. It'd be better if the data changed in the middle of the clock pulse, but it still seems like it should capture it correctly, I think. So maybe that's something I can try fiddling with.

I don't know why DKC and Zelda respond differently, it's literally night and day. Zelda is always perfect, never glitches, and DKC will shift back and forth every so often (holding down the buttons and watching the LEDs confirm this). But the scope traces are identical, I can lay them on top of each other and they'll be perfectly lined up.
Attachments
DS1Z_QuickPrint23.png
DS1Z_QuickPrint20.png
DS1Z_QuickPrint19.png
Check out my website for NES, SNES, and Genesis tutorials here. And visit my store for some custom tools and boards for making games here.

You can also follow me on Twitter for infrequent updates and bad jokes!

lidnariq
Posts: 10425
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Ever wanted to reset a SNES with the controller?

Post by lidnariq » Fri Dec 18, 2020 11:09 am

Oh, yeah! The output changes on rising edges, and the latches latch on rising edges. That's definitely a bad combination.

Make your 74'595s latch on falling edges.

User avatar
poorstudenthobbyist
Posts: 230
Joined: Fri Jun 24, 2016 4:20 pm

Re: Ever wanted to reset a SNES with the controller?

Post by poorstudenthobbyist » Fri Dec 18, 2020 8:23 pm

NOPE
I inverted the strobe signal going into the shift registers and it still does the same thing. Even checked on a scope, the rising edge is smack in the middle of each button press, and it STILL shifts the output. Really strange....

I would love to blame the '595, but I mean, it's directly tied to the game! I have absolutely no idea what's going on.

I thought I could catch the problem by being clever - I held down the Y button, and triggered the scope off the (supposed) Y button output (which is usually actually tied to the Select button playing DKC). So when playing DKC, I could catch the glitch in process. I had to hold it down for anywhere between 5 seconds and a minute to get a capture, but I got it.

Then I put in Zelda and triggered off the Y button (immediately triggers when I press the button as expected). Then I compared the two.


......they're exactly the same.

*pulls out hair*

I even went back and triggered the scope again during DKC by pressing the Select button during the "normal" operation, and yeah, the data shows the pulse in the Select button position, but the Y position is being output! (this is QuickPrint26, the first test is 24; both channel 4's are the Y button outputs on the '595 to trigger from)
Attachments
DS1Z_QuickPrint24.png
DS1Z_QuickPrint26.png
Check out my website for NES, SNES, and Genesis tutorials here. And visit my store for some custom tools and boards for making games here.

You can also follow me on Twitter for infrequent updates and bad jokes!

lidnariq
Posts: 10425
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Ever wanted to reset a SNES with the controller?

Post by lidnariq » Fri Dec 18, 2020 8:29 pm

If you try with an "eyes" test signal like 0x5550, such as by pressing b+select+up+left+a+L, do you see any glitchy moments, i.e. a bit deletion?

User avatar
poorstudenthobbyist
Posts: 230
Joined: Fri Jun 24, 2016 4:20 pm

Re: Ever wanted to reset a SNES with the controller?

Post by poorstudenthobbyist » Fri Dec 18, 2020 8:37 pm

I redid the breadboard so it's not a monstrosity, and only have LEDs on start, select, L, R, and now Y. But if I hold them all down during DKC, when the output glitches itself to the correct positions, sometimes it'll stick there for a few seconds, sometimes it'll just flash for a split second (is that what you mean by an "eyes" test? lol). The B button data is probably getting deleted. It's like, skipping a clock pulse, either the first one or the last one I imagine, so it's not loading it in all the way.

I can probably do this easier with a microcontroller, but I'd rather do it all discrete.
Check out my website for NES, SNES, and Genesis tutorials here. And visit my store for some custom tools and boards for making games here.

You can also follow me on Twitter for infrequent updates and bad jokes!

lidnariq
Posts: 10425
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Ever wanted to reset a SNES with the controller?

Post by lidnariq » Fri Dec 18, 2020 8:39 pm

I ask about the "eyes" pattern just because if the clock signal is somehow dirty, maybe you'll see a momentary spike on the oscilloscope from the deleted bit. Just hoping, really.

User avatar
poorstudenthobbyist
Posts: 230
Joined: Fri Jun 24, 2016 4:20 pm

Re: Ever wanted to reset a SNES with the controller?

Post by poorstudenthobbyist » Fri Dec 18, 2020 9:09 pm

Oh, I get what you're saying now, alternating the bits.

Ok, even though it wasn't too noisy, I put an RC filter on the (inverted) clock signal. I noticed that when I switched two of my probes input channels, the clock signal got a bit noisier. I had the original channel set to 20 MHz bandwidth. My oscilloscope has a full 50 MHz bandwidth if I don't limit the channel manually, and like, I don't think something that high of frequency would trigger a clock pulse (especially exactly one extra clock pulse every time almost?) and I don't know why it would changed based on the ROM of all things (I use the same 27C322 for Zelda and DKC, the board is the same except obviously Hi/Lorom modes, but that's why I tested Sim City 2000 as a HiROM game too)

but

this filter fixed it. It's still ever so slightly glitchy on DKC, but now it's the opposite problem - the buttons normally work, and glitch one datapoint off for a split second every so often.

The RC filter has a cutoff frequency of about 250 kHz, which does round off the clock pulse a bit, so this could easily be tweaked to make the signal better. But it works just fine for what I need it to do.

What a weird few days, haha. Thanks for helping out. I think I might make this into a little board, and add a few things - extra logic gates to prevent against false triggers (like adding the conditions that the other buttons CAN'T be pressed), selectable button configs (want to reset by pressing up and down at the same time?), and a large RC in-line with the 555 trigger to charge up so you have to hold the correct buttons down for a certain amount of time before the reset occurs.

Good ol' analog circuits. They don't let me down.
Check out my website for NES, SNES, and Genesis tutorials here. And visit my store for some custom tools and boards for making games here.

You can also follow me on Twitter for infrequent updates and bad jokes!

Post Reply