Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Programming the BeagleBone

You're reading from  Programming the BeagleBone

Product type Book
Published in Jan 2016
Publisher
ISBN-13 9781784390013
Pages 180 pages
Edition 1st Edition
Languages

Table of Contents (21) Chapters

Programming the BeagleBone
Credits
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Preface
1. Cloud9 IDE 2. Blinking Onboard LEDs 3. Blinking External LEDs 4. Controlling LED Using a Push Button 5. Reading from Analog Sensors 6. PWM – Writing Analog Information 7. Internet of Things with BeagleBone 8. Physical Computing in Python 9. UART, I2C, and SPI Programming 10. Internet of Things using Python GPIO Control in Bash BeagleBone Capes
Pinmux and the Device Tree Index

Installing Debian image on SD card


Now that we know about our hardware, let's install OS. BeagleBone Black and BeagleBone Green come preinstalled with Debian Linux on emmc storage. BeagleBone also supports booting from OS on an SD card. We can use a Linux setup on emmc for exercises in this book. But it is always better to install OS on SD card and boot from it. In case of wrong configuration or unexpected problems, we can install Debian image and start hacking again. Also, it is easier to copy-paste files on an SD card to and from a PC.

The BeagleBone wiki page has a list of OS known to be working on BeagleBone: http://elinux.org/BeagleBone_Operating_Systems. It includes Android, Ubuntu, Angstrom, Minix, WinCE, and so on. Officially Linux distribution Debian is supported. All exercises in this book are tested on a wheezy 7.9 Debian image provided by beagleboard.org. Still there should be no problem running these exercises on other Debian versions. Debian is a popular Linux distribution in the embedded world. It is one of the oldest and largest Linux distributions. There are more than 100 Linux distributions derived from Debian. Debian's stable branch is known to be one of the best-tested and most bug-free distribution. There are many cases of machines that run for over a year without rebooting. This is important for unattended embedded systems. Debian has thousands of installable packages. It uses APT (Advanced Package Tool) using deb packages. You can get more information about Debian on http://debian.org.

When you connect the BeagleBone to PC using a USB-to-MiniUSB cable (Micro USB for BeagleBone Green), it gets detected as flash drive providing you with a local copy of the documentation and drivers. When it autoruns, you see the browser opened with the page Getting Started. If it does not run automatically, you can manually open the file START.htm or the README.htm file inside the BeagleBone flash drive. This HTML page has a link to "update to latest software" on the left. It provides you with a step-by-step procedure with screenshots to install the latest prebuilt Debian image on the SD card. An online version of this webpage is available at: http://beagleboard.org/getting-started#update.

Here are the important steps to install the latest Debian image on the BeagleBone:

  1. Latest supported images of all BeagleBoards are available at http://beagleboard.org/latest-images. Download a Debian image for BeagleBone on your PC. The same image works on BeagleBone White, Black and Green.

  2. These images come compressed. On a Linux system you can extract it by right-clicking to that file in File Manager and choosing Extract Here. On a Windows system, you can extract it using decompression software 7zip available at http://www.7-zip.org/download.html.You will get an .img file. This is an actual image file.

  3. Now, attach a USB SD card reader to your PC. On a Linux system, you can dump an .img file on a SD card using the following command. You need to find the name of the SD card file. You can get that in dmesg command output after you connect the SD card. Put that in place of sdx in command.

    sudo dd  if=<image_file_path> of=/dev/sdx bs=1M ; sync
    

    On a Windows system, you can use image writer software like win32diskimager, available at: http://sourceforge.net/projects/win32diskimager/files/latest/download. Select .img file and correct the SD card drive and click the write button to dump an image on the SD card.

    Note

    Warning: Be careful when selecting and formatting SD card files/drives. The wrong selection for an SD card can damage data on other storage.

  4. Push this SD card in the BeagleBone SD card holder. Give power supply to the board and you should see user LEDs blinking, which is sign of life. In case you want to make sure you are booting from the SD card and not emmc, get shell access (covered in the next topic) and edit files /etc/issue and /etc/issue.net on the SD card to print that it is booted from the SD card. The next the shell access login will show that message.

You have been reading a chapter from
Programming the BeagleBone
Published in: Jan 2016 Publisher: ISBN-13: 9781784390013
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}