Gatsby Logo

Beaglebone Black - Getting Started Pt.1

2019-12-21

I've recently found myself in the position of needing to automate some hardware testing. The hardware is a buck converter that occasionally fails to start up - and it's part of a larger system. So, to test the buck converter I need a way of reproducing the failed startups. Since this occurs very infrequently, I need a device that can start and restart the buck converter many times over several days, check that it is operating, and if not then log the failure with a timestamp.

The Beaglebone Black (BBB) collecting dust on my desk seems ideal for this task, but as I rarely use them, I found myself relearning a lot of what is required just to get up and running. And so to remember, I thought I would write a getting started guide to my future self.

Today I will be working with

  • Beaglebone Black Rev. C
  • Macbook Pro w/ macOS Mojave
  • microSD card for flashing the eMMC on the BBB
  • USB microSD adapter
  • miniUSB cable for BBB initial configuration

Flashing an OS to the BBB

First we will need to flash an OS to the eMMC on the BBB. You can optionally run directly from µSD card, but it is slower, and can't really think of why you would want to.

Download the latest image from the Beaglebone site. I have selected the "IoT Flasher" image which lacks a GUI and will flash from µSD to eMMC for us.

On macOS you can use The Unarchiver to extract the image from the downloaded *.xz archive. Use 7-zip if you're on windows or tar -xf archive.tar.xz on linux.

Plug the µSD card into the USB adapter and Macbook. Using diskutil list I can see that my µSD card is enumerated as /dev/disk2. In the syntax below I will refer to this as /dev/disk(n) to avoid copy-paste errors in the future as this disk may not always be enumerated as disk2.

alt text

To copy the image to the card it will need to be unmounted. This is done with diskutil unmountDisk /dev/disk(n).

To erase the disk contents I use diskutil randomDisk /dev/disk(n) which writes random data to the disk. This took too long and I would probably seek an alternative in the future.

Finally, the image can be copied to the µSD card with sudo dd if=./BBB-blank-debian-9.5-iot-armhf-2018-10-07-4gb.img of=/dev/disk(n). This took about 35 minutest to complete. When the transfer is complete, eject the disk.

To flash the OS to eMMC, power off the BBB and insert the µSD card. Hold down the tact switch S2 and plug in the miniUSB cable to power the BBB. The 4 user LED's on board will light up, go off, then start flashing. Release S2. The lights will go off again when the flashing is complete. The BBB is now OFF.

Remove the µSD card, then press the S3 switch to power up the board.

When the BBB boots up, it should mount as a MSD to the Macbook. Browse the drive you'll find a file start.htm which shows some drivers that may need to be installed.

alt text

On this page there is also the following IP table.

alt text

SSH via USB

With drivers installed and this IP table you see we can ssh the BBB over USB at 192.168.6.2. So, ssh 192.168.6.2 -l debian the default password is temppwd.

Set a Static IP

I want a static IP on eth0 so I can easily find the BBB on the network. To do this, connect via ssh over USB and edit the interfaces file with sudo vim /etc/network/interfces. Type i for insert, then edit to something like the static IP entry below.

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.200
netmask 255.255.255.0
gateway 192.168.1.254

Now esc to end the edits and :wq then return to write the edits and quit. To exit without saving :q! instead.

After you sudo reboot the static IP should be set on eth0.

Moving Forward

I will now switch to the AC/DC power adapter to run the BBB and eliminating the miniUSB. Of course the power source could be either, but since I am done with the initial configuration i.e. ssh via usb, I made the switch. From here on out I will ssh eth0 on the static IP.

Change the Default Passwords

For me, i could not change passwords when connected ssh via USB - I had to ssh eth0. When logged in as U:debian type the command sudo passwd and follow the prompts to enter a new password for the logged in user. Then type sudo passwd root to change the password for U:root.

Summary

So far we have taken a factory fresh Beaglebone Black and installed an OS to the onboard eMMC. We prepared for future work by establishing that we can ssh over a static IP on eth0. Finally we have better secured our BBB by changing the default passwords. In part 2 we will look at the next steps in getting some basic BBB functionality going.