Raspberry Pi - Case Study
Raspberry Pi - Case Study
Submitted By: -
Ali Raza Haider
Muhammad Maisam Bin Khaqan
ID: -
F2017266003
F2017266001
Subject: -
Microprocessor and Assembly Language
Section: -
V5
Submitted To: -
Sir Rehan Saleem
Raspberry Pi
The Raspberry Pi is a series of small single-board computers developed in the
United Kingdom by the Raspberry Pi Foundation to promote teaching of modern
computer science in schools and in developing countries. The original model
became far more popular than anticipated, selling outside its target market for uses
such as robotics. It does not include peripherals (such as keyboards and mice) and
cases. However, some accessories have been included in several official and
unofficial bundles.
The organization behind the Raspberry Pi consists of two arms. The first two
models were developed by the Raspberry Pi Foundation. After the Pi Model B was
released, the foundation set up Raspberry Pi Trading, with Eben Upton as CEO, to
develop the third model, the B+. Raspberry Pi Trading is responsible for
developing the technology while the Foundation is an educational charity to
promote the teaching of basic computer science in schools and in developing
countries.
According to the Raspberry Pi Foundation, more than 5 million Raspberry Pis were
sold by February 2015, making it the best-selling British computer. By November
2016 they had sold 11 million units, and 12.5m by March 2017, making it the third
best-selling “general purpose computer”. In July 2017, sales reached nearly 15
million. In March 2018, sales reached 19 million.
Most Pis are made in a Sony factory in Pencoed, Wales, some are made in China
or Japan.
Figure 2: Raspberry Pi 3 Model B+
Hardware
The Raspberry Pi hardware has evolved through several versions that feature
variations in memory capacity and peripheral-device support.
This block diagram describes Model B and B+; Model A, A+, and the Pi Zero are
similar, but lack the Ethernet and USB hub components. The Ethernet adaptor is
internally connected to an additional USB port. In Model A, A+, and the Pi Zero,
the USB port is connected directly to the system on a chip (SoC). On the Pi 1
Model B+ and the later models the USB/Ethernet chip contains a five-port USB
hub, of which four ports are available, while the Pi 1 Model B only provides two.
On the Pi Zero, the USB port is also connected directly to the SoC, but it uses a
micro USB (OTG) port.
Processor
The Broadcom BCM2835 SoC used in the first-generation Raspberry Pi includes a
700 MHz ARM11 76JZF-S processor, VideoCore IV graphics processing unit
(GPU), and RAM. It has a level 1 (L1) cache of 16 KB and a level 2 (L2) cache of
128 KB. The level 2 cache is used primarily by the GPU. The SoC is stacked
underneath the RAM chip, so only its edge is visible. The 1176JZ(F)-S is the same
CPU used in the original iPhone, although at a higher clock rate, and mated with a
much faster GPU.
The earlier V1.1 model of the Raspberry Pi 2 used a Broadcom BCM2836 SoC
with a 900 MHz 32-bit, quad-core ARM Cortex-A7 processor, with 256 KB shared
L2 cache. The Raspberry Pi 2 V1.2 was upgraded to a Broadcom BCM 2837 SoC
with a 1.2 GHz 64-bit quad-core ARM Cortex-A53 processor, the same SoC which
is used on the Raspberry Pi 3, but underclocked (by default) to the same 900 MHz
CPU clock speed as the V1.1. The BCM2836 is no longer in production as of late
2016.
The Raspberry Pi 3+ uses a Broadcom BCM2837B0 with a 1.4 GHz 64-bit quad-
core ARM Cortex-A53 processor, with 512 KB shared L2 cache.
The Raspberry Pi Zero and ZeroW use the same Broadcom BCM2835 SoC as the
first-generation Raspberry Pi, although now running at a 1GHz CPU clock speed.
Figure 4: The Raspberry Pi B uses a 32-bit 900 MHz quad-core ARM Cortex-A7 processor.
Performance
While operating at 700 MHz by default, the first-generation Raspberry Pi provided
a real-world performance roughly equivalent to 0.041 GFLOPS. On the CPU level
the performance level is similar to a 300 MHz Pentium II of 1997-99. The GPU
provides 1 Gpixel/s or 1.5 Gtexel/s of graphics processing or 24 GFLOPS of
general-purpose computing performance. The graphical capabilities of Raspberry
Pi are roughly equivalent to the performance of the Xbox of 2001.
Raspberry Pi 2 V1.1 included a quad-core Cortex-A7 CPU running at 900 MHz
and 1 GB RAM. It was described as 4-6 times more powerful than its predecessor.
The GPU was identical to the original. In parallelized benchmarks, the Raspberry
Pi 2 V1.1 could be up to 14 times faster than Raspberry Pi 1 Model B+.
The Raspberry Pi 3, with a quad-core ARM Cortex-A53 processor, is described as
having ten times the performance of a Raspberry Pi 1. This was suggested to be
highly dependent on task threading and instruction set use. Benchmarks showed
the Raspberry Pi 3 to be approximately 80% faster than the Raspberry Pi 2 in
parallelized tasks.
Overclocking
Most Raspberry Pi systems-on-chip could be overclocked to 800 MHz, and some
to 1000 MHz. There are reports that the Raspberry Pi 2 can be similarly
overclocked, in extreme cases, even to 1500 MHz (discarding all safety features
and over-voltage limitations). In the Raspbian Linux distro the overclocking
options on boot can be done by a software command running “sudo raspi-config”
without voiding the warranty. In those cases, the Pi automatically shuts the
overclocking down if the chip temperature reaches 85 o C (185 o F), but it is
possible to override automatic over-voltage and overclocking settings (voiding the
warranty); an appropriately sized heat sink is needed to protect the chip from
serious overheating.
Newer versions of the firmware contain the option to choose between five
overclock (“turbo”) presets that when used, attempt to maximize the performance
of the SoC without impairing the lifetime of the board. This is done by monitoring
the core temperature of the chip and the CPU load, and dynamically adjusting
clock speeds and the core voltage. When the demand is low on the CPU or it is
running too hot the performance is throttled, but if the CPU has much to do and the
chip’s temperature is acceptable, performance is temporarily increased with clock
speeds of up to 1 GHz, depending on the board version and on which of the turbo
settings is used.
The seven overclock presets are:
none; 700 MHz ARM, 250 MHz core, 400 MHz SDRAM, 0 overvolting
modest; 800 MHz ARM, 250 MHz core, 400 MHz SDRAM, 0 overvolting,
medium; 900 MHz ARM, 250 MHz core, 450 MHz SDRAM, 2 overvolting,
high; 950 MHz ARM, 250 MHz core, 450 MHz SDRAM, 6 overvolting,
turbo; 1000 MHz ARM, 500 MHz core, 600 MHz SDRAM, 6 overvolting,
Pi 2; 1000 MHz ARM, 500 MHz core, 500 MHz SDRAM, 2 overvolting,
Pi 3; 1100 MHz ARM, 550 MHz core, 500 MHz SDRAM, 6 overvolting. In
system information the CPU speed will appear as 1200 MHz. When idling,
the speed lowers to 600 MHz.
In the highest (turbo) preset SDRAM clock was originally 500 MHz, but this was
later changed to 600 MHz because 500 MHz sometimes causes SD card
corruption. Simultaneously in high mode the core clock was lowered from 450 to
250 MHz, and in medium mode from 333 to 250 MHz.
The CPU on the first- and second-generation Raspberry Pi mode did not require
cooling, such as a heat sink or fan, even when overclocked, but the Raspberry Pi 3
may generate more heat when overclocked.
RAM
On the older beta Model B boards, 128 MB was allocated by default to the GPU,
leaving 128 MB for the CPU. On the first 256 MB release Model B (and Model
A), three different splits were possible. The default split was 192 MB (RAM for
CPU), which should be sufficient for standalone 1080p video decoding, or for
simple 3D, but probably not for both together. 224 MB was for Linux only, with
only a 1080p framebuffer, and was likely to fail for any video or 3D. 128 MB was
for heavy 3D, possibly also with video decoding (e.g. Kodi). Comparatively the
Nokia 701 uses 128 MB for the Broadcom VideoCore IV.
For the later Model B with 512 RAM, new standard memory split files
(arm256_start.elf, arm384_start.elf, arm496_start.elf) were initially released for
256 MB, 384 MB and 496 MB CPU RAM (and 256 MB, 128 MB and 16 MB
video RAM) respectively. But a week or so later the RPF released a new version of
start.elf that could read a new entry in config.txt (gpu_mem=xx) and could
dynamically assign an amount of RAM (from 16 to 256 MB in 8 MB steps) to the
GPU, so the older method of memory splits became obsolete, and a single start.elf
worked the same for 256 MB and 512 MB Raspberry Pis.
The Raspberry Pi 2 and the Raspberry Pi 3 have 1 GB of RAM. The Raspberry Pi
Zero and Zero W have 512 MB of RAM.
Networking
The Model A, A+ and Pi Zero have no Ethernet circuitry and are commonly
connected to a network using an external user-supplied USB Ethernet or Wi-Fi
adapter. On the Model B and B+ the Ethernet is provided by a built-in USB
Ethernet adapter using the SMSC LAN9514 chip. The Raspberry Pi 3 and Pi Zero
W (wireless) are equipped with 2.4 GHz WiFi 802.11n (150 Mbit/s) and Bluetooth
4.1 (24 Mbit/s) based on the Broadcom BCM43438 FullMAC chip with no official
support for monitor mode but implemented through unofficial firmware patching
and the Pi 3 also has a 10/100 Mbit/s Ethernet port. The Raspberry Pi 3B+ features
dual-band IEEE 802.11b/g/n/ac WiFi, Bluetooth 4.2, and Gigabit Ethernet (limited
to approximately 300 Mbit/s by the USB 2.0 bus between it and the SoC).
Special-purpose features
The Pi Zero can be used as a USB device or a “USB gadget”, plugged into another
computer via a USB port on another machine. It can be configured in multiple
ways, for example to show up as a serial device or an ethernet device. Although
originally requiring software patches, this was added to the mainline Raspbian
distribution in May 2016.
The Pi 3 can boot from USB, such as from a flash drive. Because of firmware
limitations in other models, the Pi 3A, 3B and 3B+ are the only boards that can do
this.
Peripherals
The Raspberry Pi may be operated with any generic USB computer keyboard and
mouse. It may also be used with USB storage, USB to MIDI converters, and
virtually any other device/component with USB capabilities.
Other peripherals can be attached through the various pins and connectors on the
surface of the Raspberry Pi.
Figure 5: The Model 2B boards incorporate four USB ports for connecting peripherals.
Video
The video controller can generate standard modern TV resolutions, such as HD and
Full HD, and the higher or lower monitor resolutions as well as older NTSC or
PAL standard CRT TV resolutions. As shipped (i.e., without custom overclocking)
it can support the following resolutions: 640x350 EGA; 640x480 VGA; 800x600
SVGA; 1024x768 XGA; 1280x720 720p HDTV; 1280x768 WXGA variant;
1280x800 WXGA variant; 1280x1024 SXGA; 1366x768 WXGA variant;
1400x1050 SXGA+; 1600x1200 UXGA; 1680x1050 WXGA+; 1920x1080 1080p
HDTV; 1920x1200 WUXGA.
Higher resolutions, up to 2048x1152, may work or even 3840x2160 at 15 Hz (too
low a frame rate for convincing video). Note also that allowing the higher
resolutions does not imply that the GPU can decode video formats at these
resolutions; in fact, the Pis are known to not work reliably for H.256 (at those high
resolutions), commonly used for very high resolutions (however, most common
formats up to Full HD do work).
Although the Raspberry Pi 3 does not have H.265 decoding hardware, the CPU is
more powerful than its predecessors, potentially fast enough to allow the decoding
of H.265-encoded videos in software. The GPU in the Raspberry Pi 3 runs at
higher clock frequencies of 300 MHz or 400 MHz, compared to previous versions
which ran at 250 MHz.
The Raspberry Pis can also generate 576i and 480i composite video signals, as
used on old-style (CRT) TV screens and less-expensive monitors through standard
connectors – either RCA or 3.5 mm phono connector depending on model. The
television signal standards supported are PAL-BGHID, PAL-M, PAL-N, NTSC
and NTSC-J.
Figure 6: The early Raspberry Pi 1 Model A, with an HDMI port and a standard RCA composite video port for older displays
Real-time clock
None of the current Raspberry Pi models have a built-in real-time clock, so they
are unable to keep track of the time of day independently. Instead, a program
running on the Pi can retrieve the time from the network time server or from user
input at boot time, thus knowing the time when powered on. To provide
consistency of time for the file system, the Pi automatically saves the current
system time on shutdown, and re-loads that time at boot.
A real-time hardware clock with battery backup, such as the DS1307, may be
added (often via the I2C interface). Note however that conflicts with the camera’s
CSI interface, effectively disabling the camera.
Connectors
Pi Zero
Model A
Model B
Figure 10: Location of connectors and main ICs on Raspberry Pi 1 Model B revision 1.2
Figure 11: Location of connectors and main ICs on Raspberry Pi 1 Model B+ revision 1.2 and Raspberry Pi 2
Figure 12: Location of connectors and main ICs on Raspberry Pi 3
Model B rev. 2 also has a pad (called P5 on the board and P6 on the schematics) of
8 pins offering access to an additional 4 GPIO connections.
Function 2nd func. Pin# Pin# 2nd func. Function
+5V 1 2 +3.3V
GPIO28 GPIO_GEN7 3 4 GPIO_GEN8 GPIO29
GPIO30 GPIO_GEN9 5 6 GPIO_GEN1 GPIO31
0
GND 7 8 GND
Models A and B provide GPIO access to the ACT status LED using GPIO 16.
Models A+ and B+ provide GPIO access to the ACT status LED using GPIO 47,
and the power status LED using GPIO 35.
NOOBS Setting
New Out of Box Software (NOOBS) is an easy operating system installation
manager for the Raspberry Pi.
How to get NOOBS
DOWNLOAD
Alternatively, NOOBS is available for download on Raspberry Pi website:
raspberrypi.org/downloads
Example Code
Python Code:
import RPi.GPIO as gpio
import time
gpio.setmode(gpio.BCM)
gpio.setup(18, gpio.OUT)
while True:
gpio.output(18, gpio.HIGH)
passcode = raw_input(“What is pi?: “)
if passcode == “Awesome”:
gpio.output(18, gpio.LOW)
time.sleep(4)
else:
gpio.output(18, gpio.HIGH)
print(“Wrong Password!”)
Assembly Language Code:
.text
.global_start
_start:
mov r7, #4 ; write system call
mov r0, #1 ; file (stdout)
ldr r1, =message
mov r2, #14 ; message length
svc #0
mov r7, #1 ; exit system call
mov r0, #0 ; return code
svc #0
.data
message:
.ascii “Hello, world!\n”