Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
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
← Prev
Back
Next →
← Prev
Back
Next →