Failed to open a handle to the device when opening GPIO pin
Asked Answered
B

1

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);
}
Barbarian answered 1/6, 2015 at 17:35 Comment(0)
D
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

Dainedainty answered 1/6, 2015 at 17:55 Comment(5)
Thanks I just saw my mistake. I mistook pin 11 for GpioPin11. I'm an idiotBarbarian
Is there some list of avalible pins? In my case only 4-6; 12-13; 16; 18; 22-27; are workingShabby
Edit: Added List of available GPIO-PinsDainedainty
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. ms-iot.github.io/content/en-US/win10/samples/Blinky.htmParfleche
I found an updated reference at: ms-iot.github.io/content/en-US/win10/samples/…Dainedainty

© 2022 - 2024 — McMap. All rights reserved.