LatencyTimer / InBufferSize for OS X, new Info.plist
Both Mac and Windows are using the FTDI VCP virtual com port, (usb serial port emulation driver.) For the related setting on Windows see this post.
FTDI defaults the "Latency Timer" on both Mac and Windows to 16 milliseconds. This causes large pauses to occur in the input stream from the OpenBCI data. The link above shows how to set the timer to 1 ms on Windows via a control panel setting. On Mac there is no equivalent control panel, but there is a file called Info.plist that can be copied into the Mac kernel extension driver folder, that will override the default. It turns out on Mac, setting that value to 1 ms has no effect (default continues). But setting it to 2 ms, does seem to do the override and buffering delays are improved substantially.
You can download the file from here.
If you don't already have the FTDI driver installed, see this post. Many pre-Mavericks Mac came with this preinstalled. If you have Mavericks or Yosemite you need to do some extra steps to disable the Apple driver, outlined in that link.
Make a backup copy of the old Info.plist in the folder below, and copy the new Info.plist over the old one:
/System/Library/Extensions/FTDIUSBSerialDriver.kext/Contents
Easiest thing to do at this point is to just reboot, which will pickup the new driver parameters. Using your Processing GUI, you should now see improved buffering performance. Our entry in the plist file is the one labeled:
"<key>FT X Series</key>"
William
Comments
I have been trying for a while now to get this to work on my Mac and have had little luck. The main problem for me seems to be that changing the Info.plist file changes the signature (like a checksum I'm assuming?) on the FTDI driver so that when I try to run:
sudo kextload /System/Library/Extensions/FTDIUSBSerialDriver.kext/
I get the error:
I have tried setting a dev flag as suggested here (http://www.mommosoft.com/blog/2014/10/24/ftdi-chip-and-os-x-10-10/) by saying:
sudo nvram boot-args=”kext-dev-mode=1″
Any idea what else I can try? What other authentication methods could I use so that the loading will work?
Thanks,
Rodrigo
NOTE:
I'm replacing the Info file like this:
Where Info_k.plist is the file I downloaded from your post. (Which looks fine on Xcode and has the latency config set to 2.
The link below shows that folks had varying experience with the nvram command working, depending on whether or not quotes were used. Try issuing the command without quotes. You can also say "nvram -p" to print current settings -- to see if it is remembering your setting.
http://dpsinsider.com/forums/topic/yosemite-dp4-breaks-dps/
I only have Mavericks here myself, this new restriction on signing kexts went into effect on Yosemite.
I got the driver to load, but now even worse, the latency is still there!!
The Info file has the changed config to 2 ms and the driver recognizes my device, connects and streams, but still the exact same latency.
I really don't understand...
I'm guessing it's a Yosemite issue? But how, it loads! How can it load but then ignore the changes in the Info file?!
I tried every variation discussed in the forum, re-typing with quotes, without quotes, copy-pasting, everything. The copy-paste renders it unloadable and nvram -p lists the dev-mode as an "UNPRINTABLE STRING". Re-typing the command with or without quotes makes it:
The forum weirdly before it is set this way the variable is not printed at all, whereas the forum says it should be =0.
It's possible Yosemite is somehow throttling the driver. Can you edit the plist and try say 3ms, etc.? I sure as heck wish FTDI was more involved with this whole thing. How they could be distributing a driver written in 2012, it just makes no sense.
http://sourceforge.net/projects/osx-pl2303/
https://www.mac-usb-serial.com/
This is NOT for the FTDI usb chip, however, perhaps it would be possible to morph it into FTDI compatible. Without sweating bricks. :-) I don't know if FTDI provides enough low level info in their docs to accomplish this.
Between Apple's secrecy (with their own driver and Yosemite misfeatures) and FTDI's tardy updates -- some kind of open source solution may be the only way out of the cage...
How did you verify that PL-2303 works in this mode? Did you test with 32 byte packets sent at 4 ms intervals?
FTDI just returned my email and provided an attached, updated Mavericks / Yosemite driver. It's not posted on their site yet. Rodrigo I'm sure will test with it as soon as possible. And let us know if it improves his situation.
At least FTDI is "on the case" and can make adjustments if we find further tweeks needed.
I have been testing out the new driver and still no luck with the latency.
Installation and set up goes fine using the instructions provided.
The new driver does not have a specified LatencyTimer configuration for the FT X Series and so, as expected, out of the box the latency persists.
I then modifying the Info.plist file from the new driver (copy attached) and replaced it.
Weirdly, the driver actually loads (sudo kextload /Library/Extensions/
Finally running kextstat shows this driver below is loaded and shows no other FTDI named drivers.
I'm assuming this is the driver we want.
This all looks great, except the latency is still there.
I have changed the LatencyTimer to 1, 2 and 3 ms and still the same latency.
I am testing latency by printing incoming packets using the print plugin of user.py (https://github.com/OpenBCI/
Oh and I've also rebooted constantly throughout these trials.
I remember trying to change the buffer size, but I never got it that low I guess!
I will try it right now,
Thanks @marion
So when you changed the info.plist using vim, did you just :wq to exit? One of the problems with changing the info.plist is that the signage (something like checksum I think) that apple requires on drivers, recognizes I have modified the file and then will not allow me to reload it.
This is the error:
What OS version do you have? Is your system set on dev-mode?
I just tried @marion's approach but ran into the same issue as @Rceballos98:
Despite getting this error, however:
conor$ kextstat | grep FTDI
Yields the following printout:
145 0 0xffffff7f82a07000 0x7000 0x7000 com.apple.driver.AppleUSBFTDI (1.0.1b16) <84 41 5 4 3>
It seems Rodrigo and I are in the same place.
Now when I try to connect to my device through the Processing GUI, I am able to connect to the device (and see the software/hardware hand-shaking & initial registers of the ADS printing to the console). But when I hit start streaming, nothing comes through. Thoughts?
I'm going to keep digging.
Conor
http://www.ftdichip.com/Support/Documents/AppNotes/AN_134_FTDI_Drivers_Installation_Guide_for_MAC_OSX.pdf
Where they state,
Please note that editing the kext to add a VID/PID, or alias a baud rate now requires re-signing with a
kext-signing certificate.
But of course we know this already. The March 23 post by Rodrigo mentions the kext-dev-mode nvram boot setting. But it's possible this has been tightened up even further in the latest Yosemite releases. Wondering if everyone could share their exact 10.10.x versions with us.
Have not looked though these search results yet, could be some hints here,
https://www.google.com/search?q=yosemite+kext-dev-mode
http://visionstudios.ca/blog/ssd-trim-enabler-os-x-yosemite
http://en.wikipedia.org/wiki/OS_X_Yosemite
I don't see how you could be running the altered signature driver without the kext-dev-mode change. Unless you have an early build that is not checking this.