无法打开与 FTDI 设备的连接 [英] Unable to open a connection to an FTDI device

查看:435
本文介绍了无法打开与 FTDI 设备的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个连接到 FTDI 设备的小型 OS X 应用程序.我已经根据 this question(我已将 .dylib 文件添加为框架,并将 ftd2xx.h、WinTypes.h 和 ftd2xx.cfg 文件添加到我的项目中).

I'm working on a small OS X app that connects to an FTDI device. I've configured my project according to the answer in this question (I've added the .dylib file as a framework, and I added the ftd2xx.h, WinTypes.h, and ftd2xx.cfg files to my project).

我目前能够检测 FTDI 设备是否/何时通过 USB 连接:

I'm currently able to detect if/when the FTDI device is connected over USB:

DWORD deviceCount = 0;
FT_STATUS ftdiPortStatus = FT_ListDevices(&deviceCount, NULL, FT_LIST_NUMBER_ONLY)
if (ftdiPortStatus == FT_OK) {
    // The debugger tells me the deviceCount is now 1
    ...
}

但是,如果我尝试使用以下任一技术打开与设备的连接:

However, if I try to open a connection to the device using either of the following techniques:

ftdiPortStatus = FT_OpenEx("FT232R USB UART",FT_OPEN_BY_DESCRIPTION,deviceHandle);
// OR
ftdiPortStatus = FT_Open(0, deviceHandle);

返回的 ftdiPortStatus 始终为 3 (FT_DEVICE_NOT_OPENED).

the returned ftdiPortStatus is always 3 (FT_DEVICE_NOT_OPENED).

答案这里表明问题可能是 Apple 在 OSX 10.9 中添加的新驱动程序,但是,如果我尝试卸载该 kext:

The answer here indicates that the problem might be a new driver that Apple added in OSX 10.9, however, if I attempt to unload that kext:

sudo kextunload -b com.apple.driver.AppleUSBFTDI

操作系统表明没有找到这样的 kext.我在 OSX 10.10 上,所以也许 Apple 悔改了他们的方式并从优胜美地(?)删除了该驱动程序无论哪种方式,我仍然无法连接......有没有人知道什么可能阻止连接或关于如何追踪问题的想法(返回的 FT_STATUS 不是很有帮助...)?

the OS indicates that no such kext was found. I'm on OSX 10.10, so maybe Apple repented of their ways and removed that driver from Yosemite(?) Either way, I'm still not able to connect... Does anyone have any idea what might be preventing the connection or have ideas for how I might track down the problem (the returned FT_STATUS isn't very helpful...)?


更新:
下面的答案为我解决了这个问题.如果您不确定是否安装了第二个非 Apple VCP 驱动程序,您可以通过在终端中运行以下命令来查找其他驱动程序:


UPDATE:
The answer, below, solved the problem for me. If you are unsure as to whether you might have a second, non-Apple VCP driver installed, you can find the other drivers by running the following command in a terminal:

kextstat | grep FTDI

这将输出如下内容:

  154    0 0xffffff7f831ee000 0x8000     0x8000     com.FTDI.driver.FTDIUSBSerialDriver (2.2.18) <96 16 5 4 3 1>
  155    0 0xffffff7f831f6000 0x7000     0x7000     com.apple.driver.AppleUSBFTDI (1.0.1b12) <96 16 5 4 3>

推荐答案

不,该驱动程序仍在优胜美地.运行

No, that driver is still there on Yosemite. Running

sudo kextunload -b com.apple.driver.AppleUSBFTDI

仍然删除相关的 kext 并释放设备以通过我刚刚测试的 Yosemite 系统上的 D2XX 库进行访问.如果您尚未将 FTDI 设备连接到系统,则 kext 可能会丢失.

still removes the relevant kext and frees the device for access via the D2XX library on this Yosemite system I just tested. The kext may be missing if you haven't yet connected your FTDI device to the system.

它也可能被另一个虚拟通信端口驱动程序阻止.如果您安装了 FTDI 的虚拟通信端口驱动程序,它也会控制端口并阻止 D2XX 库的连接.某些 Arduino 开发套件还为他们使用的 FTDI 芯片使用虚拟通信端口驱动程序,因此他们可能已经安装了自己的驱动程序.检查一下.

It may also be blocked by another virtual comm port driver. If you've installed FTDI's virtual comm port driver, that will also take control of the port and block the D2XX library from connecting. Certain Arduino dev kits also use virtual comm port drivers for the FTDI chips they use, so they may have installed their own driver. Check for that.

最后,我在示例代码中使用的FT232R USB UART"的设备名称可能不是您的设备名称.有许多 FTDI 变体,您需要确保使用的是特定类型设备的名称.这可以从带有 FT_LIST_BY_INDEX|FT_OPEN_BY_DESCRIPTION 选项的 FT_ListDevices() 命令中获得.如果您使用了错误的设备名称,FT_OpenEx() 可能会失败.

Finally, the device name of "FT232R USB UART" that I use in my example code may not be the name of your device. There are many FTDI variants, and you'd need to make sure you're using the name of your specific type of device. This can be obtained from the FT_ListDevices() command with the FT_LIST_BY_INDEX|FT_OPEN_BY_DESCRIPTION options. If you use the wrong device name, FT_OpenEx() can fail.

这篇关于无法打开与 FTDI 设备的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆