Warren Gay
Advanced Raspberry Pi Raspbian Linux and GPIO Integration 2nd ed.
Warren Gay
St. Catharines, Ontario, Canada
Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the books product page, located at www.apress.com/978-1-4842-3947-6 . For more detailed information, please visit http://www.apress.com/source-code .
ISBN 978-1-4842-3947-6 e-ISBN 978-1-4842-3948-3
https://doi.org/10.1007/978-1-4842-3948-3
Library of Congress Control Number: 2018960398
Warren Gay 2018
Standar Apress
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.
Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For Jackie.
Table of Contents
About the Author and About the Technical Reviewer
About the Author
Warren Gay
started out in electronics at an early age, dragging discarded TVs and radios on his way home from public school. In high school he developed a fascination for programming the IBM 1130 computer, which resulted in a career plan change to software development. After attending Ryerson Polytechnical Institute, he has enjoyed a software developer career for over 35 years, programming mainly in C/C++. Warren has been programming Linux since 1994 as an open source contributor and professionally on various Unix platforms since 1987.
Before attending Ryerson, Warren built an Intel 8008 system from scratch before there were CP/M systems and before computers got personal. In later years, Warren earned an advanced amateur radio license (call sign VE3WWG) and worked the amateur radio satellites. A high point of his ham radio hobby was making digital contact with the Mir space station (U2MIR) in 1991.
Warren works at Datablocks.net, an enterprise-class ad serving software services company. There he programs C++ server solutions on Linux back-end systems.
About the Technical Reviewer
Martin Rothwell
has followed his interest in computers from an early age, fascinated by the magic of computers and digital electronics in general. Self-described as too curious for his own good, he would spend many of his early years tinkering with the building of computers and the programming of software. This led naturally to undertaking a degree in computer science, which was completed in 2007. Since then Martin has pursued a career in education and is currently employed as a senior lecturer at The University of Central Lancashire. His thirst for knowledge and need to satisfy his curious nature have led to a healthy obsession with maintaining active self-development.
Martin would like to thank the Raspberry Pi Foundation in general for their efforts and their Pi Academy program for helping to inspire digital making in schools and hopefully helping more of the current generation of younger makers to become fascinated, also, by the magic of computing.
Warren Gay 2018
Warren Gay Advanced Raspberry Pi https://doi.org/10.1007/978-1-4842-3948-3_1
1. The Raspberry Pi
Warren Gay
(1)
St. Catharines, Ontario, Canada
The Raspberry Pi is amazing at two levelsthe advanced functionality that you get in a credit card-sized SBC (Single Board Computer) and its price. Even with todays Pi competitors, the Raspberry Pi reigns supreme because few can beat its price. Further, it enjoys great software and community support.
Price is an important advantage of the Pi that competitors dont always appreciate. Hobbyists and makers are applying the Pi in new and sometimes risky ways. Someone starting out doesnt want to lose their SBC because of a rookie mistake. At the low Pi price point, the loss can be absorbed without losing heart. Imagine a student buying an Intel Joule1 (when it was offered) for $349 USD and toasting it by accident. That would be enough to make most people give up right there! Price allows everyone to proceed fearlessly in their learning.
SBC Inventory
Before considering the details about the resources within the Raspberry Pi, it is useful to take a high-level inventory. In this chapter, lets list what you get when you purchase a Pi.
Within this book, youll be examining each resource from two perspectives:
In some cases, the hardware will have one or more kernel modules behind it, forming the device driver layer. They expose a software API that interfaces between the application and the hardware device. For example, applications communicate with the driver by using ioctl(2) calls, while the driver communicates with the I2C devices on the bus. The /sys/class file system is another way that device drivers expose themselves to applications. Youll see this when GPIO (general purpose input/output) is examined in Chapter .
There are some cases where drivers dont exist in Raspbian Linux, requiring you to use a bare metal approach . An example of this is creating PWM signals using software. By mapping the GPIO registers into the application memory space, the desired result can be obtained directly from the application program. Both direct access and driver access have their advantages and disadvantages.
So while the summary inventory simply lists the hardware devices, youll be examining each resource in greater detail in the chapters ahead.
Models
The hardware inventory is directly affected by the model of the unit being examined. Several models have been produced over the years, starting with the Model B, followed by the Model A. Since then, several other units have become available and these are summarized in Table . Much more detail can be seen online.2