简体   繁体   English

如何与非树莓设备的 Windows(Win 10)上的 GPIO 通信?

[英]How to communicate with GPIO on windows (Win 10) for non raspberry device?

I have a motherboard (KINO-DH310) with windows 10, the GPIO controller displays under Device Manager -> System devices -> Interl(R) Serial IO GPIO Host Controller .我有一个带有 Windows 10 的主板 (KINO-DH310),GPIO 控制器显示在Device Manager -> System devices -> Interl(R) Serial IO GPIO Host Controller下。

How am I supposed to begin simple I/O with this controller?我应该如何使用这个控制器开始简单的 I/O? I've tried different strategies, different programming languages, but to no affect.我尝试了不同的策略,不同的编程语言,但没有任何影响。 The majority of examples / sample code I see online are for the raspberry pi, and don't seem to work for me.我在网上看到的大多数示例/示例代码都是针对树莓派的,似乎对我不起作用。 Is there a concept I'm not grasping?有没有我没有理解的概念?

GPIO 控制器

I've tried toggling the output pins to low and high using assembly (from C++ application)我尝试使用程序集(来自 C++ 应用程序)将输出引脚切换为低和高

KINO-DH310 recommended assembly: Digital Output is 1001b KINO-DH310 推荐组装:数字输出为 1001b

MOV AX, 6F09H ;setting the digital port as output
MOV BL, 09H   ;digital value is 09H
INT 15H

My C++ Code:我的 C++ 代码:

__asm {
mov AX, 6F09H
mov BL, 00H
INT 15H        <--- Generates "Access Violation reading location 0xFFFFFFFF" error
};

This always generates an access violation because you could potentially access memory that would harm the system.这总是会产生访问冲突,因为您可能会访问会损害系统的内存。 Is there a way to suppress this?有没有办法抑制这种情况?

My C# Code:我的 C# 代码:

var gpio = GpioController.GetDefault();

if (gpio == null)
    return;      <--- Always returns null

Always generates null.始终生成 null。 I was hoping since I could see it in device manager, Windows could detect it has access to a GPIO Controller.我希望因为我可以在设备管理器中看到它,Windows 可以检测到它可以访问 GPIO 控制器。

Any clarification would be greatly appreciated, even if the answer would be Windows doesn't support it (which I'm hoping is not the case)任何澄清将不胜感激,即使答案是 Windows 不支持它(我希望不是这种情况)

Just wanted to give an update if anyone is trying to do something similar.如果有人试图做类似的事情,只是想提供更新。 In the end, I needed to get the SDK from the motherboard manufacturer.最后,我需要从主板制造商那里获得 SDK。 (IEI) (IEI)

There was a small bug in the BIOS, but they were nice enough to give me a patch to the BIOS, and after updating the BIOS version, the SDK worked perfectly. BIOS 中有一个小错误,但他们很好地给了我一个 BIOS 补丁,更新 BIOS 版本后,SDK 运行良好。

最后结果

You cannot use BIOS interrupts when the CPU is in protected mode, which all modern operating systems use.当 CPU 处于所有现代操作系统都使用的保护模式时,您不能使用 BIOS 中断。 Looking at the manual for your board, it seems the example you're using is meant for bare-metal applications.查看您的电路板手册,您使用的示例似乎适用于裸机应用程序。

As far as using C#, it looks like the GpioController class is only supported on Windows IoT.就使用 C# 而言,看起来 GpioController 类仅在 Windows IoT 上受支持。

It should be possible to use the IO by interfacing with the driver, but information about that is difficult to find, so you may be out of luck.应该可以通过与驱动程序接口来使用 IO,但是很难找到有关该信息的信息,因此您可能不走运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM