question

melonNG-6986 avatar image
0 Votes"
melonNG-6986 asked Sean-Liming commented

Can the GPIO library work on Windows IoT Enterprise?

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-generalwindows-wpfwindows-iot-10core
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Sean-Liming avatar image
1 Vote"
Sean-Liming answered Sean-Liming commented

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.


· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you. I found the System.Device.Gpio . I don't know what the difference is between Windows.Devices.Gpio. I am about to use the System.Device.Gpio in the future.

0 Votes 0 ·

I haven't tried System.Device.Gpio in .NET 6 yet. I have been waiting to see the full app story before moving an application to a different name space. If you have VS 2022, you might be able to access the GPIO using the System.Device.Gpio.

0 Votes 0 ·

I just tried System.Device.GPIO and it doesn't work. System.Device.GPIO appears to be for Windows IoT Core.

0 Votes 0 ·
Show more comments
SandervandeVelde42 avatar image
0 Votes"
SandervandeVelde42 answered melonNG-6986 commented

Hello @melonNG-6986 ,

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.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for your suggestion.

0 Votes 0 ·