Raspberry Pi Computer Architecture Essentials
eBook - ePub

Raspberry Pi Computer Architecture Essentials

Andrew K. Dennis

Share book
  1. 232 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Raspberry Pi Computer Architecture Essentials

Andrew K. Dennis

Book details
Book preview
Table of contents
Citations

About This Book

Explore Raspberry Pi's architecture through innovative and fun projects

About This Book

  • Explore Raspberry Pi 2's hardware through the Assembly, C/C++, and Python programming languages
  • Experiment with connecting electronics up to your Raspberry Pi 2 and interacting with them through software
  • Learn about the Raspberry Pi 2 architecture and Raspbian operating system through innovative projects

Who This Book Is For

Raspberry Pi Computer Architecture Essentials is for those who are new and those who are familiar with the Raspberry Pi. Each topic builds upon earlier ones to provide you with a guide to Raspberry Pi's architecture. From the novice to the expert, there is something for everyone. A basic knowledge of programming and Linux would be helpful but is not required.

What You Will Learn

  • Set up your Raspberry Pi 2 and learn about its hardware
  • Write basic programs in Assembly Language to learn about the ARM architecture
  • Use C and C++ to interact with electronic components
  • Find out about the Python language and how to use it to build web applications
  • Interact with third-party microcontrollers
  • Experiment with graphics and audio programming
  • Expand Raspberry Pi 2's storage mechanism by using external devices
  • Discover Raspberry Pi 2's GPIO pins and how to interact with them

In Detail

With the release of the Raspberry Pi 2, a new series of the popular compact computer is available for you to build cheap, exciting projects and learn about programming.

In this book, we explore Raspberry Pi 2's hardware through a number of projects in a variety of programming languages. We will start by exploring the various hardware components in detail, which will provide a base for the programming projects and guide you through setting up the tools for Assembler, C/C++, and Python. We will then learn how to write multi-threaded applications and Raspberry Pi 2's multi-core processor. Moving on, you'll get hands on by expanding the storage options of the Raspberry Pi beyond the SD card and interacting with the graphics hardware. Furthermore, you will be introduced to the basics of sound programming while expanding upon your knowledge of Python to build a web server. Finally, you will learn to interact with the third-party microcontrollers.

From writing your first Assembly Language application to programming graphics, this title guides you through the essentials.

Style and approach

This book takes a step-by-step approach to exploring Raspberry Pi's architecture through projects that build upon each other. Each project provides you with new information on how to interact with an aspect of the Raspberry Pi and Raspbian operating system, providing a well-rounded guide.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Raspberry Pi Computer Architecture Essentials an online PDF/ePUB?
Yes, you can access Raspberry Pi Computer Architecture Essentials by Andrew K. Dennis in PDF and/or ePUB format, as well as other popular books in Computer Science & Hardware. We have over one million books available in our catalogue for you to explore.

Information

Year
2016
ISBN
9781784397975
Edition
1

Raspberry Pi Computer Architecture Essentials


Table of Contents

Raspberry Pi Computer Architecture Essentials
Credits
About the Author
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Introduction to the Raspberry Pi's Architecture and Setup
History and background of the Raspberry Pi
Raspberry Pi hardware specifications
Dimensions
System on Chip
CPU
GPU
SDRAM
4 USB 2.0 ports and 1 SoC on-board USB
MicroSD card port
Ethernet port
Audio
GPIO pins
Video – analog TV out
Video – HDMI port
Basic hardware needed
The microSD card – the main storage and boot device of the Raspberry Pi 2
Preinstalled microSD card versus creating your own
The NOOBS operating system installation manager
Downloading the latest version of Raspbian
Setting up your microSD card and installing the Raspbian operating system
Raspbian installation wrap-up
Check SSH is running
RSA key generation for SSH
Linux and Mac RSA key generation
Windows RSA key generation
Assign a static IP to your Raspberry Pi 2
Installing Screen and Vim
Vim – an optional handy text editor
Running tests on the OS and configuration changes
Diagnostic tests
Over and underclocking the Raspberry Pi
Going further – testing the GPIO pins
Some handy Linux commands
Troubleshooting
Summary
2. Programming on Raspbian
Which programming languages?
Assembly language
Assembling and linking
The C and C++ languages
C – a brief introduction
A quick look at C++
Our first C program
Geany – a handy text editor and development environment
Creating a new C program
C libraries – a trove of reusable code
The C (and C++) compiler
Compiling and running our application
The Python language
A simple Python program
Running a Python program from a file
Summary
3. Low-Level Development with Assembly Language
Back to basics
Multiline comments
Directives
Single line comments
Registers
Branching
The assembler
The linker
Makefiles
Memory and addresses
The .data directive
The .balign directive
Words
Labels
The memory
The addresses
LDR and SUB
Running our program
Adding power to our program – control structures
If else statements
Iteration
Testing our control structures
Summary
4. Multithreaded Applications with C/C++
What are threads?
Thread types
User level threads
Kernel level threads
Hybrid threads
POSIX threads
Steps involved in implementing threads
Creation and termination
Synchronization
Scheduling
An example in C
Trying out our program
A C++ equivalent
The g++ command
Going further – mutexes and joins
Compile and test
Summary
5. Expanding on Storage Options
Booting up
Setting up the external HDD
Getting the disk name
Setting up the HDD
Modifying cmdline.txt
Network-attached storage (NAS)
Installing Samba
Testing the NAS
Mac
Linux
Windows
Summary
6. Low-Level Graphics Programming
VideoCore IV GPU
Sample programs
Accessing the frame buffer
Check the display settings
Testing our C code
Filling the screen with a color
A C program to turn the screen red
Compile and run the C program
Drawing a line
Plotting pixels and drawing lines
Compile and run
Next steps – polygons
Summary
7. Exploring the Raspberry Pi's GPIO Pins
Introduction to GPIO pins
Standard GPIO
I2C
Serial Rx and Tx
SPI
PWM and PPM
GPIO power voltages
Hardware choices
Prototyping shields and boards
Cooking Hacks Arduino bridge shield
Connecting directly to the GPIO pins
Switching an LED on and off
Setting up the hardware
C blinking LED program
Python blinking LED program
Reading data from the GPIO pins in Python
Summary
8. Exploring Sound with the Raspberry Pi 2
Introduction to the Raspberry Pi's sound
Configuring the audio output
Setting the audio output
Interacting with audio through GPIO
Installing the audio drivers
Hardware setup
Loading drivers
Getting some drum tracks
Python drum machine
Audio shields for the Raspberry Pi
C and ALSA
ALSA examples
Introducing Sonic Pi
Setup
Experimenting with Sonic Pi
Summary
9. Building a Web Server
Introduction to web servers
HTTP requests
HTML
Popular web servers available on the Raspberry Pi
Apache
NGINX
Building a Python web server
Python web server code
Adding an index page and a favicon
Adding database support
SQLite
SQL – a quick overview
Python program with SQLite support
Flask – displaying database data via Python
Next steps
Summary
10. Integrating with Third-Party Microcontrollers
Genuino/Arduino microcontroller
Setting up the Arduino software
Installing the IDE on your Raspberry Pi 2
A quick guide to the Arduino IDE
Integration with Arduino
Serial communication over USB
Communication between the Arduino and Raspberry Pi via GPIO
Communication over I2C
Communication over the Web
Summary
11. Final Project
Choose your storage mechanism
Building a Flask-based website
Adding a database
A basic website
Web forms
Add
Edit
Adding in an LED
Building the circuit – a recap
Integrating with our Python app
Extending the project further
Replace the LED with a screen
E-mail support
Playing a sound
Summary
Index

Raspberry Pi Computer Architecture Essentials

Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be ...

Table of contents