John Wiley & Sons Exploring BeagleBone Cover In-depth instruction and practical techniques for building with the BeagleBone embedded Linux platfo.. Product #: 978-1-119-53316-0 Regular price: $35.42 $35.42 Auf Lager

Exploring BeagleBone

Tools and Techniques for Building with Embedded Linux

Molloy, Derek

Cover

2. Auflage März 2019
800 Seiten, Softcover
Praktikerbuch

ISBN: 978-1-119-53316-0
John Wiley & Sons

Kurzbeschreibung

In-depth instruction and practical techniques for building with the BeagleBone embedded Linux platform

Exploring BeagleBone is a hands-on guide to bringing gadgets, gizmos, and robots to life using the popular BeagleBone embedded Linux platform. Comprehensive content and deep detail provide more than just a BeagleBone instruction manual - you'll also learn the underlying engineering techniques that will allow you to create your own projects. The book begins with a foundational primer on essential skills, and then gradually moves into communication, control, and advanced applications using C/C++, allowing you to learn at your own pace. The book also includes a companion website featuring instructional videos, source code, a discussion forum, and more, to ensure that you have everything you need. With Exploring BeagleBone, you'll:
* Get up to speed on embedded Linux, electronics, and programming
* Master interfacing electronic circuits, buses, and modules with practical examples
* Explore the Internet-connected BeagleBone and the BeagleBone with a display
* Apply the BeagleBone to sensing applications, including video and sound
* Discover the BeagleBone's Programmable Real-Time Controllers

Insightful guidance and online peer support help you master the techniques presented in Exploring BeagleBone, the practical handbook for this popular computing platform.

Jetzt kaufen

Preis: 37,90 €

Preis inkl. MwSt, zzgl. Versand

Weitere Versionen

epubmobipdf

In-depth instruction and practical techniques for building with the BeagleBone embedded Linux platform

Exploring BeagleBone is a hands-on guide to bringing gadgets, gizmos, and robots to life using the popular BeagleBone embedded Linux platform. Comprehensive content and deep detail provide more than just a BeagleBone instruction manual-you'll also learn the underlying engineering techniques that will allow you to create your own projects. The book begins with a foundational primer on essential skills, and then gradually moves into communication, control, and advanced applications using C/C++, allowing you to learn at your own pace. In addition, the book's companion website features instructional videos, source code, discussion forums, and more, to ensure that you have everything you need.

The BeagleBone's small size, high performance, low cost, and extreme adaptability have made it a favorite development platform, and the Linux software base allows for complex yet flexible functionality. The BeagleBone has applications in smart buildings, robot control, environmental sensing, to name a few; and, expansion boards and peripherals dramatically increase the possibilities. Exploring BeagleBone provides a reader-friendly guide to the device, including a crash course in computer engineering. While following step by step, you can:
* Get up to speed on embedded Linux, electronics, and programming
* Master interfacing electronic circuits, buses and modules, with practical examples
* Explore the Internet-connected BeagleBone and the BeagleBone with a display
* Apply the BeagleBone to sensing applications, including video and sound
* Explore the BeagleBone's Programmable Real-Time Controllers
* Updated to cover the latest Beagle boards, Linux kernel versions, and Linux software releases.
* Includes new content on Linux kernel development, the Linux Remote Processor Framework, CAN bus, IoT frameworks, and much more!

Hands-on learning helps ensure that your new skills stay with you, allowing you to design with electronics, modules, or peripherals even beyond the BeagleBone. Insightful guidance and online peer support help you transition from beginner to expert as you master the techniques presented in Exploring BeagleBone, the practical handbook for the popular computing platform.

Introduction xxix

Part I Beagle Board Basics 1

Chapter 1 The Beagle Hardware Platform 3

Introduction to the Boards 3

Who Should Use the Beagle Platform 6

When to Use Beagle Boards 7

When Should You Not Use the Beagle Boards 7

BeagleBone Documentation 8

The Beagle Hardware 10

BeagleBone Versions 10

The Beagle Hardware 12

Beagle Accessories 19

Highly Recommended Accessories 19

Headers for the PocketBeagle 20

Micro-SD Card (for Booting or Flashing eMMCs) 20

External 5V Power Supply (for Peripherals) 22

Ethernet Cable (for Wired BBB Network Connection) 22

HDMI Cable (for Connection to Monitors/Televisions) 22

USB to Serial UART TTL 3.3 (for Finding Problems) 23

Optional Accessories 24

USB Hub (to Connect Several USB Devices to a USB Host) 25

Micro-HDMI to VGA Adapters (for VGA Video and Sound) 25

Wi-Fi Adapters (for Wireless Networking) 25

USB Webcam (for Capturing Images and Streaming Video) 25

USB Keyboard and Mouse (for General-Purpose Computing) 26

Capes 26

How to Destroy Your Board! 27

Summary 29

Support 29

Chapter 2 Beagle Software 31

Linux on the Beagle Boards 32

Linux Distributions for Beagle Boards 32

Create a Linux Micro-SD Card Image 33

Communicating with the Boards 34

Installing Drivers 34

Wired Network Connections 35

Internet-over-USB (All Boards) 36

Regular Ethernet (BBB and BeagleBoard Only) 39

Ethernet Crossover Cable (BBB and BeagleBoard Only) 40

Communicating with Your Board 42

Serial Connection over USB 42

Serial Connection with the USB-to-TTL 3.3 V Cable 43

Connecting Through Secure Shell 44

Secure Shell Connections Using Putty 45

Chrome Apps: Secure Shell Client 45

Transferring Files Using Putty/psftp over SSH 46

Controlling the Beagle Board 48

Basic Linux Commands 48

First Steps 49

Basic File System Commands 50

Environment Variables 52

Basic File Editing 53

What Time Is It? 54

Package Management 56

Beagle-Specific Commands 58

Expand the File System on an SD Card 59

Update the Kernel 60

Interacting with the On-Board LEDs 61

Shutdown 63

Node.js, Cloud9, and BoneScript 64

Introduction to Node.js 64

Introduction to the Cloud9 IDE 66

Introduction to BoneScript 67

Summary 69

Further Reading 69

Chapter 3 Exploring Embedded Linux Systems 71

Introducing Embedded Linux 72

Advantages and Disadvantages of Embedded Linux 73

Is Linux Open Source and Free? 74

Booting the Beagle Boards 74

Bootloaders 74

Kernel Space and User Space 83

The systemd System and Service Manager 85

Managing Linux Systems 90

The Superuser 90

System Administration 92

The Linux File System 92

Links to Files and Directories 94

Users and Groups 95

File System Permissions 98

The Linux Root Directory 102

Commands for File Systems 103

The Reliability of SD Card/eMMC File Systems 111

Linux Commands 113

Output and Input Redirection (>, >>, and

Pipes (| and tee) 114

Filter Commands (from sort to xargs) 115

echo and cat 117

diff 118

tar 119

md5sum 120

Linux Processes 121

How to Control Linux Processes 121

Foreground and Background Processes 122

Other Linux Topics 124

Using Git for Version Control 124

A Practice-Based Introduction 126

Cloning a Repository (git clone) 126

Getting the Status (git status) 128

Adding to the Staging Area (git add) 128

Committing to the Local Repository (git commit) 129

Pushing to the Remote Repository (git push) 129

Git Branching 130

Creating a Branch (git branch) 130

Merging a Branch (git merge) 132

Deleting a Branch (git branch -d) 132

Common Git Commands 133

Desktop Virtualization 134

Code for This Book 135

Summary 136

Further Reading 136

Bibliography 137

Chapter 4 Interfacing Electronics 139

Analyzing Your Circuits 140

Digital Multimeter 140

Oscilloscopes 141

Basic Circuit Principles 143

Voltage, Current, Resistance, and Ohm's Law 143

Voltage Division 145

Current Division 146

Implementing Circuits on a Breadboard 147

Digital Multimeters and Breadboards 149

Example Circuit: Voltage Regulation 150

Discrete Components 152

Diodes 152

Light-Emitting Diodes 153

Smoothing and Decoupling Capacitors 156

Transistors 158

Transistors as Switches 159

Field Effect Transistors as Switches 162

Optocouplers/Optoisolators 164

Switches and Buttons 166

Hysteresis 168

Logic Gates 169

Floating Inputs 173

Pull-Up and Pull-Down Resistors 173

Open-Collector and Open-Drain Outputs 174

Interconnecting Gates 175

Analog-to-Digital Conversion 177

Sampling Rate 177

Quantization 178

Operational Amplifi ers 178

Ideal Operational Amplifiers 178

Negative Feedback and Voltage Follower 181

Positive Feedback 181

Concluding Advice 182

Summary 182

Further Reading 183

Chapter 5 Practical Beagle Board Programming 185

Introduction 186

Performance of Different Languages 186

Setting the CPU Frequency 190

Scripting Languages 192

Scripting Language Options 192

Bash 193

Lua 196

Perl 197

Python 198

Dynamically Compiled Languages 201

JavaScript and Node.js on the Beagle boards 201

Java on the Beagle Boards 203

C and C++ on the Beagle Boards 207

C and C++ Language Overview 210

Compiling and Linking 211

Writing the Shortest C/C++ Program 213

Static and Dynamic Compilation 215

Variables and Operators in C/C++ 215

Pointers in C/C++ 219

C-Style Strings 221

LED Flashing Application in C 223

The C of C++ 224

First Example and Strings in C++ 225

Passing by Value, Pointer, and Reference 226

Flashing the LEDs Using C++ (non-OO) 227

Writing a Multicall Binary 228

Overview of Object-Oriented Programming 229

Classes and Objects 229

Encapsulation 230

Inheritance 231

Object-Oriented LED Flashing Code 233

Interfacing to the Linux OS 236

Glibc and Syscall 237

Improving the Performance of Python 239

Cython 239

Boost.Python 242

Summary 244

Further Reading 244

Bibliography 244

Part II Interfacing, Controlling, and Communicating 245

Chapter 6 Interfacing to the Beagle Board Input/Outputs 247

General-Purpose Input/Outputs 248

Introduction to GPIO Interfacing 248

GPIO Digital Output 250

GPIO Digital Input 255

GPIO Confi guration 257

Internal Pull-Up and Pull-Down Resistors 258

GPIO Pin Configuration Settings 258

Interfacing to Powered DC Circuits 265

C++ Control of GPIOs 267

The Linux Device Tree 271

Flattened Device Tree on the Beagle Boards 272

Modifying a Board Device Tree 276

Boot Confi guration Files 278

Analog Inputs and Outputs 280

Analog Inputs 280

Enabling the Analog Inputs 280

Analog Input Application--A Simple Light Meter 282

Analog Outputs (PWM) 285

Output Application--Controlling a Servo Motor 289

BoneScript 290

Digital Read and Write 290

Analog Read 292

Analog Write (PWM) 293

GPIO Performance 294

Advanced GPIO Topics 295

More C++ Programming 295

Callback Functions 295

POSIX Threads 297

Linux poll (sys/poll.h) 298

Enhanced GPIO Class 299

Using GPIOs without Using sudo 302

Root Permissions with setuid 304

Summary 306

Further Reading 306

Chapter 7 Cross-Compilation, Eclipse, and Building Linux 307

Setting Up a Cross-Compilation Toolchain 308

Cross-Compiling Under Debian 309

Testing the Toolchain 311

Emulating the armhf Architecture 312

Cross-Compilation with Third-Party Libraries (Multiarch) 314

Cross-Compilation Using Eclipse 315

Installing Eclipse on Desktop Linux 315

Confi guring Eclipse for Cross-Compilation 316

Remote System Explorer 318

Integrating GitHub into Eclipse 322

Remote Debugging 322

Automatic Documentation (Doxygen) 328

Adding Doxygen Editor Support in Eclipse 330

Cross-Building Linux 330

Downloading the Kernel Source 331

Building the Linux Kernel 332

Building a Poky Linux Distribution (Advanced) 335

Summary 340

Chapter 8 Interfacing to the Beagle Board Buses 341

Introduction to Bus Communication 342

I2C 343

I2C Hardware 343

I2C on the Beagle Boards 344

I2C Devices on the Beagle Boards 345

An I2C Test Circuit 346

A Real-Time Clock 346

The ADXL345 Accelerometer 347

Wiring the Test Circuit 348

Using Linux I2C-Tools 348

i2cdetect 348

i2cdump 349

i2cget 353

i2cset 354

I2C Communication in C 356

Wrapping I2C Devices with C++ Classes 358

SPI 360

SPI Hardware 361

SPI on the Beagle Boards 363

Testing an SPI Bus 363

A First SPI Application (74HC595) 365

Wiring the 74HC595 Circuit 366

SPI Communication Using C 367

Bidirectional SPI Communication in C/C++ 370

The ADXL345 SPI Interface 370

Connecting the ADXL345 to the Beagle Boards 372

Wrapping SPI Devices with C++ Classes 373

Three-Wire SPI Communication 375

Multiple SPI Slave Devices 376

UART 377

The Beagle Board UART 378

UART Examples in C 380

Beagle Board Serial Client 381

LED Serial Server 383

UART Applications: GPS 386

CAN Bus 388

Beagle Board CAN Bus 389

SocketCAN 390

A CAN Bus Test Circuit 392

Linux CAN-utils 393

A SocketCAN C Example 394

Logic-Level Translation 396

Summary 398

Further Reading 399

Chapter 9 Interacting with the Physical Environment 401

Interfacing to Actuators 402

DC Motors 403

Driving Small DC Motors (up to 1.5 A) 406

Controlling a DC Motor Using sysfs 407

Driving Larger DC Motors (Greater Than 1.5 A) 409

Controlling a DC Motor Using C++ 411

Stepper Motors 412

The EasyDriver Stepper Motor Driver 413

A Beagle Board Stepper Motor Driver Circuit 414

Controlling a Stepper Motor Using C++ 415

Relays 417

Interfacing to Analog Sensors 418

Protecting the ADC Inputs 420

Diode Clamping 421

Op-Amp Clamping 422

Analog Sensor Signal Conditioning 427

Scaling Using Voltage Division 427

Signal Offsetting and Scaling 428

Analog Interfacing Examples 431

Infrared Distance Sensing 431

ADXL335 Conditioning Example 436

Interfacing to Local Displays 438

MAX7219 Display Modules 438

Character LCD Modules 441

Building C/C++ Libraries 445

Makefi les 446

CMake 447

A Hello World Example 448

Building a C/C++ Library 449

Using a Shared (.so) or Static (.a) Library 452

Summary 453

Further Reading 454

Chapter 10 Real-Time Interfacing Using External Slave Processors 455

Real-Time Beagle Board 456

Real-Time Kernels 456

Real-Time Hardware Solutions 458

Extended GPIO Availability 458

The MCP23017 and the I2C Bus 460

Controlling the GPIO LED Circuit 461

Reading the GPIO Button State 462

An Interrupt Configuration Example (Advanced) 463

The MCP23S17 and the SPI Bus 464

A C++ Class for the MCP23x17 Devices 465

Adding External UARTs 468

The Arduino 471

An Arduino Serial Slave 474

A UART Echo Test Example 475

UART Command Control of an Arduino 478

An Arduino I2C Slave 481

An I2C Test Circuit 481

I2C Register Echo Example 482

I2C Temperature Sensor Example 484

I2C Temperature Sensor with a Warning LED 486

Arduino Slave Communication Using C/C++ 488

An I2C Ultrasonic Sensor Application 490

Summary 493

Further Reading 493

Part III Advanced Beagle Board Systems 495

Chapter 11 The Internet of Things 497

The Internet of Things 498

A Beagle Board IoT Sensor 499

The Beagle Board as a Sensor Web Server 501

Installing and Configuring a Web Server 502

Configuring the Apache Web Server 503

Creating Web Pages and Web Scripts 503

PHP on the Beagle Board 506

GNU Cgicc Applications (Advanced) 508

Replacing Bone101 with Apache 511

A C/C++ Web Client 512

Network Communications Primer 513

A C/C++ Web Client 514

Secure Communication Using Open SSL 516

A Beagle Board as a "Thing" 518

Thing Speak 518

The Linux Cron Scheduler 521

System crontab 521

User crontab 523

Sending E-mail from the Beagle Board 524

If This Then That 526

IoT Frameworks 528

MQ Telemetry Transport 529

MQTT Server/Broker 531

MQTT Publisher/Subscriber on a Beagle Board 533

The mqtt-spy Debug Tool 534

Writing MQTT Code 535

A Paho MQTT Publisher Example 535

A Paho MQTT Subscriber Example 537

Adafuit IO 539

Configuring the Adafruit IO Account 540

Connecting to Adafruit IO with MQTT 542

An MQTT Node.js Publish Example 543

The C++ Client/Server 545

IoT Device Management 548

Remote Monitoring of a Beagle Board 548

Beagle Board Watchdog Timers 549

Static IP Addresses 551

Power over Ethernet 551

PoE Power Extraction Modules (Advanced Topic) 553

Summary 554

Chapter 12 Wireless Communication and Control 555

Introduction to Wireless Communications 556

Bluetooth Communications 557

Installing a Bluetooth Adapter 558

Checking the LKM 559

Configuring a Bluetooth Adapter 560

Making the Beagle Board Discoverable 561

Android App Development with Bluetooth 563

Wi-Fi Communications 564

Installing a Wi-Fi Adapter 564

The NodeMCU Wi-Fi Slave Processor 568

Flashing with the Latest Firmware 569

Connecting the NodeMCU to Wi-Fi 570

Programming the NodeMCU 571

The NodeMCU Web Server Interface 574

JSON 575

The NodeMCU and MQTT 577

ZigBee Communications 579

Introduction to XBee Devices 579

AT versus API Mode 581

XBee Confi guration 582

XCTU 582

Configuring an XBee Network Using XCTU 583

An XBee AT Mode Example 584

Setting Up the Arduino XBee Device (XBeeA) 584

Setting Up the PocketBeagle XBee Device (XBeePB) 586

An XBee API Mode Example 589

Setting Up the PocketBeagle XBee Device (XBee1) 589

Setting Up the Stand-Alone XBee Device (XBee2) 589

XBee API Mode and Node.js 590

XBee and C/C++ 592

Near Field Communication 593

Summary 596

Chapter 13 Beagle Board with a Rich User Interface 599

Rich UI Beagle Board Architectures 600

Beagle Boards as General-Purpose Computers 601

Connecting a Bluetooth Input Peripheral 603

BeagleBone with a LCD Touchscreen Cape 604

Virtual Network Computing 605

VNC Using VNC Viewer 605

VNC with Xming and PuTTY 606

VNC with a Linux Desktop Computer 607

Fat-Client Applications 608

Rich UI Application Development 608

Introduction to GTK+ on the Beagle Boards 609

The "Hello World" GTK+ Application 609

The Event-Driven Programming Model 610

The GTK+ Temperature Application 611

Introduction to Qt for the Beagle Board 612

Installing Qt Development Tools 613

The "Hello World" Qt Application 613

Qt Primer 615

Qt Concepts 615

The QObject Class 617

Signals and Slots 617

Qt Development Tools 618

A First Qt Creator Example 620

A Qt Temperature Sensor GUI Application 621

Remote UI Application Development 625

Fat-Client Qt GUI Application 626

Multithreaded Server Applications 629

A Multithreaded Temperature Service 632

Parsing Stream Data 634

The Fat Client as a Server 635

Parsing Stream Data with XML 638

The Beagle Board Client Application 639

Summary 641

Further Reading 641

Chapter 14 Images, Video, and Audio 643

Capturing Images and Video 644

USB Webcams 644

Video4Linux2 (V4L2) 646

Image Capture Utility 647

Video4Linux2 Utilities 648

Writing Video4Linux2 Programs 650

Streaming Video 652

Image Processing and Computer Vision 654

Image Processing with Open CV 654

Computer Vision with Open CV 656

Boost 659

BeagleBone Audio 660

Core Audio Software Tools 661

Audio Devices for the Beagle Boards 661

HDMI and USB Audio Playback Devices 661

Internet Radio Playback 664

Recording Audio 664

Audio Network Streaming 666

Bluetooth A2DP Audio 666

Text-to-Speech 669

Summary 670

Further Reading 670

Chapter 15 Real-Time Interfacing with the PRU-ICSS 673

The PRU-ICSS 674

The PRU-ICSS Architecture 674

The Remote Processor Framework 675

Important Documents 676

Development Tools for the PRU-ICSS 676

The PRU Code Generation Tools 677

The PRU Debugger 677

Using the AM335x PRU-ICSS 679

Setting Up the Board for Remoteproc 679

Testing Remoteproc under Linux 680

A First PRU Example 683

PRU-ICSS Enhanced GPIOs 683

A First PRU Program 686

A First PRU Program in C 686

A First PRU Program in Assembly 688

The PRU-ICSS in Detail 691

Registers 691

Local and Global Memory 692

PRU Assembly Instruction Set 696

PRU-ICSS Applications 698

PRU-ICSS Performance Tests 698

Utilizing Regular Linux GPIOs 702

A PRU PWM Generator 704

A PRU Sine Wave Generator 708

An Ultrasonic Sensor Application 709

Summary 714

Further Reading 714

Chapter 16 Embedded Kernel Programming 717

Introduction 718

Why Write Kernel Modules? 718

Loadable Kernel Module Basics 719

A First LKM Example 720

The LKM Make file 722

Building the LKM on a Beagle Board 723

Testing the First LKM Example 724

Testing the LKM Parameter 726

An Embedded LKM Example 727

Interrupt Service Routines 729

Performance 733

Enhanced Button GPIO Driver LKM 733

The object Interface 734

Enhanced LED GPIO Driver LKM 741

Kernel Threads 742

Conclusions 744

Summary 744

Index 745
Dr. Derek Molloy is an Associate Professor in the School of Electronic Engineering at Dublin City University, Ireland. Derek produces a popular YouTube series on the BeagleBone platform and a wide variety of embedded Linux topics. His videos and personal blog have introduced millions of people to the BeagleBone, embedded Linux, and digital electronics.