BeagleBone and the Mac

Last week, my cool little BeagleBone arrived from Adafruit. This post is my attempt to describe getting the BeagleBone set up on a Mac with OSX.

Not everything I’ll be writing about is necessarily unique to using it with a Mac (versus say, Windows or Linux), but that’s obviously going to be my perspective since I’m a Mac guy 100%.

The general tasks look like this:

  • Download the latest OS to a Micro-SD card.
  • Install USB serial driver on the Mac
  • Connect the BeagleBone to the USB port
  • Open a serial terminal to the USB port
  • Talk to the BeagleBone!

Out of the Box

A New Pre-Built Linux Image

As the BeagleBone “Getting Started” guide suggests, the Linux image that comes pre-installed on the SD card that comes with the BeagleBone may not be the latest available.
You can download a more recent image from the links in the guide. Once you do, it needs to be written to the SD card.

To write the image to the SD card, it first needs to be unmounted.

    diskutil unmount /volumes/YourCardNameHere

Then, write the image to your SD card. Note that the diskXXX should be the actual disk device assigned when the SD card is connected.
This can be found a couple ways. You can use the “Disk Utility” application, or the command line df command.
These may show you the partition, something like disk7s2. You want to entire SD card, not any partitions so drop the s2 part.

    gunzip -c Angstrom-Cloud9-IDE-eglibc-ipk-v2012.01-core-beaglebone-2012.01.11.img.gz | dd of=/dev/diskXXX bs=4096

USB Serial Drivers

For my Lion setup, all I needed to install were the drivers that came with the BeagleBone.

These were on the USB “drive” that appears when you connect the BeagleBone to your Mac, as well as available from the BeagleBone website FTDI_Ser.dmg

Serial Terminal

The command line program screen makes a pretty handy serial terminal.

    screen /dev/tty.usb*B 115200

I set up my ~/.screenrc file as follows:

    termcapinfo xterm* ti@:te@
    autodetach off

The first line causes the scrollbars in the terminal window to work for scrolling back the serial terminal text lines. (See this stackoverflow post for details on why this is needed)

The second line will cause the screen session to terminate (rather than just “detach”) when you close the Terminal window.

Both of these are behaviors you probably want.

Custom Terminal Settings

You can also set up a custom set of terminal settings. I defined a set that made the window larger, and – most importantly – executed the screen command automatically.

SSH

ssh root@beaglebone.local

Ethernet Connection

The BeagleBone uses DHCP to get an IP address from your local network. (assumes your local network is set up to do that of course – most are)
To connect to it via a browser etc you need to know its IP address. Here are three ways to do that.

  1. Use a local name
  2. Display the assigned IP address using the USB-serial shell
  3. Look at the addresses assigned by your router

In my case, the router on my network is an Apple Time Capsule. I mention this just in case your router works differently.

The “local name” scheme works great. The BeagleBone identifies itself as “beaglebone” to the DHCP server. I can connect to my BeagleBone as beaglebone.local.

Alternately, using the command ifconfig via the USB-serial shell will display the IP address assigned to the BeagleBone’s ethernet port. (at the moment, mine is 10.0.1.2)

The third option is router-spcific. In the case of the Time Capsule, run the Airport Utility application on the Mac. Select “Manual Setup” for the TimeCapsule, got to the “Advanced” tab, then “Logging & Statistics”. On that screen, select DHCP Clients and you’ll see a list of devices and their assigned IP addresses. You will also see the client ID, which in this case is “beaglebone”.


Next Steps

These will include an FTP server, Mercurial, and perhaps an editor like pico.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: