在 Windows Runtime 8.1 中连接到 FT232R USB UART 设备

Connecting to FT232R USB UART device in Windows Runtime 8.1

我正在尝试使用 Windows 用于 Windows 商店应用程序的运行时组件连接到 FT232R USB UART 设备。不幸的是,似乎没有任何效果。

我的设备有 0x0403 的 vid 和 0x6001 的 pid,这对于这种类型的设备来说似乎很标准。

我试过了this approach but in my case the ClassCode and SubClassCodde are both 0x00 respectively and InterfaceClassCode and InterfaceSubClassCode are both 0xFF. All this data comes from the USB view utility

使用基于这些 class 和子 class 代码的选择器 DeviceInformation.FindAllAsync(selector) 未找到任何设备。此外,基于 vid 和 pid 创建的选择器未找到任何设备。

在没有选择器的情况下找到了设备,但我在 UsbDevice.FromIdAsync(serviceInfo.Id) 中收到了 null

我也尝试过 FTDI 方法。我下载了 FTDI 驱动程序并引用了 FTDI.D2xx.WinRT.winmdFTDI.D2xx.WinRT.USB.winmd。我使用了 this PDF 中记录的方法,但是 FTDI.D2xx.WinRT.FTManager.GetDeviceList() returns 空列表。

根据我找到的文档,DeviceCapabilities 的定义是正确的:

<Capabilities>
    <m2:DeviceCapability Name="usb">
      <!--FT232AM, FT232BM, FT232R and FT245R Devices-->
      <m2:Device Id="vidpid:0403 6001">
        <m2:Function Type="name:vendorSpecific" />
      </m2:Device>
    </m2:DeviceCapability>
</Capabilities>

我做错了什么?

好吧,经过长时间的斗争,我找到了解决方案。将它张贴在这里以防将来有人需要它。

首先,您应该按照官方 FTDI 指南安装 FTDI drivers from here

您需要删除 Windows 为您的设备安装的默认驱动程序。

这样做:

选中 "Delete the driver software for this device" 复选框很重要。

串行控制器也这样做:

然后禁用 Windows 自动驱动程序安装 here

然后在设备管理器中扫描硬件更改,您将看到无法识别的设备。

手动安装它的驱动程序。

之后您将在通用串行总线设备下看到您的设备,而不是控制器。

现在您的设备将可以使用 FTDI 完全访问 API。

这是a link to API guide,以备不时之需。它还对如何安装正确的 FTDI 驱动程序进行了解释。