Marion bio photo

Hi, I'm Marion

A data scientist passionate about the brain. Check out my projects on Brain Computer Interfaces & Machine Learning ♥

marion@ebrain.io Twitter Google+ LinkedIn Github

If you are using the OpenBCI v3 with Mac, chances are that you had to deal with latency issues when getting the data packets from the OpenBCI board. The problem is further detailed in this post.

You can solve this latency problem by setting the Read Buffer Size in the config data of the Info.plist file. Below are the steps to get this going on Mac.

Step 1: cleanup

Remove the kernel extension (you might not have it already installed. If so, skip this step)
sudo rm -rf /System/Library/Extensions/FTDIUSBSerialDriver.kext


Make sure you don’t have another old FTDI driver installed under /Library/Extensions. If that’s the case, remove it:
sudo rm -rf /Library/Extensions/FTDIUSBSerialDriver.kext

Step 2: get the FTDI driver

Download the FTDI driver version 2.2.18 here.

Step 3: dev mode

Enable kext-dev-mode patch:
sudo nvram boot-args="kext-dev-mode=1"

Step 4

Reboot your computer.

Step 5

Unload the FTDI kernel extension:
sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext

Step 6

Make sure it’s unloaded:
kextstat | grep FTDI (this command should not print out anything)

Step 7

Open the Info.plist file: sudo vim /System/Library/Extensions/FTDIUSBSerialDriver.kext/Contents/Info.plist

Step 8

Insert config data for the “FT X Series” key.

Info.plist “FT X Series” entry before – without config data

            <key>FT X Series</key>
            <dict>
                    <key>CFBundleIdentifier</key>                               
                    <string>com.FTDI.driver.FTDIUSBSerialDriver</string>
                    <key>IOClass</key>
                    <string>FTDIUSBSerialDriver</string>
                    <key>IOProviderClass</key>
                    <string>IOUSBInterface</string>
                    <key>bConfigurationValue</key>
                    <integer>1</integer>
                    <key>bInterfaceNumber</key>
                    <integer>0</integer>
                    <key>bcdDevice</key>
                    <integer>4096</integer>
                    <key>idProduct</key>
                    <integer>24597</integer>
                    <key>idVendor</key>
                    <integer>1027</integer>
            </dict>

Info.plist “FT X Series” entry after – with config data

            <key>FT X Series</key>
            <dict>
                    <key>CFBundleIdentifier</key>
                    <string>com.FTDI.driver.FTDIUSBSerialDriver</string>
                    <key>IOClass</key>
                    <string>FTDIUSBSerialDriver</string>
                    <key>IOProviderClass</key>
                    <string>IOUSBInterface</string>
                    <key>bConfigurationValue</key>
                    <integer>1</integer>
                    <key>bInterfaceNumber</key>
                    <integer>0</integer>
                    <key>bcdDevice</key>
                    <integer>4096</integer>
                    <key>idProduct</key>
                    <integer>24597</integer>
                    <key>idVendor</key>
                    <integer>1027</integer>
                    <key>ConfigData</key>
                    <dict>
                      <key>PortName</key>
                      <string>OpenBCI</string>
                      <key>InBufferSize</key>
                      <integer>64</integer>
                    </dict>
            </dict>

Note: I also renamed the port name to OpenBCI because it’s easier to spot if the board is connected or not.

Step 9

Load the kernel extension:
sudo kextload /System/Library/Extensions/FTDIUSBSerialDriver.kext

Step 10

Make sure it’s loaded:
kextstat | grep FTDI

You should see something like that:
145 0 0xffffff7f82dce000 0x8000 0x8000 com.FTDI.driver.FTDIUSBSerialDriver (2.2.18) <118 37 5 4 3 1>

Step 11

Have fun with your OpenBCI board and real time data. \m/-(^.^)-\m/

Useful links