Monday, September 28, 2015

Getting the Adafruit serial cable to work on OS X 10.10 (Yosemite)

After trying for a couple of hours to get the Adafruit serial cable to connect to my Raspberry PI A+ I learned some lessons:
  1. You can power the Raspberry using the USB cable alone. If you connect your A+/B+ to a power source do not connect the red lead to the Raspberry PI
  2. Always read the instructions before connecting your computer to anything (DUH :-).
  3. Apart from how to connect the cable to the Raspberry PI the Adafruit guide:
         https://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable/overview
    ...is somewhat out of date.
  4. The OS X driver linked to from the Adafruit article:
          http://changux.co/osx-installer-to-pl2303-serial-usb-on-osx-lio/
    ...has issues with Yosemite, all you get when you install it and run the screen command is a blank terminal window. If you check in the console logs you will find something resembling the following entries.

    28/09/15 22:28:36,000 kernel[0]: nl_bjaelectronics_driver_PL2303(0xffffff8029049800)::allocateResources failed - no fpInterface.
    28/09/15 22:28:36,000 kernel[0]: nl_bjaelectronics_driver_PL2303(0xffffff8029049800)::start Allocate resources failed
    28/09/15 22:28:36,000 kernel[0]: nl_bjaelectronics_driver_PL2303(0xffffff8029049800)::CheckSerialState - StartSerial failed


    ...the reason for this is apparently that the driver has issues with OS X kernel signing.
  5. After growing sick and tired of trying to get this thing to work I uninstalled it:

    sudo rm -r /System/Library/Extensions/osx-pl2303.kext
    sudo kextunload /System/Library/Extensions/osx-pl2303.kext

    and found out that there is a manufacturer supplied driver for the PL2303:
          http://www.prolific.com.tw/us/showproduct.aspx?p_id=229&pcid=41
    ...that now supports OS X10.10 and OS X 10.11 (El Capitan). After installing it the Adafruit Serial/USB cable finally worked. Don't be fooled if you get a blank terminal window after running the screen command:

          screen /dev/cu.usbserial 115200

    ... for some reason the 'raspberrypi login:' prompt did not appear on my system but entering the username and hitting [Return] caused the  familiar 'Password:' prompt to appear.
  6. Finally, if you get a bunch of errors like this:

          Cannot open line '/dev/cu.PL2303-000013FA' for R/W: Resource busy

    ...or:

         dev/cu.PL2303-000013FA: ioctl TIOCEXCL failed: Resource busy

    It may be because you are improperly terminating the screen command. The proper way is:

          [Ctrl]+[A], then [K] and finally, [Y] to shut the program down.