Home Using BusBlaster + openOCD on OSX Mavericks
Post
Cancel

Using BusBlaster + openOCD on OSX Mavericks

I’ve been using the Dangerous Prototypes Bus Blaster along with openOCD to program/debug my LPC1769 microcontroller. It’s been a while since I did anything, so when I tried again last week and couldn’t get it to work, I was slightly confused. The only change (that I was aware of) was an OSX upgrade from Mountain Lion to Mavericks.

Whenever I tried to run openOCD, I would get the following error: Error: unable to open ftdi device: unable to claim usb device. Make sure the default FTDI driver is not in use

I tried reinstalling the FTDI drivers (both VCM and D2XX), unloading them, reloading, and several other things without any luck. Whenever I plugged the BusBlaster in, two devices would show up under /dev. /dev/cu.usbserial-1d11A and /dev/cu.usbserial-1d11B. This meant that the FTDI driver was working, but at the same time, stopping openOCD from using the device. What did not make sense was that this was happening even when I unloaded the FTDI kext.

After some research, I found out that since OSX Mavericks, the AppleUSBFTDI kernel driver is included by default. This was the one setting up the usbserial devices whenever I plugged the device in. The main solution everyone seemed to have was to unload AppleUSBFTDI using: sudo kextunload -bundle com.apple.driver.AppleUSBFTDI 

Finally! After unloading the kext, openOCD started working again. Unfortunately, this means that you can’t use any usb-serial devices anymore, because the kext isn’t loaded… That’s unfortunate.

Luckily, I had an idea. What if I unload the kext, run openOCD, then load it again? It worked! OpenOCD was still working and the rest of the FTDI usb-serial devices were loaded. Finally a working solution that didn’t cripple the system. This still requires me to unload/load the kext every time I want to use openOCD, which is not a terribly elegant solution.

During my research into the problem, I ran into a forum post with a similar problem, except it was in 2007 and instead of the Apple FTDI driver, it was the regular FTDI driver causing problems. Their solution had them edit the kext’s Info.plist to make sure the driver didn’t do anything to a particular usb device. (Using product and vendor id’s) That got me thinking that maybe I could do the same with the Apple kext. To do this, open:

/System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBFTDI.kext/Contents/Info.plist

Find the device you want excluded, in this case AppleUSBEFTDI-6010-0 and comment out the key and dictionary. (I looked up the product id on OSX’s System Information window)

FTDI Device Id

FTDI Device Id

Now you just have to reload the kext and everything should work without having to load/unload kexts every time! sudo kextunload -bundle com.apple.driver.AppleUSBFTDI sudo kextload -bundle com.apple.driver.AppleUSBFTDI

AppleUSBFTDI.kext Info.Plist

AppleUSBFTDI.kext Info.Plist

This post is licensed under CC BY 4.0 by the author.