5 - Embedded Systems

Download as pdf or txt
Download as pdf or txt
You are on page 1of 53

Life Support

5. Embedded Systems

By:
Dr. Mohammed Abdul-Muttaleb 1
Embedded Systems
❖ Definition 1) Any device that includes a programmable computer but is not itself a
general-purpose computer.
or 2) Embedded systems are computing systems with tightly coupled hardware and
software integration, that are designed to perform a dedicated function.
❖ Take advantage of application characteristics to optimize the design:
• Does not need all the general-purpose elements. Automobile

Avionics

Household
Appliances
Communication
Consumer
Office Equipments
Electronics
Example: Automotive Embedded Systems
• Modern embedded systems are often based on microcontrollers (i.e.
CPUs with integrated memory or peripheral interfaces)
• For example, today’s high-end automobile have > 80
microprocessors:
• 3-bit microcontroller checks seat belt;
• microcontrollers run dashboard devices;
• 16/32-bit microprocessor controls engine.
• Thousands lines of code
Embedded Systems
❖Characteristics of Embedded Systems:
•Real-time operation.
•Low manufacturing cost.
•Low power.
•Portable
❖Functional complexity:
• Often have to run sophisticated algorithms or multiple algorithms.
• Example: A DVD player: DVD, video CD, audio CD, JPEG image CD, MP3 CD….
• Often provide sophisticated user interfaces.
• Multiple levels of user menus
• Support for multiple languages
• Graphics
• Speech, handwriting
A Typical Embedded System
Real-Time Algorithms for Engineering
Interface
Clock Digital Control System

Data Logging Remote


Monitoring System

Database
Data Retrieval
Display
and Display
Devices

Operator’s Operator Real-Time Computer


Console Interface
Embedded System Design

• Designing hardware for embedded systems is challenging, because


the designers have to be, very careful, for a lot of reasons…
Embedded System Design
1. Required Hardware
–How many processors? How much memory?

• Let’s design an elevator control’ system.


• How much data would the system need to process in single cycles? The largest would be
the highest number of floors the elevator has to travel up. Assuming that the number is 50
(for a 50-storey building), we need to store all the numbers from 0 to 50 and the processor
should be able to process those numbers.
• In such cases, an 6-bit processor (one which can process 8 bits in one clock cycle) is more
than enough since it will be able to process any number between 0 and 127.
Embedded System Design
2. Power Consumption
Why is Power Consumption an Issue?
• Portable systems - battery life time!
• Systems with a very limited power budget: Mars
Pathfinder, autonomous vehicle and helicopter, ...
• Desktops and servers: high power consumption -
raises temperature and deteriorates performance &
reliability - increases the need for expensive cooling
mechanisms
• One of the main difficulties with developing high
performance chips is heat extraction.
Embedded System Design
How do we minimize power?
• Sleep mode: A common practice to prevent the microcontroller from drawing
maximum power is to put it into deep sleep mode when it’s idle. In deep sleep
mode, microcontrollers often consume a tiny fraction of the maximum current,
often in nano-amps. interrupts can then be used to wake up the
microcontroller.
• Dynamic change of the processor frequency: low frequency could be used
during the idle periods and a high frequency during the intensive calculations
• Turn off unnecessary devices: Turn off wifi, Bluetooth, etc..
• Code optimization…
How to minimize power?: code optimization
Some tips:
• Reduce the usage of variables
• Use bit shift operation instead of
multiplication and division
• Switch instead of if-else
• Work with interrupt
• Use decrement loop…
Embedded System Design: code optimization
Decrement loop

• A decremented loop will generate less


assembly code as compared to an
incremented loop.

• That is because in an increment loop, a


comparison instruction is needed to
compare the loop index with the
maximum value in every loop to check if
the loop index reaches the maximum
value. On the contrary in a decrement
loop, this comparison is not needed any
more because the decremented result of
the loop index will set the zero flag in
SREG if it reaches zero.
Embedded System Design
• How do we reduce size/weight?

• Flexibility and Upgradeability

• Use Reduced Instruction Set Compute (RISC) Architecture instead of Complex


Instruction Set Computer (CISC).

• You’re not going to find a Core i7 in an embedded system!


RISC Architecture
• Small set of simple and general instructions, rather than a large set of
complex and specialized instructions
• RISC trait is their load/store architecture, in which memory is accessed
through specific instructions rather than as a part of most instructions.
• RISC utilizes simple addressing modes and fixed length instructions.
• One Cycle Execution Time
• RISC contains Large Number of Registers in order to prevent various
number of interactions with memory.
• In RISC, more RAM is required to store assembly level instructions.
• Low power
• Smartphones and tablet computers such as the iPad and Android devices
use of ARM architecture processors which is RISC-based systems.
CISC
• The CISC approach attempts to minimize the number of instructions
per program, sacrificing the number of cycles per instruction.
• A CISC processor is easier to control and command because it carries
out some of the more complicated functions automatically but
requires more time.
• Requires more memory access
• An x86 (or x64) processor belongs CISC family. This type of processor
has a more complicated instruction.
• More complex instruction than RISC
CISC vs RISC
CISC RISC
Many instructions Few instructions
Instructions have varying lengths Instructions have fixed lengths
Instructions execute in varying times Instructions execute in 1 or 2 bus cycles
Many instructions can access memory Few instructions can access memory
• Load from memory to a register
• Store from register to memory
In one instruction, the processor can both No one instruction can both read and write
• read memory and memory in the same instruction
• write memory
Fewer and more specialized registers. Many identical general purpose registers
• some registers contain data,
• others contain addresses
CISC RICS
MULT A,B LOAD R1, A
LOAD R2, B
PROD A, B
STORE R3, A
Break
Microcontrollers vs Microprocessors
• Microcontrollers have RAM, ROM, EEPROM embedded
in it while microprocessor has to use external circuits.
• Processing speed of microcontrollers is about 8 MHz to 50 MHz while the
speed of general microprocessors is above 1 GHz.
• Microcontrollers are compact making them favourable and efficient for
small products and applications while microprocessors are bulky so they
are preferred for larger applications.
• Arduino is an example of a microcontroller.
• Microprocessor is generally used for general purpose processing while
microcontroller is used for a specific purpose.
Embedded System Memory: ROM
A. Read Only Memory (ROM): the memory content is programmed during the
manufacturing process. Once programmed, the content cannot be changed. It
cannot be reprogrammed.
B. Erasable Programmable ROM (EPROM): an EPROM device can be custom-
programmed and erased. The memory content is non-volatile once programmed.
Traditional EPROM devices are erased by exposure to ultraviolet (UV) light. An
EPROM device must be removed from its housing unit first. It is then
reprogrammed using a special hardware device called an EPROM programmer.

Photons of the UV light cause ionization within the silicon oxide, which
allow the stored charge on the floating gate to dissipate. Since the whole
memory array is exposed, all the memory is erased at the same time.
Embedded System Memory: EEPROM
• Electrically Erasable Programmable ROM (EEPROM or E2PROM):
modern EPROM devices are erased electrically and are thus called
EEPROM. One important difference between an EPROM and an
EEPROM device is that with the EEPROM device, memory content of
a single byte can be selectively erased and reprogrammed. Therefore,
with an EEPROM device, incremental changes can be made. Another
difference is the EEPROM can be reprogrammed without a special
programmer and can stay in the device while being reprogrammed.
• EEPROM is rather slow because you can program 1 byte at a time
• Flash memory works much faster than traditional EEPROMs
because it erases a block or the entire chip at a time.
Embedded System Memory: RAM
B.Random Access Memory (RAM): Also called Read/Write Memory, requires
external power to maintain memory content. The term random access refers
to the ability to access any memory cell directly. Types of RAM that are of
interest:
• Dynamic RAM (DRAM): DRAM is a RAM device that requires periodic
refreshing to retain its content.
• Static RAM (SRAM): SRAM is a RAM device that retains its content as long as
power is supplied by an external power source. SRAM does not require
periodic refreshing and it is faster than DRAM.
• Non-Volatile RAM (NVRAM): NVRAM is a special type of SRAM that has
backup battery power so it can retain its content after the main system
power is shut off.
DRAM Memory Technology
• Dynamic random-access memory
• Capacitor charge state indicates stored value
• Whether the capacitor is charged or discharged indicates storage of 1 or 0
• 1 capacitor
• 1 access transistor
• Capacitor leaks
• DRAM cell loses charge over time
• DRAM cell needs to be refreshed
• Needs Recherche after each read (destructive read)

DRAM 23
DRAM Implementation*
Dynamic RAM
• DRAM stores the binary information in the form of electric charges on
capacitors.
• The capacitors are provided inside the chip by MOS transistors.
• The capacitors tends to discharge with time and must be periodically
recharged by refreshing the dynamic memory.
• DRAM offers reduced power consumption and larger storage capacity
in a single memory chip.
• High capacity, low cost, low speed, low power consumption.
SRAM Memory Technology
• Static random access memory
• Two cross coupled inverters store a single bit
• 6 Transistors in total
• 4 transistors for storage (each invertor has 2 transistor)
• 2 transistors for access
bitline bitline
wordline

SRAM
26
Static RAM
• SRAM consists essentially of internal latches that store the binary
information.
• The stored information remains valid as long as power is applied to
the unit.
• SRAM is easier to use and has shorter read and write cycles.
• Low capacity, high cost, high speed, high power consumption.
Hard Disk Drives (HDDs)

Platters

Read/Write Head
Side View

• HDD is an electromechanical data storage device that uses magnetic storage to store
and retrieve digital information using one or more rigid rapidly rotating disks (platters)
coated with magnetic material.
• Speed is dependent on rotation speed (5400, 7200…10000)
Solid State Disks (SSDs)

• 1995 – Replace rotating magnetic media with non-


volatile memory (battery backed DRAM)
• No moving parts (no rotate/seek motors)
• Eliminates seek and rotational delay (0.1-0.2ms access
time)
• Very low power and lightweight
• High cost
• Very fast (500MB)
Solid State Hard (SSD)
• Like a memory stick, the SSD stores information on microchips and
contains no moving parts.
• Most SSD manufacturers use non-volatile NAND flash memory in the
construction of their SSDs because of the lower cost compared with
DRAM and the ability to retain the data without a constant power
supply.
SSD vs HDD

If kept in a dry environment at low


Reliability on storage SSDs typically start to lose data after
temperature, HDDs can retain their data
retention about 5-10 years
for a very long period.
High performance flash-based SSDs
Power consumption generally require half to a third of the Consume more power due to motors
power of HDDs.
Durability Can tolerate shock Shock can damage the hard
Weight Light weight Heavier weight
Speed High (250-500MB) Low (75-140 MB)
SSD Summary
• Pros (vs. hard disk drives):
• Low latency, high throughput (eliminate seek/rotational
delay)
• No moving parts:
• Very light weight, low power, silent, very shock insensitive
• Read at memory speeds (limited by controller and I/O
bus)

• Cons
• More expensive (~5-10x disk)
• Limited drive lifetime
• life expectancy is 9–11 years
Break
Memory Hierarchy

Registers

SPEED and COST


CAPACITY
On-Chip
SRAM
Off-Chip
SRAM
DRAM

Flash/Disk

34
Types of Memories
SSD: $0.75 /GB, HDD: $0.1-0.2/GB
DRAM: $20-25/GB
Type Size Latency Cost/bit

Register < 1KB < 1ns $$$$

On-chip SRAM 8KB-6MB < 2ns $$$

Off-chip SRAM 1Mb – 16Mb < 10ns $$

DRAM 64MB – 1TB < 100ns $

Disk (SSD, HDD) 40GB – 1PB < 20ms < $1/GB


Flash Memory
• Invented in 1984 by a Japanese engineer (Fujio Masuoka) at TOSHIBA
• Non-volatile memory technology
• Very fast eraser process similar to a camera flash
• Has limited number of write cycles (endurance)

36
Floating Gate MOSFET (FGMOS)
• The fundamental build block of flash memory is FGMOS
FGMOS states

• Reading logic “0” and logic “1”


• Programming to “0” and “1”
Logic One “1”
Reading Data (logic “1”)
Reading data (Logic “0”)
Erasing (Programming to zero)
Erasing (Erasing to 1)
There are two types of flash memory: NOR Flash and NAND Flash
New technology for storing data
QLC: Quad layer Cell TLC: Triple layer Cell SLC: Single layer Cell
NAND vs NOR
• NOR for high reliability mobile phone and low capacity such as
medical devices and instruments

• NAND high memory not needing fast reading time such as camera
and flash memory

NAND Flash NOR Flash


Page addressable (e.g., 512 Bytes ) Reads at byte granularity
Slow random reads (~30us) Fast random reads (~120ns)
fast writes (~3.5ms to erase 120KB) slow writes (~520ms to erase 120KB)
Higher density Lesser density
Used for normal storage Primarily used as code storage
Question
• Why NOR flash is an attractive technology for storing program’s
binary on an embedded platform? Focus on Read speed, and write
speed for reasoning.

49
https://www.youtube.com/watch?v=r2KaVfSH884&t=392s

You might also like