Raspberry Pi

advertisement
Cuauhtemoc Carbajal
ITESM CEM
26/02/2013
1
Raspberry Pi
W
USB 2.0 Hub and 10/100
Ethernet Controller
2
Specifications
W
3
http://en.wikipedia.org/wiki/Raspberry_Pi
Software
W
Z The Raspberry Pi uses Linux kernel-based operating
systems. Raspbian, a Debian-based free operating system
optimized for the Raspberry Pi hardware, is the current
recommended system.
Z The GPU hardware is accessed via a firmware image
which is loaded into the GPU at boot time from the SDcard. The firmware image is known as the binary blob,
while the associated Linux drivers are closed source.
Z Application software use calls to closed source run-time
libraries which in turn calls an open source driver inside
the Linux kernel. The API of the kernel driver is specific
for these closed libraries.
4
Software
W
Z The Raspberry Pi board support the following
Graphics and Video API via a set of closed source
libraries that give access to the GPU acceleration
features:
W OpenGL ES 2.0 - OpenGL is a 3D Graphics API
defined by the Khronos Group.
W OpenVG – OpenVG is a 2D vector drawing API also
defined by the Khronos Group.
W EGL – EGL is the interface between Khronos
rendering APIs such as OpenGL ES or OpenVG and
the underlying native platform window system.
5
Software
W
W OpenMAX IL – OpenMAX supplies a set of API’s that
provides abstractions for routines used during audio,
video, and still images processing. OpenMAX defines
3 layers, Raspberry Pi library will provide an interface
to the IL layer, which provides an interface between
media framework such as Gstreamer and a set of
multimedia components.
Z The first three libraries are standard in Linux, so
porting existing applications using those standard
API should be straightforward. OpenMAX does not
have standard implementation in Linux, so
Broadcom (via R-Pi) provide a custom
implementation.
6
Raspberry Pi hardware-accelerated
“Multimedia” software architecture
W
7
Bradcom BCM2835
W
8
Bradcom BCM2835
W
9
Features
W
Low Power ARM1176JZ-F Applications Processor
Dual Core VideoCore IV® Multimedia Co-Processor
1080p30 Full HD HP H.264 Video Encode/Decode
Advanced Image Sensor Pipeline (ISP) for up to 20megapixel cameras operating at up to 220 megapixels per
second
Z Low power, high performance OpenGL-ES® 1.1/2.0
VideoCore GPU. 1 Gigapixel per second fill rate.
Z High performance display outputs. Simultaneous high
resolution LCD and HDMI with HDCP at 1080p60
Z
Z
Z
Z
10
ARM1176 Processor
W
11
ARM1176 Processor
W
Z The ARM1176™ applications processors deployed broadly in
devices ranging from smart phones to digital TV's to eReaders,
delivering media and browser performance, a secure
computing environment, and performance up to 1GHz in low
cost designs.
Z The ARM1176JZ-S processor features ARM TrustZone®
technology for secure applications and ARM Jazelle®
technology for efficient embedded Java execution. Optional
tightly coupled memories simplify ARM9™ processor
migration and real-time design, while AMBA® 3 AXITM
interfaces improve memory bus performance. DVFS support
enables power optimization below the best-in-class nominal
static and dynamic power of the ARM11TM processor
architecture.
12
ARM1176
W
ARM1176
Architecture
ARMv6
Dhrystone Performance
1.25 DMPS/MHz
Multicore
No - Single core only
ISA Support
•ARM
•Thumb®
•Jazelle® DBX
•DSP extension
•Floating Point Unit (Optional)
Memory Management
Memory management unit
Debug & Trace
CoreSight™ Design Kit for
ARM11 (available separately)
13
ARM1176 Key Features
W
Z Performance to enable excellent end-user experience
W 750MHz (TSMC 65GP) with conservative design
1GHz+ with design optimizations
W Low latency mode for interrupt responsiveness
W TCM for ARM9™ processor migration, real-time
demands
W Physically addressed caches for multi-tasking
performance
W Broad OS support, multiple Linux distributions,
amazing ARM ecosystem
W Full Internet experience
14
ARM1176 Key Features
W
Z Product maturity enables rapid time to market and
low risk
W Well proven technology in wide range of applications
W Available as soft core or hard macro from ARM
(TSMC (90G) or from 3rd parties
(Socle/GLOBALFOUNDRIES - 65nm, TSMC - 65nm)
W AMBA AXI supported by wide range of fabric
W CoreSight debug offering unrivalled system visibility
W Comprehensive range of development tools from
ARM and from third parties
W Range of Reference Methodologies supplied
15
ARM1176 Key Features
W
Z Low Power Leadership
W Shutdown modes, Clock Gating, and DVFS capability
W 93% of flops are clock gated
W Separate Main TLB and Micro-TLBs --> main TLB is
not clocked unless micro-TLB misses
W Avoids unnecessary Tag-RAM and Data-RAM activity
for sequential accesses
W Predictive use of Cache or TCM
16
W
17
RPi Low-level peripherals
W
http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
18
Introduction
W
Z In addition to the familiar USB, Ethernet and HDMI ports, the
R-Pi offers lower-level interfaces intended to connect more
directly with chips and subsystem modules.
Z These GPIO (general purpose I/O) signals on the 2x13 header
pins include SPI, I2C, serial UART, 3V3 and 5V power.
Z These interfaces are not "plug and play" and require care to
avoid miswiring.
Z The pins use a 3V3 logic level and are not tolerant of 5V levels,
such as you might find on a 5V powered Arduino.
Z Not yet software-enabled are the flex cable connectors with CSI
(camera serial interface) and DSI (display serial interface), and a
serial link inside the HDMI connector called CEC. (consumer
electronics control) .
19
General Purpose Input/Output
W
Z General Purpose Input/Output (GPIO) is a
generic pin on a chip whose behavior
(including whether it is an input or output pin)
can be controlled (programmed) through
software.
Z The Raspberry Pi allows peripherals and
expansion boards (such as the Rpi Gertboard)
to access the CPU by exposing the inputs and
outputs.
Z The Raspberry Pi board has a 26-pin 2.54 mm
expansion header, marked as P1, arranged in a
2x13 strip. They provide 8 GPIO pins plus
access to I²C, SPI, UART), as well as +3.3 V, +5
V and GND supply lines. Pin one is the pin in
the first column and on the bottom row.
20
Gertboard
W
21
General Purpose Input/Output
W
Z GPIO voltage levels are 3.3 V and are not 5 V
tolerant. There is no over-voltage protection on the
board - serious interfacing will use an external board
with buffers, level conversion and analog I/O rather
than soldering directly onto the main board.
Z All the GPIO pins can be reconfigured to provide
alternate functions, SPI, PWM, I²C and so. At reset
only pins GPIO 14 & 15 are assigned to the alternate
function UART, these two can be switched back to
GPIO to provide a total of 17 GPIO pins.
22
General Purpose Input/Output
W
Z Each GPIO can interrupt, high/low/rise/fall/change.
There is currently no support for GPIO interrupts in the
official kernel, however a patch exists, requiring
compilation of modified source tree. The 'Raspbian
"wheezy"' version that is currently recommended for
starters already includes GPIO interrupts.
Z GPIO input hysteresis (Schmitt trigger) can be on or off,
output slew rate can be fast or limited, and source and
sink current is configurable from 2 mA up to 16 mA. Note
that chipset GPIO pins 0-27 are in the same block and
these properties are set per block, not per pin.
23
8-channel Bi-directional Logic
Level Converter - TXB0108
W
Z This chip perform bidirectional
level shifting from pretty much
any voltage to any voltage and
will auto-detect the direction.
Z Only thing that doesn't work
well with this chip is i2c (because
it uses strong pullups which
confuse auto-direction sensor).
Z If you need to use pullups, you
can but they should be at least
50K ohm - the ones internal to
AVRs/Arduino are about 100K
ohm so those are OK!
24
Alternative functions
W
Header Pinout, top row
25
Alternative functions
W
Header Pinout, bottom row
26
Power pins
W
Z The maximum permitted current draw from the 3.3 V
pins is 50 mA.
Z Maximum permitted current draw from the 5 V pin is the
USB input current (usually 1 A) minus any current draw
from the rest of the board.
W
W
Model A: 1000 mA - 500 mA -> max current draw: 500 mA
Model B: 1000 mA - 700 mA -> max current draw: 300 mA
Z Be very careful with the 5 V pins P1-02 and P1-04, because
if you short 5 V to any other P1 pin you may permanently
damage your RasPi.
27
GPIO Input Protection
W
28
GPIO Interface Circuit
W
29
Driving a Relay using GPIO
W
30
GPIO Driving Example (Python)
W
Z This uses the Python
module available at
http://pypi.python.org/py
pi/RPi.GPIO Any Python
script that controls GPIO
must be run as root.
31
GPIO Driving Example
(C + wiringPi)
W
Z
Z
Get and install wiringPi:
https://projects.drogon.net/raspberrypi/wiringpi/download-and-install/
Save this, and compile with:
W
Z
gcc -o blink blink.c -lwiringPi
and run with:
W
sudo ./blink
32
Download