Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NES controller connection issue #74

Closed
nikitalita opened this issue May 21, 2024 · 4 comments · Fixed by #75
Closed

NES controller connection issue #74

nikitalita opened this issue May 21, 2024 · 4 comments · Fixed by #75

Comments

@nikitalita
Copy link
Contributor

I see you recently added support for them; which pins do they connect to? I'm going to make my own connector with a breadboard and a voltage logic level converter.

@nikitalita
Copy link
Contributor Author

Reading your documentation, I hooked them up to the listed pins, but it doesn't work. I disconnected it and looked at it with a logic analyzer and it seems that those lines are just being pulled high; it should be outputting a latch and clock signal every so often, no?

@nikitalita nikitalita changed the title What pins do the NES controllers connect to on the Nano? NES controller connection issue May 22, 2024
@therealquaid
Copy link

Are you using the current release?
nand2mario added a few commits since then to get the controller working.
If you compile from source yourself the proper pin out instructions are currently only in the snestang repository:
https://github.com/nand2mario/snestang/blob/main/doc/installation.md

@nikitalita
Copy link
Contributor Author

OK, so installing the new core works, and it turns out that hooking up the NES controller directly works; apparently, most of the shift registers in these things could work from anywhere between 3v and 10v.

However, now I have another problem; I am getting constant A and B presses no matter what I do.

Here's why:

image

Instead of 8 clock pulses, you're sending 16. Once the 8-bits in the data word have been exhausted, data goes low. Data high means released, low means pressed.

So, it's counting the rest of the buttons as pressed, meaning that Autofire A and Autofire B are constantly set to pressed.

However, there's a solution:

ScreenHunter_131 Feb  22 21 58

This is an SNES controller schematic. If you'll notice, that last 4 bits are just pulled high, so bits 15:12 on data will always be 1.

Ergo, if we check to see if those bits were pulled high, we'll know if this is an SNES controller. If it isn't, then we consider it an NES controller and discard the extra button states.

@nand2mario
Copy link
Owner

The fix looks good and is just merged. Thanks @nikitalita.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants