Can the GPIO library work on Windows IoT Enterprise?

melon NG 291 Reputation points
2022-04-13T02:58:20.857+00:00

I am about to develop an IoT application based on Windows IoT Enterprise 10 by .NET 6(WPF).

However, the provider of the mainboard said that though Windows IoT Enterprise can run on the board, the GPIO library (System.Device.Gpio) cannot be used by WPF and Windows.

Is that right? I have not bought the board that I cannot test it.

Could you please tell me about this? Thank you.

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,573 questions
Windows for IoT
Windows for IoT
A family of Microsoft operating systems designed for use in Internet of Things (IoT) devices.
381 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,667 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sean Liming 4,506 Reputation points
    2022-04-13T15:59:57.963+00:00

    I have creating .NET applications to access GPIO, SPI, I2C, UART for the UP Boards for Windows 10 IoT Enterprise. There are a couple of items needed:

    First, RHPROXY has to be supported in the UEFI firmware. I wrote an article about access these IO and the need for RHPOXY support: Industrial PC Requirements to Access GPIO/I2C/SPI/UART from Windows 10 UWP. Even though the paper calls out IoT Core, it is the same supported needed for IoT Enterprise. You will have to work with your hardware vendor to make sure RHPROXY is included.

    Second, for .NET Core 3.1 and .NET 6, you will need to add the Microsoft.Windows.SDK.Contracts NuGet Package in order to gain access to the Windows.Devices.Gpio namespace. yes, the namespace is for UWP, but the NuGet packages opens the namespace for .NET WPF apps.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Sander van de Velde 28,236 Reputation points MVP
    2022-04-13T11:21:10.097+00:00

    Hello @melon NG ,

    in the past, I did some research on accessing GPIO in docker containers.

    There, I made use of this GitHub repo from Microsoft regarding GPIO in .Net. A lot of hardware components, sensors and busses are supported already!

    There, it says:

    Both libraries in this repository are cross-targeting .NET Standard 2.0, .NET Core 3.1, and .NET 6.0

    So, you probably could get it working in Windows too.

    In Linux, I needed elevated rights to access GPIO. Please check out if you have tu run your application 'as administrator'.

    Please, ask your provider to do a little experiment based on these examples.