locked
GPIO Pin mapping RRS feed

  • Question

  • Hi, I'm switching from Linux to Win IOT to give it a try. And I have a huge surprise on pin numbering and availability. I did try to open each PIN to ensure my mapping was correct... gpioResult contains the test result which I convert then to array for more readability.

                string gpioTest = "";
                for(int i = 0; i < 55; i++)
                {
                    try
                    {
                        pin = gpio.OpenPin(i);
                        pin.Write(GpioPinValue.High);
                        pin.SetDriveMode(GpioPinDriveMode.Output);
                        gpioTest += "Ok with pin " + i + "@";
    
                    }catch(Exception ex)
                    {
                        gpioTest += "Failed with " + i + " " + ex.Message + "@";
                    }
                }

    The result doesn't map any GPIO picture I found on Raspberry pi 2 or wiring PI :

    0 Failed
    1 Failed
    2 Failed
    3 Failed
    4 Ok
    5 Ok
    6 Ok
    7 Failed
    8 Failed
    9 Failed
    10 Failed
    11 Failed
    12 Ok
    13 Ok
    14 Failed
    15 Failed
    16 Ok
    17 Failed
    18 Ok
    19 Failed
    20 Failed
    21 Failed
    22 Ok
    23 Ok
    24 Ok
    25 Ok
    26 Ok
    27 Ok
    28 Failed
    29 Failed
    30 Failed
    31 Failed
    32 Failed
    33 Failed
    34 Failed
    35 Ok
    36 Failed
    37 Failed
    38 Failed
    39 Failed
    40 Failed
    41 Failed
    42 Failed
    43 Failed
    44 Failed
    45 Failed
    46 Failed
    47 Ok
    48 Failed
    49 Failed
    50 Failed
    51 Failed
    52 Failed
    53 Failed
    54 Failed

    Any idea ? My RPI was working fine on Linux one week ago (I've to recognize I didn't test all GPIO before to switch, but the result can't come from a bug, I'm missing something)


    Sunday, October 25, 2015 6:35 PM

Answers

All replies

  • From the FAQ at https://www.raspberrypi.org/forums/viewtopic.php?f=105&t=123945

    42. Which GPIO pins can I use

    Running a slightly modified version of

    https://github.com/ms-iot/samples/tree/master/GpioTestTool to output to a file


    On Insider Preview 10556 it reports

    The default GPIO controller has 54 pins:
    Pin 4 is available
    Pin 5 is available
    Pin 6 is available
    Pin 12 is available
    Pin 13 is available
    Pin 16 is available
    Pin 17 is available
    Pin 18 is available
    Pin 19 is available
    Pin 20 is available
    Pin 21 is available
    Pin 22 is available
    Pin 23 is available
    Pin 24 is available
    Pin 25 is available
    Pin 26 is available
    Pin 27 is available
    Pin 35 is available
    Pin 47 is available

    which appears to support your conclusions. But what other pins would you want. All of the pins on the header are now in use, only the HAT pins reserved (from 10556 Serial Rx/Tx are supported as well)..


    6. Find out which pins on the header are available for use and for what purposes

    https://ms-iot.github.io/content/en-US/win10/samples/PinMappingsRPi2.htm


    riclh





    • Proposed as answer by riclh Monday, October 26, 2015 12:18 AM
    • Marked as answer by AnonymousPineapple Monday, October 26, 2015 5:24 AM
    • Unmarked as answer by AnonymousPineapple Monday, October 26, 2015 9:46 AM
    • Edited by riclh Monday, October 26, 2015 10:00 AM
    Monday, October 26, 2015 12:14 AM
  • Hi, thanks for your answer and for the link, seems ideas wasn't that clear for me yesterday night. I spent time testing before to post, but I better should have sleep first ;). The 'pin' word makes me take a wrong way.

    Monday, October 26, 2015 5:33 AM
  • Oops, maybe I've gone too fast.

    How do you play with GPIO 17 on pin 11 ?

    pin = gpio.OpenPin(11); // Exception
    pin = gpio.OpenPin(17); // Exception

    Both are failure (shown in red in my first post array)

    This GPIO works fine under Linux (used for watering)

    Monday, October 26, 2015 8:54 AM
  • I would suggest that you build and run the text example that I linked to above and see if it gets the same results. Also, check you are on 10556 as not all the pins are supported on OS before that.

    https://ms-iot.github.io/content/en-US/Downloads.htm


    riclh



    • Edited by riclh Monday, October 26, 2015 10:07 AM
    • Proposed as answer by riclh Monday, October 26, 2015 10:07 AM
    Monday, October 26, 2015 10:01 AM
  • Done, same result with C++ project (a lot faster to browse 54 pins).

    Following couples (GPIO,pin) don't work under IOT :

    (17, 11) ; (19,35) ; (20,38) ; (21,40)

    My IOT / Raspberry pi version :

    Device Name: Raspberry1
    Device Model: Raspberry Pi 2 Model B
    OS Version: 10.0.10240 (the latest version available to download)


    Monday, October 26, 2015 9:42 PM
  • The latest fully released version is 10240. That has a more limited set of pins available.

    If you want all the pins then you will need to go to 10556 (i.e. the Insiders branch).

    https://ms-iot.github.io/content/en-US/Downloads.htm


    riclh


    • Edited by riclh Monday, October 26, 2015 10:38 PM
    • Proposed as answer by riclh Monday, October 26, 2015 11:24 PM
    • Marked as answer by AnonymousPineapple Tuesday, October 27, 2015 8:56 PM
    Monday, October 26, 2015 10:09 PM
  • Thanks a lot ! All GPIO are active now as shown by Microsoft in its pictures.

    The insider version (01/10/2015) was the key.

    Time to play :)

    Tuesday, October 27, 2015 8:57 PM