简体   繁体   中英

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.

My problem is that i can't find the connected Arduino. I wrote a simple app to iterate through all devices but i don't get a DeviceInformation for the connected Arduino.

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

Thanks in advance.

EDIT:

  • I found out that the Name is always the same, so i changed it to print the ID.

  • I inserted the DeviceCapability Node and now i getting a bunch of informations. I'll guess the Id's starting with USB are interessting. But i'm getting always the same, regardles if the arduino is pluged in or not.

  • Here is one Example: \\?\\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

Arduino Nano use FTDI USB-To-Serial chip FT232RL to communicate with Host PC, and in your case Raspberry Pi with Windows IoT Core.

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. And use "devcon status xxxxxxx" command to verify the device driver is working properly.

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. 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,

 <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.

Maybe you can try installing the Arduino IDE on the Windows installation, as it includes the Arduino USB drivers:

Arduino安装选项

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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