SNES Controller Interface - Part 1 - Reading the inputs

  Переглядів 5,720

James Sharman

James Sharman

День тому

I want more buttons than the NES controller is going to give me, so I’m start a new mini-series to interface a SNES controller to my homebrew cpu. In this video I build the basics of a circuit to read the button status in. I’m expecting this to be a 3 part video series which will probably set a new record for me going from breadboard circuit to finished pcb.
0:00 Introduction
0:48 Starting the circuit
4:25 Get the scope out!
10:07 It’s Alive!
11:01 Outro
Links:
Snes Controller to Dupont Adapter • Snes Controller to Dup...
DIY NES Controller - Full Build • DIY NES Controller - F...
Interfacing With a NES Gamepad • Interfacing With a NES...

КОМЕНТАРІ: 79
@Zer0ji
@Zer0ji Рік тому
It's always nice to see a "part 1", makes for a simple video where I can understand the entire circuit without too much hassle :p Eager to see the CPU integration!
@weirdboyjim
@weirdboyjim Рік тому
Glad you enjoyed it! It's really difficult to gauged how much to put in a single video, I think I often over shoot.
@eduardoanonimo3031
@eduardoanonimo3031 Рік тому
Dude, im still waiting that you made all your computer in a single PCB, but this lift my interest even more...
@weirdboyjim
@weirdboyjim Рік тому
Glad you like it Eduardo! More pcb's for the main build are on their way!
@monkeytalk4912
@monkeytalk4912 Рік тому
This is awesome!! I have been wanting to make a snes controller tester for a while now and its it just what i needed!! Thank you!!
@weirdboyjim
@weirdboyjim Рік тому
Glad you like it!
@StefanRink
@StefanRink Рік тому
Thanks James for making these, it's fun to watch and you are doing a great job! Keep up the good work!
@weirdboyjim
@weirdboyjim Рік тому
Thanks Stefan!
@andymouse
@andymouse Рік тому
Nice one James !...cheers.
@weirdboyjim
@weirdboyjim Рік тому
Thanks Andymouse!
@jerril42
@jerril42 Рік тому
Nice. Little by little, it's getting closer to having a game on it. Thanks James, take care.
@weirdboyjim
@weirdboyjim Рік тому
Well it already had Snek! I'll have to fix that up to work with the controller when it's interfaced!
@GORF_EMPIRE
@GORF_EMPIRE Рік тому
I love it when a plan comes together! Nice work! Looking forward to part two!
@weirdboyjim
@weirdboyjim Рік тому
Glad you like it! I'm looking forwards to having some input that's more suitable for gaming!
@GORF_EMPIRE
@GORF_EMPIRE Рік тому
@@weirdboyjim Perhaps I missed it but can this scheme handle more than one button press simultaneously?
@weirdboyjim
@weirdboyjim Рік тому
@@GORF_EMPIRE yes it can, all buttons are transferred independently.
@GORF_EMPIRE
@GORF_EMPIRE Рік тому
@@weirdboyjim Excellent!
@bradywb98
@bradywb98 Рік тому
Sweet, looking forward for whatever games you have planned to make use of these extra buttons 👀
@weirdboyjim
@weirdboyjim Рік тому
One specific thing really wants the shoulder buttons, you are going to like it!
@twobob
@twobob Рік тому
I freaking LOVE the way you do the schematic at the same time. Heart emoji. Also, nice analysis.
@weirdboyjim
@weirdboyjim Рік тому
Thanks! Getting it all synced up is a real pain, but it's good to do the schematic soon after building the breadboard as I'm less likely to mis-remember bits.
@wChris_
@wChris_ Рік тому
The controller port has actually 1 more data line and an IO line that you can send and recive data from, the SNES used it with multitaps, to connect the second pair of controllers and the super scope used it to latch the HVCounters in the PPU, thou only the IO line of port 2 is connected to the PPU latch. Both of the lines are unused in the normal controllers and not connected in most if not all snes extension cords, which makes them unusable for most other snes accessories.
@weirdboyjim
@weirdboyjim Рік тому
Yeah, I know about the extra lines but as you say they were not relevant to this circuit.
@TheEmbeddedHobbyist
@TheEmbeddedHobbyist Рік тому
Nicely done, I like to see old school logic reminds me of 8080 board design when you could not get microcontrollers. much more fun and you got to learn a lot. moving your logic from discreet chips to PAL's to save board space etc. Happy days😊
@weirdboyjim
@weirdboyjim Рік тому
Thanks Teh! It was fun to make a breadboard from scratch for once!
@McTroyd
@McTroyd Рік тому
The SNES controller is far and away the best, most long-lasting one... though being my first console, I may be a bit biased. 🤣 I remember long ago that there was a four-player expansion which was supported by some games. Seeing the upper four bits aren't in use with the standard controller, I now suspect I know how they did that. 👍
@weirdboyjim
@weirdboyjim Рік тому
Nintendo always made very durable stuff!
@AJB2K3
@AJB2K3 Рік тому
Cool!
@weirdboyjim
@weirdboyjim Рік тому
Thanks!
@parkerlewis4991
@parkerlewis4991 Рік тому
👍 Thank you
@weirdboyjim
@weirdboyjim Рік тому
No problem 👍
@DamienTHIERY
@DamienTHIERY Рік тому
Merci ! Thank you for your awesome videos sir.
@weirdboyjim
@weirdboyjim Рік тому
Oh wow, Thanks! You are very welcome!
@azayles
@azayles Рік тому
Nice job, James! 🥰 You could potentially use a PS2 controller too, as you get tons of inputs as well as lots of anolgue, and it's a well documented serial data stream you can also read out with shift registers. Also they're still really cheaply available
@weirdboyjim
@weirdboyjim Рік тому
Lots of choice to be honest. My first thought was to use a Kempston/Atari style joystick which would have been even easier to interface but something about the S/NES interface was appealing.
@azayles
@azayles Рік тому
@@weirdboyjim The SNES controller is so ubiquitous, I think it's the style people think of when they think "game controller". It's iconic 😍
@i_Hally
@i_Hally Рік тому
Enjoyed this ☺️ how do you store all of your breadboards!?
@weirdboyjim
@weirdboyjim Рік тому
Between videos? This one is currently sat on a shelf along side other in progress works.
@lockymcgee6525
@lockymcgee6525 Рік тому
Very cool James. Just wondering what the capacitor on the oscillator is about? What does it do?
@weirdboyjim
@weirdboyjim Рік тому
Interesting question. It was on the sample circuit in the datasheet and has a very low value (10pf if my memory serves me correctly).
@schrodingerscat1863
@schrodingerscat1863 Рік тому
I was wondering when the game controllers would get connected. Seems a lot easier than I thought it would be. I suppose you now need to front this with a tristate latch and some address line decode logic to turn it into a memory mapped register.
@weirdboyjim
@weirdboyjim Рік тому
Well I have a spare 8-bit IO port I can use, so I'll work out a way of doing it with that.
@catgirlQueer
@catgirlQueer Рік тому
the SNES controller actually transfers 16 bits, 4 extra to indicate the controller type, tho on the standard joypad these are all 0s
@weirdboyjim
@weirdboyjim Рік тому
Interesting. I wonder if that was designed from the start or if they later added new peripherals and co-opted the spare bits for that purpose.
@catgirlQueer
@catgirlQueer Рік тому
@@weirdboyjim the "spare" bits are always used for controller identification, other peripherals either use the second data channel, or use more bits (as the bits can be software shifted in, along with autojoypadread reading in the first 16) the mouse uses id 0001, the superscope uses 1111 (returns all 1s after its initial byte) and the justifiers (twin gun peripheral? unsure) uses 1110
@OscarSommerbo
@OscarSommerbo Рік тому
Damn UKposts, loves to censor links. I was wondering about using clock divider ICs, like the 74LS292 instead of counters, they are pretty very similar except clock dividers can shift the clock down way more than a single counter chip can. I get using stuff you have on hand for building a prototype or proof of concept, but some places maybe a clock divider is the better IC to use, like the audio circuit, the clock needs a lot of counter chips just to get in the hearable range. Anyways it is your build and your show, but I found the clock divider chips interesting and potentially useful.
@weirdboyjim
@weirdboyjim Рік тому
The 292 is an interesting device but they are tough to get hold of in anything other than LS-Dip but conceptually it is indeed a good chip for doing this with.
@OscarSommerbo
@OscarSommerbo Рік тому
@@weirdboyjim I didn't know about the supply issue. And the 193s gets the job done.
@keanuciupka2074
@keanuciupka2074 Рік тому
What a coincidence I just bought cheap replacement controllers for my snes :D maybe I'll try connecting them to my 8051µC :P
@weirdboyjim
@weirdboyjim Рік тому
A worthy project! Good luck!
@frazer26
@frazer26 Рік тому
Not sure if your familiar with the8bit guys channel, think he had some involvement in the x16 pc you benchmarked against a few videos back but he’s developed a game call attack of the petscii robots where he ports it to a bunch of systems. Be good to see if your system could run that?
@weirdboyjim
@weirdboyjim Рік тому
The Command X16 is indeed his project. Once my vga circuit is finished Petscii robots would be well within it's capabilities, not sure if he would release the code though.
@owenvogelgesang7314
@owenvogelgesang7314 Рік тому
@@weirdboyjim I think if you contact him and show that you clearly know what you're doing, he'd be happy to share it with you. I think that's how all of the ports of it happened, he mentioned it in one of his videos
@Quxxy
@Quxxy Рік тому
Dang... I'm going to need to dig my emulator out of mothballs... and figure out how to hook up a game pad to it.
@weirdboyjim
@weirdboyjim Рік тому
I may cover adding support to my simulator in part 2.
@monkeytalk4912
@monkeytalk4912 Рік тому
What are the values for the ceramic capacitors youre using?
@weirdboyjim
@weirdboyjim Рік тому
Those are just trying to add a bit of power decoupling to the breadboards, they are 100nf but when I convert the circuit to a pcb I'll use whatever decoupling caps are recommended by the chips datasheets (100nf is a very common value for this, most of my pcb's use that).
@monkeytalk4912
@monkeytalk4912 Рік тому
@@weirdboyjim thanks for your help! I will try to find what is specified by try chips datasheets and/or experiment with 100nf’s. 🙏👍👍
@davidrosset4457
@davidrosset4457 Місяць тому
I got the LED's to output all distinct controls... Only problem is LED are always on, do you know what could be the issue?
@weirdboyjim
@weirdboyjim Місяць тому
What led’s are always on?
@davidrosset4457
@davidrosset4457 Місяць тому
All LED’s connected to the outputs of the 74xx595
@weirdboyjim
@weirdboyjim Місяць тому
@@davidrosset4457It's not clear what you mean, you said "I got the LED's to output all distinct controls" but then you said "they are always on". Do you mean the operation of the LED's is inverted? They are on and then go out when the relevant button is pushed?
@davidrosset4457
@davidrosset4457 Місяць тому
@@weirdboyjim No, actually they are always on but not fully… like half-way lit. Then when I push the buttons it lights up more so I can distinguish it
@davidrosset4457
@davidrosset4457 Місяць тому
@@weirdboyjim My data line is looking like a clock… it should be high though and active low on button pressed… the dupont cable seems correct, do you think it’s a faulty controller?
@CezarySiw
@CezarySiw Рік тому
What's the advantage of converting serial data to parallel? Why don't you feed the serial data straight to the CPU?
@Oguz286
@Oguz286 Рік тому
Technically you could, but the processor processes bits in parallel. So if you have an 8-bit CPU, then a load instruction will load 8 bits in parallel. You could give 1 bit at a time, but then you would have to have 8 load instructions and a few more instructions to shift the incoming bit to the bit position you want.
@weirdboyjim
@weirdboyjim Рік тому
A cpu like this is a parallels device, you have no doubt seen people read from controllers like these by bit-banging the protocol with a user port. For my system it would be necessary to build a user port / gpio type system, and then software implement the protocol to read the data using that circuit. It's more interesting to do it "properly" to me, and it means I'll have much simpler code to get the data out.
@luz_reyes_676
@luz_reyes_676 Рік тому
@@weirdboyjim For some basic dev boards, I could see how doing it with zero external circuitry would be appealing. i mean. any stm32 uc can easily handle the polling really quickly, for example
@weirdboyjim
@weirdboyjim Рік тому
​@@luz_reyes_676 I think you have misunderstood the point. This circuit for is for inclusion in my custom build that has no general purpose IO, I would have to deliberately make GPIO circuitry in order to read it in with software slower than this circuit will do it.
@robot797
@robot797 Рік тому
isnt it possible to now use both controllers?
@weirdboyjim
@weirdboyjim Рік тому
Ok, I can interpret that question a couple of different ways. This circuit will read a NES controller as well just without the extra buttons. Or do you mean 2 controllers? You would need extra circuitry for that, but you would only need duplicate the shift registers to support 2 controllers, I'm not sure I have space for that in the final build though.
@robot797
@robot797 Рік тому
@@weirdboyjim sorry if I was unclear (dont comment untill you had coffee) but I ment the firsth option the circuits realy looked alike and that is why I wondered but in both casses it would only be a plus
@nolan412
@nolan412 Рік тому
One for a humorous "nope. Not doing that" video: a USB controller.
@nolan412
@nolan412 Рік тому
Though TinyUSB popped back up on my late night web surfing. No need for the for pay spec and full stack. Didn't dig deep enough to see if it bit banged.
@nolan412
@nolan412 Рік тому
Even the controller was 16 bit.
@weirdboyjim
@weirdboyjim Рік тому
The circuit for that would actually be very close to the UART, but I'd loose everyone's interest with all the programming videos it would take to get it working.
@nolan412
@nolan412 Рік тому
@@weirdboyjim Poked around after commenting that. Came across V-USB that claims 2kb for slow USB, no interrupts, two pins, but is GPL and would need a C compiler. All from scratch: that's a mountain to climb even with specs. Almost need Linux for full device coverage too.
SNES Controller Interface - Part 2 - Connecting to the homebrew CPU
22:43
I Built a Portable Super Nintendo - Pt1
16:01
Restore Technique
Переглядів 382 тис.
Історія загиблого Назара Небожинського
00:54
Суспільне Рівне
Переглядів 705 тис.
NES Controllers Explained
16:52
NesHacker
Переглядів 81 тис.
DIY 8-Bit Z80 Single Board Computer
13:27
Ivan Farafontov
Переглядів 62 тис.
NES Development Environment
14:58
NesHacker
Переглядів 341 тис.
SNES Controller Interface - Part 3 - Final PCB Module
45:00
James Sharman
Переглядів 5 тис.
5 AXIS ANALOG JOYSTICK GAME CONTROLLER
3:01
amstudio
Переглядів 149 тис.
Emulating a CPU in C++ (6502)
52:28
Dave Poo
Переглядів 944 тис.
From Transistors To Tetris Part 1 : Computer Architecture
20:17
Lev Kruglyak
Переглядів 265 тис.
APPLE УБИЛА ЕГО - iMac 27 5K
19:34
ЗЕ МАККЕРС
Переглядів 18 тис.
НЕ ПОКУПАЙТЕ НОВЫЙ СМАРТФОН, ПОКА НЕ ВЫШЕЛ ЭТОТ [2024]
13:25
Thebox - о технике и гаджетах
Переглядів 82 тис.
САМЫЙ дешевый ПК с OZON на RTX 4070
16:16
Мой Компьютер
Переглядів 97 тис.
Какой телефон лучше всего снимает? 🤯
0:42
iPhone - телефон для нищебродов?!
0:53
ÉЖИ АКСЁНОВ
Переглядів 3,8 млн