Skip to content

Instantly share code, notes, and snippets.

@reggi
Last active July 1, 2020 19:28
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save reggi/2ccc955a4a6ce119d64d to your computer and use it in GitHub Desktop.
Save reggi/2ccc955a4a6ce119d64d to your computer and use it in GitHub Desktop.

Raspberry Pi and the USB to TTL Serial Cable on Mac (unfinished)

I took it to heart when @kassandra_perch said to document everything durring her talk at EmpireJS. So I documented my whole process, what went right and what went wrong.

This document is unfinished and is not a complete tutorial

The primary way to interact with a Raspberry Pi is to use WiFi and SSH. The problem with this is that the WiFi on the Pi needs to be configured and in order to do that you'll need a monitor. I've tried to edit the wpa_supplicant.conf by using the SD card's file system. I achieved this with minimal success the problem with this is that you still need to get the IP address of the Pi, even if it's connected.

Alas, there's another way! Using a wire referred to as the "USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi".

Note: The Raspberry Pi has a power cable, you know the one that plugs into the wall. It is important to note that the Raspberry Pi has another alternative way to be powered. It's the farthest most pin from the board on the corner is a 5 volt input not output, as I misread several tutorials. The cable we're using has a red wire that powers the Pi. This being said you should only use one methods of powering the Pi.

DO NOT USE THE RED WIRE AND POWER ADAPTOR AT THE SAME TIME!

Wiring it up!

red power, black ground, white RX into USB port, and green TX out of the USB port

Note: I originally had the white and green wires reversed because of this rpi wiring image image from a adafruit tutorial, which is why I had the diagram. Special thanks to Francis Gulotta @reconbot.

Installing the PL2303 USB to Serial Driver

Below are links for the two options for getting the PL2303 driver to work on OSX Mavericks. I've tried NoZap in the past with no luck.

Note: It seams you can't have two of the same drivers installed. If you run the NoZap .app file again it will uninstall it, then close terminal and unplug / plug in the Pi.

I'm going to use try using the osx-pl2303.kext for the rest of this tutorial.

Making the SSH Connection

We're gonna use the screen command, which is a terminal emulator. We have to point to the usb port and pass in 115200 (Speed | Baud rate).

Enter screen/cu. then press tab it will show you a couple of options for drivers. When the usb wire is unplugged it shows only a couple of Bluetooth drivers, but when it's plugged in it shows the PL2303 driver and the number 00001004.

screen /dev/cu.PL2303-00001004 115200

this later changes for me to, (remember to tab through options!)

screen /dev/cu.PL2303-000013FA 115200

THIS IS WHERE I GET AN ERROR


Errors / Results

  1. It just hangs with a empty terminal screen.
  2. It errors / flashes Cannot open line '/dev/cu.PL2303-000013FA' for R/W: Resource busy and then lands on Sorry, could not find a PTY. then I get the command line back with a printed [screen is terminating] statement.
  3. If I run it with sudo ie sudo screen /dev/cu.PL2303-000013FA 115200 I get a completly different error /dev/cu.PL2303-000013FA: ioctl TIOCEXCL failed: Resource busy, then the blank terminal screen.

Theories

  1. A connection has been made. It's just I'm not able to see the command line, or write commands. I believe this might be an issue with the setup on the Pi itself.
  2. I only get this error (so far) after I've ran the command and gotten a blank screen in one terminal session. I believe that it can't make the same connection twice, hence why it's busy.

Questions

  1. What's the difference between screen /dev/tty.PL2303-000013FA 115200 and screen /dev/cu.PL2303-000013FA 115200?

Actionable

  • I'm running sudo apt-get upgrade on the Pi now. (Taking forever)
  • Reinstall raspbian
  • Futz with the /bin/inittab file on the Pi

Inittab & cmdline.txt

sudo nano /etc/inittab

Here's my inittab file and my cmdline.txt file.

Like a gift from the gods someone (lurch) made this, rpi-serial-console which checks both cmdline.txt and inittab.

Using the tool I'm getting an error, follow that issue to see how I got the tool to work.

After all this, I run the screen command again to continue to get a blank terminal window or resource busy.

Where I left off

Resources

@scruss
Copy link

scruss commented Jun 28, 2014

You need to swap your green and white wires; you have TX ↔TX and RX ↔ RX, when you need TX ↔ RX and RX ↔ TX.

PL2303 drivers are horrible under OS X. Do you in fact have a /dev/cu.PL2303-000013FA device file? The difference between a TTY and a CU device is mostly historical. Just make sure you're a member of the dialout, tty or callout (??) groups.

I'd strongly recommend that you try different serial hardware, like a FTDI Basic Breakout - 3.3V. FTDI drivers just work.

@Wall-Dough
Copy link

I figured it out somehow. The serial cable has to be connected Black-White-Green.

I used the installer here http://www.prolific.com.tw/us/showproduct.aspx?p_id=229&pcid=41

After reboot you should be able to connect by calling ls -l /dev/tty*, finding the right device name, and using screen /dev/tty.PL2303-[etc.] 115200. When you get the blank screen, press enter to get the login.

I'm using Yosemite (10.10), but it should probably work on 10.9.

If you get that Sorry, could not find a PTY error, call screen -X kill to kill the screen service and it should then work for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment