Introduction
This blog post describes how to get the BeagleBone Black (or variants, such as the PocketBeagle) connected up, and communicating!
There are official instructions on the BeagleBoard website, so these are just alternative, clearer (to me, and to others I hope) instructions : )
The BeagleBone Black (BBB) is a single board computer (SBC) that has been around for years and there are many variants of it, such as the BeagleBone Black WirelessBeagleBone Black Wireless, and the BeagleBone Green. Apart from the names (and color), they are similar at their core. The main differences are the particular connectors on-board, or built-in wireless, or other relatively small changes.
Image source: photos from beagleboard.org
Nearly all BeagleBone Black variants have 512 Mbyte RAM, 4 Gbyte eMMC Flash, micro SD card, a full-size USB host connector and a smaller USB client connector, and two 46-way dual-in-line header socket connectors, known as P8 and P9. They all can run Linux, either from the eMMC, or from a micro SD card, and nearly all have a micro HDMI connector. There is also a tiny PocketBeaglePocketBeagle. The steps in this blog post apply to the PocketBeagle too - it will just be considered to be another variant of the BeagleBone black. If you're using the PocketBeagle start here though: PocketBeagle Quick Start Guide and Connecting to WiFi and Ethernet and that document will refer to this one.
The steps described here will get the BeagleBone Black (or a variant) upgraded with the latest software, and get you connected to it via the network.
What Do You Need?
Once you have your BeagleBone Black (or a variant - they will all be referred to as BBB in this blog post, unless there is a specific reason to differentiate), it is worth getting a micro SD card too, and a 5V DC supply, a micro USB or mini USB cable (depends on which BeagleBone you have) for the USB client connector, and a 3.3V USB UART cable. If you have a PocketBeagle, then you won't need the 5V DC supply initially (until you have projects you want to make).
There are several USB ports on the BBB. The one you need for initial setup, is the USB client connector and it is on on the same side as the DC barrel jack socket. So, check to see if that is a mini USB, or a micro USB socket. The original BBB uses mini USB. The BBB-Wireless uses a micro USB. The PocketBeagle has only one micro USB connector fitted, which acts as a USB client connector.
Optionally, if your BeagleBone has a micro HDMI socket then you may also want a micro HDMI cable, to use the device with a monitor. This blog post does not make use of that.
It should be stated, that if you care about your software running reliably, then a decent brand micro SD card is needed, from a traceable and reliable source (not some eBay or Amazon Marketplace seller that isn’t well known). Personally I only buy brand name ones from Amazon directly (i.e. Amazon being the seller). For this blog post, I used a 32Gbyte SanDisk Extreme.
Similarly, for the 5V DC power supply, a decent brand such as (say) Mean Well, XP Power or Phihong is required, from an electronics distributor (Amazon is not an electronics distributor). It needs to be 5V, and anything above 1A will work, but 2A or 3A is definitely preferred, so you can run additional things. The connector needed is a 2.1mm/5.5mm barrel connector, center positive. If you’re unsure, use a multimeter to check it.
Note: Incidentally, the BBB can power itself from the USB client connector. However you'll eventually most likely need an external power supply anyway, so better to obtain one while you're putting the rest of the stuff together for getting started with the BBB.
What Software is Needed?
If you’re using Linux or Mac, the recommended software according to the official instructions is Balena Etcher. This blog post uses Windows, and uses more mature (not necessarily better) software. Besides, it is sometimes nice to have another way of doing things, if things fail on you.
You’ll also need SSH client software. On Mac or Linux, this is built-in and can be accessed from a terminal, by typing ssh . On Windows, PuTTY is available to download for free.
The latest Linux image for the BBB is also required. That can be download from the BeagleBoard website download page. Download the Debian latest image, with Graphical Desktop if you think you may need to use that at some point. In my case it was with graphical desktop, and the version was Debian 9.5 2018-10-07 4GB SD LXQT (approx. 830Mbyte download).
Also, Win32DiskImager, and 7-Zip were downloaded and installed. If you’re following the official instructions then both of these applications are not needed. Still, 7-Zip is a handy piece of software to have installed on your PC anyway.
Creating the Micro SD card
The downloaded image file has a .img.xz suffix, and so 7-Zip was used to extract it, to a .img file (approx. 3.3Gbyte).
Insert a micro SD card into the PC, run Win32DiskImager and select the file and the correct drive letter, and then click Write. It should take a minute to burn the image onto the memory card.
The PC won’t recognise the file system (it will think the memory is not formatted). Anyway, eject the card, and insert into the BBB!
First Boot
Once the unpowered BBB has the micro SD card inserted, hold down the USER/BOOT button (it is labelled differently on some BBB variants, but it is the button closest to the micro SD card socket), and apply power (if you're using a PocketBeagle then no buttons need to be held down. Just insert the micro SD card, then plug in the micro USB cable). There is a bank of four LEDs that will all light up, and then extinguish and start flickering. At that point, you can release the button. The button just guarantees that the bootloader on the micro SD will be read (rather than the bootloader in eMMC, which may or may not read the image from micro SD, depending on how that bootloader was configured).
After a minute or so, the BBB should be up and running. Plug in a cable to the mini USB (or micro USB) socket that is on the same side as the DC barrel socket. It has special functionality, that makes it look like a USB memory stick to the PC, as well as looking like an Ethernet adaptor.
You should see a new drive letter appear on the PC, titled BeagleBone Getting Started. Simultaneously then there should also be a new virtual Ethernet adaptor on your PC (you can find it by typing ipconfig /all on windows, or ifconfig -a on Linux). It will be connected to a new network (as well as whatever network your PC is already connected to). It will have given your PC an additional IP address of 192.168.7.1.
The BBB will have an IP address of 192.168.7.2. You can connect to it using SSH (e.g. with PuTTY software on Windows, or using the in-built SSH command line client on Linux or Mac, by typing in a terminal ssh debian@192.168.7.2 ). The username and password are debian and temppwd respectively.
You can confirm that the BBB really has booted off the micro SD, by typing:
cat /etc/debian_version
It should report the same version number that you downloaded (e.g. 9.5). Note that Linux is running from the micro SD card, and not the eMMC. If you wish to install the image on the eMMC memory (which most of the BeagleBones have, apart from the PocketBeagle), then this entails setting up the BBB to program the eMMC on the next boot. To do that, the /boot/uEnv.txt file needs a certain modification, and then the BBB needs to be rebooted (by typing reboot). After that, the BBB will take some time (maybe 45 minutes) to program the eMMC, and eventually the BBB will self-power-down (all LEDs will extinguish). Then the micro SD card needs removing, and then the BBB can be powered up, and it will boot from eMMC. The precise instructions for eMMC programming are available here.
Powering Off and On
(There's no need to do this yet, if you're still configuring the BBB. But for when you do power it off eventually, note that you should never power off the BBB by just disconnecting power. Instead, type poweroff (you need to be a superuser to do that - see further below) and wait for all LEDs to extinguish. Then power can be safely disconnected. If you don't do this, then there is a risk of corrupting the micro SD card contents, or the eMMC contents.
To power on the BBB afterwards, just plug in the power.
If you wish to power off (and subsequently power on) using a button, then there is a button built-in on the BBB, marked POWER on some boards. If it is pressed briefly, then the BBB should automatically shut-down, and eventually all LEDs should be off. To power back on, either disconnect and reconnect the power, or just press the button again briefly.
If you wish to have an external button to power off/on the BBB, then it can be wired to the 46-way connector P9, pin 9 (which is already internally pulled high), and ground (P9 pin 1). When P9 pin 9 goes low briefly, then it will behave like the on-board power button.
Configuring Linux
Now that the BBB is booted up and you’re connected via SSH, some housekeeping is needed. Specifically, a root user (superuser) password needs creating, the initial debian user password needs changing, and a new account should be created. Follow these steps:
Creating a Superuser Password
To create a superuser password, type:
sudo su
Enter the default debian user password (temppwd when prompted for a password. Next, type
passwd
and enter the desired password.
If you wish (it can be considered a security issue), you can allow direct SSH access to the superuser, by editing the /etc/ssh/sshd_config file. There will be a line with PermitRootLogin commented out (prefixed by a hash or pound symbol). You can either change that line, or add a new line, with the following text:
PermitRootLogin yes
Save it, and then type:
systemctl restart ssh
You’re now a superuser, and can proceed with the remainder of the housekeeping stuff described below.
Changing the default debian user password
Now that you’re a superuser, you can easily change the debian user password from the default temppwd to something more secure.
Type:
passwd debian
Creating a New User
Type (change bob to be your name):
useradd bob -m -s /bin/bash
Next, change the password using:
passwd bob
If successful, Linux will have created a /home/bob folder
Increasing the micro SD Partition Size
The BBB only has 4 Gbyte of space on the micro SD card by default, due to how the image as downloaded from the BeagleBoard website was configured. This isn't a lot. You can see the free space by typing:
df -k
To configure the disk system to use all the space available on the micro SD card, type the following:
cd /opt/scripts/tools ./grow_partition.sh
It may return an error, stating Device or Resource Busy. Anyway, reboot the BBB, by typing reboot and wait until you can connect to it again.
To confirm that the partition size has increased, type df -k again.
There should be a lot more space free now! The example below shows that there are around 26229752 blocks of 1 kbyte available. That's about 26 Gbytes of free space (this example used a 32 Gbyte micro SD card).
Connecting to a Wireless Network
If you’re using a BBB-Wireless, you can do this step if desired. Otherwise, skip to the next step!
The steps here will configure the BBB-Wireless to connect to a 2.4GHz wireless LAN (WLAN).
Type:
connmanctl
You may see an error concerning VPN. Ignore it, and at the new connmanctl> prompt, type:
enable wifi scan wifi services agent on connect wifi_xxxxx_managed_psk
Type the wifi password as requested, and then despite the prompt appearing, wait a moment for a Connected message. You may have to wait 30 seconds or so. Then, type
quit
To confirm the wireless IP address, type
ifconfig -a
Search for the text wlan0, and the IP address should be there, for instance:
inet 192.168.1.210
Now there is no need to use the USB cable for future connections. The wireless interface can be used instead.
Connecting to Ethernet
Plug in an Ethernet cable to the BBB (the PocketBeagle doesn't have this, nor do some of the other BeagleBone variants), and plug the other end into a home switch/router.
On the BBB, type:
ifconfig -a
Search for the text eth0 and the IP address should appear there too. From now on, that IP address can be used to connect to the BBB, and the USB cable is not needed. However, if you should ever forget the IP address, you can always use the USB cable, and connect to the 192.168.7.2 IP address.
Problems? Use the Serial Console
If there is Linux install or connection issue, it is possible to see what the BBB’s bootloader is doing, and also how far Linux has got with its execution, by examining the serial console output. To do that, connect a 3.3V USB UART cable to the 6-pin header on the BBB (it may be labelled J1 on some BeagleBones. In any case, there is only one 6-pin header so it is easy to find). Pin 1 has a square solder pad on the underside, the remainder pads are circular.
The communications pins and direction of data is:
Pin 1 (the square solder pad on the underside) is 0V. Pin 4 receives data from the PC, and pin 5 transmits data to the PC.
A suitable USB UART cablesuitable USB UART cable has six pins. Four of them are used. Connect the black, orange and yellow wires as shown above. There is also a red wire that needs connecting to 3.3V.
If your USB serial interface needs a 3.3V power source, or needs to see a voltage to identify the logic levels, then connect that pin to the 46-way P9 header pin 4 (for convenience, you may wish to permanently solder a wire on the underside of the BBB, from P9 pin 4 to the 6-way header pin 2, since pin 2 is not connected to anything).
On your PC, use serial communication software (PuTTY can be used for this) and set to 115200 baud, and then power up the BBB. You should see some output, and hopefully it can assist in troubleshooting.
Summary
This blog post described the bits and pieces, and software needed to get the BeagleBone Black running.
Hopefully after these steps are complete, the BBB is working, and you're able to log in to a Linux command shell.
Thanks for reading!
Top Comments