GPIO confusion

RetroPie has a new website and forum. Please visit https://retropie.org.uk/ for the new site. The new forum is located at https://retropie.org.uk/forum/. This forum is left here as a read-only archive.

Tagged: , ,

This topic contains 15 replies, has 2 voices, and was last updated by  bdecagny 2 years, 10 months ago.

Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #2489
    Profile photo of billipo
    billipo
    Participant

    I am ready to wire up a SNES female plug to the GPIO pins on my RPi. I am a little confused about the pins, though. You mention here using:

    GND to P6
    VCC to P2
    DATA 2 to P15
    LATCH to P16
    CLOCK to P18
    DATA 1 to P22

    But the GPIO uses these:

    VCC (3.3V): pin 1
    Ground: pin 6
    Clock: pin 19 (out)
    Button: pin 11 (in)
    Latch: pin 23 (out)
    Data 1: pin 7 (in)
    Data 2: pin 5 (in)

    My question is… if I hard-wire the SNES plug to pins 1, 8, 15, 16, and 18 should the RPi instantly recognize the SNES controller plugged into it on boot? (I installed from the binary image and haven’t updated any software)

    Also, why the change in pins for the GPIO?

    Thanks!

    #2490
    Profile photo of billipo
    billipo
    Participant

    Sorry, I know it should be pin 6 for ground, not 8.

    #2491
    Profile photo of billipo
    billipo
    Participant

    Hahaha. I just realized that the numbers from LOST made me type 1, 8, 15, 16. Pop culture gets ingrained!

    #2495
    Profile photo of petrockblog
    petrockblog
    Keymaster

    I modified the pins for the RetroPie GPIO Adapter to match them with the gamecon driver (http://blog.petrockblock.com/2012/08/26/gamecon-driver-module-for-nes-snes-and-n64-controllers-added-to-retropie-setup-script/). After that I also adapted SNESDev (https://github.com/petrockblog/SNESDev-RPi), which is a user-space driver for the RetroPie GPIO Adapter. So, if you want to be on the safe side, I would recommend to use the pin out of the RetroPie GPIO Adapter, which is described at http://blog.petrockblock.com/2012/10/21/the-retropie-gpio-adapter/ and http://blog.petrockblock.com/2013/07/09/getting-started-with-the-retropie-gpio-adapter/.

    #2497
    Profile photo of billipo
    billipo
    Participant

    Thanks for the answer. I will connect the wires according to the GPIO adapter pinout. One more question…

    To use the Gamecon driver, do I need to download any extra software, or does the 1.6.1 image include that driver? If it does not include it, does 1.6.1 include the SNESDev driver? Essentially, is the SNES plug ready to go once wired?

    I know the easy thing would be to just wire it up and try it, but this has been one of the busiest weeks of my life. And all I can think about is getting the RetroPie project finished! Ha, thanks for the great work on the RetroPie.

    #2498
    Profile photo of billipo
    billipo
    Participant

    Never mind. I looked at the revision history and saw that you added GPIO drivers in version 1.5. However, I saw a response in the comments on the same page that you have to manually enable SNESDev. I guess this goes back to me trying out the SNES plug after I wire it up and seeing if it works!

    I also see that you have uploaded version 1.7! I am excited to try out ESconfig. I hope it is what I was envisioning as a way to add a controller inside Emulation Station.

    #2499
    Profile photo of petrockblog
    petrockblog
    Keymaster

    Yes, I need to enable SNESDev manually (e.g., with the RetroPie Setup Script).

    I would be glad to get feedback about ES-Config to further enhance it.

    Good luck with your project!

    #2525
    Profile photo of billipo
    billipo
    Participant

    Alright, I got my SNES port wired up over the weekend, and it works wonderfully! I just had to go into RetroPie Setup and enable SNESdev to start on boot. I have another question, though.

    I have not added a momentary switch yet, but I hope to in the future. I understand that the switch is able to do software functions like dumping a ROM or shutting down the unit. My question is… can the switch also turn the RPi back on? After I shut down, I always have to take the power cord out and plug it back in when I want to play again. Does the GPIO allow a power switch to turn the unit on?

    Thanks!

    #2526
    Profile photo of billipo
    billipo
    Participant

    About ES config, I love it. I was able to set up the SNES controller as P1 and a USB controller as P2. No problems! One thing that I did find confusing, though, is that you have to press a button on P2 controller after you set up the buttons for P1 to set A,B,X,Y for P2. There needs to be some kind of text prompting you to do this.

    #2538
    Profile photo of billipo
    billipo
    Participant

    @petrockblog, is it possible to assign different GPIO pins to be the clock and latch for P2 under SNESdev? It seems like it would be easier to jumper to separate pins, rather than share a pin with the P1 controller.

    Thanks!

    #2541
    Profile photo of petrockblog
    petrockblog
    Keymaster

    @petrockblog, is it possible to assign different GPIO pins to be the clock and latch for P2 under SNESdev? It seems like it would be easier to jumper to separate pins, rather than share a pin with the P1 controller.

    Thanks!

    Currently, there is no configuration file to assign the pins to be used (still on the to-do list). However, you could change the according lines in the sources of SNESDev in the lines at https://github.com/petrockblog/SNESDev-RPi/blob/master/src/SNESDev.c#L140. You would just have to re-compile SNESDev afterwards.

    Hope that helps!?

    #2544
    Profile photo of billipo
    billipo
    Participant

    @petrockblog,

    I found this section of SNES-Dev…

    if (get_rpi_revision()==1)
    {
    gpads[0].port = 1;
    gpads[0].pin_clock = RPI_GPIO_P1_19;
    gpads[0].pin_strobe = RPI_GPIO_P1_23;
    gpads[0].pin_data = RPI_GPIO_P1_05;
    gpads[0].type = GPAD_TYPE_SNES;
    gpads[1].port = 1;
    gpads[1].pin_clock = RPI_GPIO_P1_19;
    gpads[1].pin_strobe = RPI_GPIO_P1_23;
    gpads[1].pin_data = RPI_GPIO_P1_07;
    gpads[1].type = GPAD_TYPE_SNES;
    } else {
    gpads[0].port = 1;
    gpads[0].pin_clock = RPI_V2_GPIO_P1_19;
    gpads[0].pin_strobe = RPI_V2_GPIO_P1_23;
    gpads[0].pin_data = RPI_V2_GPIO_P1_05;
    gpads[0].type = GPAD_TYPE_SNES;
    gpads[1].port = 1;
    gpads[1].pin_clock = RPI_V2_GPIO_P1_19;
    gpads[1].pin_strobe = RPI_V2_GPIO_P1_23;
    gpads[1].pin_data = RPI_V2_GPIO_P1_07;
    gpads[1].type = GPAD_TYPE_SNES;
    }

    Is this the only place that I would need to make changes for clock and latch for player 2? Thanks!

    #2546
    Profile photo of petrockblog
    petrockblog
    Keymaster

    Yes – that is the only place!

    #9325

    benoit

    Hi

    I have a question.
    I don’t understand in the code it is written that the pins 19, 23 and 05 (depends of config) are used.
    But in the SNESDev cable it is said that clock for instance is on pin 24.
    I don’t understand, is the code up to date ?
    Actually I am trying to make a PITFT and a single NES controller directly connected to the GPIO work together. But seems that some GPIO (24 as far as I know) is used by both

    Can you help me on that ?
    Thnak you
    Benoit

    #9389
    Profile photo of petrockblog
    petrockblog
    Keymaster

    You can find the most recent version of SNESDev at Github – the lines with the pin usage start here. Pin 24 is currently not used.

    I hope that helps!?

    #9428

    bdecagny

    Thank you for your answer
    I got the last version on github

    Could tell me which pin are used by SNEDEV. Maybe I am not plugging my controller on the right place.
    For now looks like I have a comflict between my PITFT and the controller

    thanks again for your help

Viewing 16 posts - 1 through 16 (of 16 total)

Forums are currently read only - please visit the new RetroPie forums at https://retropie.org.uk/forums/

Skip to toolbar