9

Everytime I open a GPIO pin I get this exception:

WinRT information: Failed to open a handle to the device.
A resource required for this operation is disabled.

I can't seem to find much information for this on the internet. Probably because UAP is still in a preview. And I don't think something is wrong with my code, it is almost the same one from the Blink example:

GpioController gpio = GpioController.GetDefault();
if (gpio != null)
{
    var ledpin = gpio.OpenPin(11);
    ledpin.Write(_light ? GpioPinValue.High : GpioPinValue.Low);
    ledpin.SetDriveMode(GpioPinDriveMode.Output);
}
JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Arn Vanhoutte
  • 1,779
  • 4
  • 16
  • 28

1 Answers1

10

Only a subset of pins are available to usermode. Most pins are reserved by the system and cannot be accessed from usermode.

As far as I know pin 11 is not available. Try pin 12 or 13.

List of available Pins:

GPIO#   Power-on Pull   Header Pin
4       PullUp           7
5       PullUp          29
6       PullUp          31
12      PullDown        32
13      PullDown        33
16      PullDown        36
17      PullDown        11
18      PullDown        12
19      PullDown        35
20      PullDown        38
21      PullDown        40
22      PullDown        15
23      PullDown        16
24      PullDown        18
25      PullDown        22
26      PullDown        37
27      PullDown        13
35      PullUp          Red Power LED
47      PullUp          Green Activity LED

Pi2 layout

Edit: Added missing GPIOs

S.Spieker
  • 7,005
  • 8
  • 44
  • 50
  • 1
    Thanks I just saw my mistake. I mistook pin 11 for GpioPin11. I'm an idiot – Arn Vanhoutte Jun 01 '15 at 18:05
  • Is there some list of avalible pins? In my case only 4-6; 12-13; 16; 18; 22-27; are working – Quest Jul 25 '15 at 06:38
  • Edit: Added List of available GPIO-Pins – S.Spieker Jul 27 '15 at 08:43
  • Where is this documentation available? on the blinky sample (url at end of comment) there is a diagram that lists several GPIO pins, but if you try to use GPIO 19 that appears to be available, the error from this question comes up. http://ms-iot.github.io/content/en-US/win10/samples/Blinky.htm – Felipe Oct 27 '15 at 01:33
  • I found an updated reference at: http://ms-iot.github.io/content/en-US/win10/samples/PinMappingsRPi2.htm – S.Spieker Oct 27 '15 at 07:47