简体   繁体   English

Windows IoT Raspberry Pi 3 USB连接到C#后台应用程序中的Arduino

[英]Windows IoT Raspberry Pi 3 USB Connection to Arduino in C# Background App

I'm trying to get a serial communication over USB between an Arduino Nano and the Raspberry Pi 3. On the Raspberry is Windows IoT installed with a Background App that should read the incomming data. 我正在尝试在Arduino Nano和Raspberry Pi 3之间通过USB进行串行通信。在Raspberry上安装了Windows IoT,该Windows IoT安装了应读取传入数据的Background App。

My problem is that i can't find the connected Arduino. 我的问题是我找不到连接的Arduino。 I wrote a simple app to iterate through all devices but i don't get a DeviceInformation for the connected Arduino. 我写了一个简单的应用程序来遍历所有设备,但没有得到所连接的Arduino的DeviceInformation。

public sealed class StartupTask : IBackgroundTask
{
    public void Run(IBackgroundTaskInstance taskInstance)
    {
        while (true)
        {
            var devices = DeviceInformation.FindAllAsync(SerialDevice.GetDeviceSelector()).AsTask();
            devices.Wait();

            foreach (var dev in devices.Result)
            {
                Debug.WriteLine(dev.Name);
            }
        }
    }
}

Has anyone an idea what is wrong? 有谁知道出什么问题了吗? Maybe i have to install drivers manually? 也许我必须手动安装驱动程序?

Note: I can also find no device in the webinterface List of connected Device on Webinterface 注:我也找不到任何设备在webinterface 上Webinterface连接的设备列表

Thanks in advance. 提前致谢。

EDIT: 编辑:

  • I found out that the Name is always the same, so i changed it to print the ID. 我发现名称始终是相同的,因此我将其更改为打印ID。

  • I inserted the DeviceCapability Node and now i getting a bunch of informations. 我插入了DeviceCapability节点,现在我得到了很多信息。 I'll guess the Id's starting with USB are interessting. 我想以USB开头的ID会引起兴趣。 But i'm getting always the same, regardles if the arduino is pluged in or not. 但是,无论是否插入了arduino,我总是一样。

  • Here is one Example: \\?\\USB#VID_0424&PID_EC00#5&3753427a&0&1#{ad498944-762f-11d0-8dcb-00c04fc3358c}{2697A3B2-2715-443C-8A9F-B050D699B775} 这是一个示例:\\?\\ USB#VID_0424&PID_EC00#5&3753427a&0&1#{ad498944-762f-11d0-8dcb-00c04fc3358c} {2697A3B2-2715-443C-8A9F-B050D699B775}

  • Current OS Version: 10.0.14393.448 当前操作系统版本:10.0.14393.448

Arduino Nano use FTDI USB-To-Serial chip FT232RL to communicate with Host PC, and in your case Raspberry Pi with Windows IoT Core. Arduino Nano使用FTDI USB转串口芯片FT232RL与主机PC(在您的情况下为具有Windows IoT核心版的Raspberry Pi)进行通信。

My experience with FT232RL chip on windows IoT is it's native supported with some latest versions(probably 10.0.10586 and above), so first make sure you have OS version above that. 我在Windows IoT上使用FT232RL芯片的经验是它在某些最新版本(可能是10.0.10586及更高版本)中受本机支持,因此请首先确保您具有高于该版本的OS版本。 And use "devcon status xxxxxxx" command to verify the device driver is working properly. 并使用“ devcon status xxxxxxx”命令验证设备驱动程序是否正常运行。

If you're not sure what the device id looks like, plug the arduino nano into PC, and in the device property, check on the Hardware Ids. 如果不确定设备ID是什么样,请将arduino nano插入PC,然后在设备属性中检查“硬件ID”。 For example, mine shows 例如我的节目 在此处输入图片说明

Second, check if you have the com port communication capability declared in your project manifest file, it should be something like below, 其次,检查您的项目清单文件中是否声明了com通讯功能,它应该如下所示,

 <DeviceCapability Name="serialcommunication">
   <Device Id="any">
     <Function Type="name:serialPort" />
   </Device>
 </DeviceCapability>

Last, make sure the USB port of your RP3 has enough power supply for Arduino nano, I don't think it should be a problem, but better have that checked as well. 最后,确保RP3的USB端口有足够的电源可用于Arduino nano,我认为这不是问题,但最好也进行检查。

Maybe you can try installing the Arduino IDE on the Windows installation, as it includes the Arduino USB drivers: 也许您可以尝试在Windows安装上安装Arduino IDE,因为它包含Arduino USB驱动程序:

Arduino安装选项

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

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