Introduction

This is the chapter web page to support the content in Chapter 2 of the book: Exploring BeagleBone – Tools and Techniques for Building with Embedded Linux. The summary introduction to the chapter is as follows:

In this chapter, you are introduced to the Linux operating system and software tools that can be used with the Beagle boards. This chapter aims to ensure that you can connect to your board and control it. By the end of this chapter you should be able to ‘blink’ a system LED having followed a step-by-step guide that demonstrates how you can use Linux shell commands in a Linux terminal window. In this chapter, you are also introduced to a library of software functions, called BoneScript, which can be used with Node.js and the Cloud9 integrated development environment to build code that flashes the same system LED.

Learning Outcomes

After completing this chapter, you should be able to:

  • Communicate with the BBB from your desktop computer using network connections such as Internet‐over‐USB and regular Ethernet.
  • Communicate with the BBB using fallback serial connections such as Serial‐over‐USB or by using a custom USB‐to‐TTL 3.3 V cable.
  • Interact with and control the BBB using simple Linux commands.
  • Perform basic file editing using a Linux terminal.
  • Manage Linux packages and set the system time.
  • Use Linux sysfs to affect the state of BBB hardware.
  • Safely shut down and reboot the BBB.
  • Use Node.js, Cloud9, and BoneScript to write basic applications and code that interacts with BBB hardware.

If you are installing the BeagleBone Black under recent images under Windows then you should not have problems with drivers. If you do, please ensure that you use the latest certified drivers, which are available from: Install the certified drivers directly from: https://github.com/beagleboard/beaglebone-getting-started/tree/master/Drivers/Windows

This book has been written and tested using the Debian 9.5 2018-10-7 release (See beagleboard.org/latest-images). It is recommended that you work through the book using this image and then update to the latest image once you have completed the book.

Changes to the U-boot Partitioning Layout

On page 26 of Edition 1 there is a note to warn you not to alter the MLO, u-boot.img and uEnv.txt files on the FAT partition. As of Linux 3.8.13-bone70 that is no longer an issue. These files were moved to create a more distribution friendly default bootloader. As alluded to in the note on page 26, you can now find these files in the /boot directory on the main Linux partition:

root@beaglebone:~# uname -a
Linux beaglebone 3.8.13-bone70 #1 SMP Fri Jan 23 02:15:42 UTC 2015 armv7l GNU/Linux
root@beaglebone:~# cd /boot
root@beaglebone:/boot# ls
SOC.sh dtbs uboot
System.map-3.8.13-bone70 initrd.img-3.8.13-bone70 vmlinuz-3.8.13-bone70
config-3.8.13-bone70 uEnv.txt

It is not necessary to use these files at this point in the book, but please note this fact for future reference, particularly when performing tasks such as disabling the HDMI overlay by editing the uEnv.txt file.

Digital Media Resources

Here the digital resources referred to in the chapter web page are provided. There are high-resolution versions of some of the important figures and links to videos, resources and websites that are described in the chapter.

Source Code

Octocat_smallAll of the source code that is described in this book is available in a public GitHub repository: Derek Molloy Exploring BeagleBone repository.

You can clone this repository on a Linux desktop computer or your BeagleBone using the command:

git clone https://github.com/derekmolloy/exploringBB.git

You can also install a Windows GitHub desktop application or a Mac OS X GitHub desktop application. Alternatively, you can download a full ZIP archive of the code using the following link: Download Source Code (this is a live link that automatically provides you with the very latest files). The Source Code web page lists all recent updates to this repository.

There is only a small amount of code in this chapter that is related to Node.js using the Cloud9 IDE. The code can be accessed in the chp02 folder of the cloned repository. The formatted code is provided here for your convenience.

HelloWorld.js

Listing 2-1: HelloWorld.js
console.log("Hello World!");

SimpleWebServer.js

Listing 2-2: SimpleWebServer.js
// A Simple Example Node.js Webserver Running on Port 5050
// Written by Derek Molloy for the book "Exploring BeagleBone: Tools and 
// Techniques for Building with Embedded Linux" by John Wiley & Sons, 2014
// ISBN 9781118935125. Please see the file README.md in the repository root 
// directory for copyright and GNU GPLv3 license information.   

var http = require('http');  // require the http module
var server = http.createServer(
    function (req, res) {
        res.writeHead(200, {'Content-Type': 'text/plain'});
        res.end('Hello from the BeagleBone Black!\n');
    });
server.listen(5050);
console.log('BBB Web Server running at http://192.168.7.2:5050/');

BlinkLED3.js

Listing 2-3: BlinkLED3.js
// Example application for flashing an LED using BoneScript
// Written by Derek Molloy for the book "Exploring BeagleBone: Tools and 
// Techniques for Building with Embedded Linux" by John Wiley & Sons, 2014
// ISBN 9781118935125. Please see the file README.md in the repository root 
// directory for copyright and GNU GPLv3 license information.   

var b = require('bonescript'); //using BoneScript
var LED3Pin = "USR3";          //USR3 is D5 on the BBB

b.pinMode(LED3Pin, b.OUTPUT);  //set up LED3Pin as an output
var isOn = false;              //isOn will be a Boolean flag
setInterval(toggleLED, 500);   //each half second call toggleLED()

function toggleLED() {
    isOn = !isOn;              //invert the isOn state on each call
    if (isOn) b.digitalWrite(LED3Pin, 1);  //light the LED
    else b.digitalWrite(LED3Pin, 0);       //turn off the LED
    console.log('LED On is: ' + isOn);     //output the state
}

Related Video

Getting started with Internet-over-USB

The chapter web page includes a video on getting started with Internet‐over‐USB

External Resources

Zenmap application

Zenmap is described in the chapter as a tool for scanning your network to find a network-attached BeagleBone. You are searching for an entry that has three to five open ports (e.g., 22 for SSH, 80 for the BBB guide, 8080 for the Apache web server, and 3000 for the Cloud 9 IDE). It may also identify itself with Texas Instruments. You can see the Zenmap application in action in the image to the left where 192.168.1.25 is the location of the BeagleBone on my network.

Important Documents

External Web Sites

AM335x ARM A8 Technical Reference Manual

The AM335x Technical Reference Manual (TRM)

BeagleBone Black System Reference Manual

The BeagleBone Black System Reference Manual (SRM)

The BeagleBoard.org website provides the main support for this platform, with software guides, community links, and downloads to support your development. An excellent “Getting Started” guide and blog is available at the website

Recommended Books on the Content in this Chapter:

[amazon asin=1449345379&template=Iframe Image] [amazon asin=0071832122&template=Iframe Image] [amazon asin=1118992911&template=Iframe Image][amazon asin=1430265957&template=Iframe Image] [amazon asin=1617290939&template=Iframe Image] [amazon asin=1937785734&template=Iframe Image]

Errata

None for the moment.