Once up-and-running, pylibftdi is designed to be very simple, but sometimesgetting it working in the first place can be more difficult.
Error messages¶
I have never installed USB drivers before on a MAC. I downloaded and installed the FTDIUSBSerialDriver104105106.pkg, I assume it will work on 10.75. I also downloaded the D2xx driver but I am not having any luck installing it. Terminal commands are giving problems. Any advice or help with installation of the drivers would be appreciated. The AppleUSBFTDI kernel extension is provided with OS X Mavericks to formally support application communications with hardware using the Future Technology Devices International (FTDI) chipset. Prior to OS X Mavericks, as OS X was updated, compatibility issues occurred as a result of issues between the FTDIUSBSerialDriver.kext and OS X updates.
FtdiError:unabletoclaimusbdevice.MakesurethedefaultFTDIdriverisnotinuse(-5)
¶
This indicates a conflict with FTDI’s own drivers, and is (as far as I know)mainly a problem on Mac OS X, where they can be disabled (until reboot) byunloading the appropriate kernel module.
MacOS (Mavericks and later)¶
Starting with OS X Mavericks, OS X includes kernel drivers which will reservethe FTDI device by default. In addition, the FTDI-provided VCP driver willclaim the device by default. These need unloading before libftdi will be able`to communicate with the device:
Similarly to reload them:
Earlier versions of pylibftdi
(prior to 0.18.0) included scripts forMacOS which unloaded / reloaded these drivers, but these complicated cross-platformpackaging so have been removed. If you are on using MacOS with programs whichneed these drivers on a frequent basis (such as the Arduino IDE when usingolder FTDI-based Arduino boards), consider implementing these yourself, along thelines of the following (which assumes ~/bin is in your path):
OS X Mountain Lion and earlier¶
Whereas Mavericks includes an FTDI driver directly, earlier versions of OS Xdid not, and if this issue occurred it would typically as a result ofinstalling some other program - for example the Arduino IDE.
As a result, the kernel module may have different names, but FTDIUSBSerialDriver.kextis the usual culprit. Unload the kernel driver as follows:
To reload the kernel driver, do the following:
If you aren’t using whatever program might have installed it, the drivercould be permanently removed (to prevent the need to continually unload it),but this is dangerous:
Diagnosis¶
Getting a list of USB devices
Mac OS X¶
Start ‘System Information’, then select Hardware > USB, and look for yourdevice. On the command line, system_profilerSPUSBDataType
can be used.In the following example I’ve piped it into grep-C7FTDI
, to print 7lines either side of a match on the string ‘FTDI’:
Mac Os X Versions
Linux¶
Use lsusb
. Example from my laptop:
Where did my ttyUSB devices go?¶
When a pylibftdi.Device() is opened, any kernel device which was previouslypresent will become unavailable. On Linux for example, a serial-capable FTDIdevice will (via the ftdi_sio driver) create a device node such as/dev/ttyUSB0 (or ttyUSB1,2,3 etc). This device allows use of the FTDI deviceas a simple file in the Linux filesystem which can be read and written.Various programs such as the Arduino IDE (at least when communicating withsome board variants) and libraries such as PySerial will use this device.Once libftdi opens a device, the corresponding entry in /dev/ will disappear.Prior to pylibftdi version 0.16, the simplest way to get the device node toreappear would be to unplug and replug the USB device itself. Starting from0.16, this should no longer be necessary as the kernel driver (which exports/dev/ttyUSB…) is reattached when the pylibftdi device is closed. Thisbehaviour can be controlled by the auto_detach argument (which is defaultedto True) to the Device class; setting it to False reverts to the oldbehaviour.
Note that on recent OS X, libftdi doesn’t ‘steal’ the device, but insteadrefuses to open it. The kernel devices can be seen as/dev/tty.usbserial-xxxxxxxx, where xxxxxxxx is the device serial number.FTDI’s Application Note AN134 details this further (see section ‘UsingApple-provided VCP or D2XX with OS X 10.9 & 10.10’). See the section aboveunder Installation for further details on resolving this.
Gathering information¶
Starting with pylibftdi version 0.15, an example script to gather systeminformation is included, which will help in any diagnosis required.
Mac Os X 10.11 Download Free
Run the following:
this will output a range of information related to the versions of libftdilibusb in use, as well as the system platform and Python version, for example: