You are on page 1of 59

Chapter 2

Embedded System Architecture


Embedded System Architecture
 Typical embedded system mainly has two parts i.e., embedded
hardware and embedded software.
 Embedded hardware's are based around
microprocessors and microcontrollers, also include memory, bus,
Input/Output, Controller
 Embedded software includes embedded operating systems,
different applications and device drivers.
 Basically ES have two type of architecture i.e., Harvard
architecture and Von Neumann architecture are used in
embedded systems.
 Architecture of the Embedded System includes Sensor, Analog
to Digital Converter, Memory, Processor, Digital to Analog
Converter, and Actuators etc. The below figure illustrates the
overview of basic architecture of embedded systems :
Cont.…
Cont.
 Embedded Product Development Life Cycle (EDLC): Developing an
embedded system or product mainly goes through this three phases
which are
1. Analysis
2. Design
3. Implementation
If we will go a little bit deeper to the development steps it includes these 7
steps :
 Requirement analysis

 Examine

 Design

 Develop

 Test

 Deploy

 Maintenance
Cont.
 Advantages of Embedded System :
 Embedded systems are fast in performance.

 These systems consumes less power

 Small in shape and size.

 These systems are so scalable and reliable.

 Works on wide variety of sectors and environments.

 Improve product quality and enhance performance.

 Performs specific tasks without error.

 Disadvantages of Embedded System :


 Difficult to backup of embedded files.

 Sometimes complex to develop.

 Integration may be a problem.

 Offer very limited resources for processing.

 Troubleshooting may be difficult.

 Maintenance may be a problem.


Cont.
 An embedded system is built around a processor.
 The central processing unit does the necessary computation
based on the input it receives from various external devices.
 The functionality of the CPU is an embedded system is same as
the functionality of the CPU in a desktop, except that the CPU in
an embedded system is less powerful.
 The processor has limited internal memory, and if this internal
memory is not sufficient for a given application external memory
devices are used. The hardware also includes any components
that facilitates the user-application interaction, such as display
units, keypads etc.
Cont.
Processor
 The processor used in embedded systems can be of three types:
 Micro-Controllers

 Microprocessors

 Digital Signal Processor

 Each of them is specified by clock speed( 100MHz, etc) and data


word length( 8-bit, 16-bit, 32-bit).
 The higher the clock speed, the faster the processor. Same way,
bigger data word-length leads to higher precision. The word
length also indicates the processor’s capability to address the
memory. This addressing capability is specified by the number of
bits used for addressing. For instance, an 8-bit processor can be
use 8 or 16-bit for addressing.
Micro-controller
 Micro-controllers are mainly of Intel’s 805x family, Motorola’s
68HCxx, etc.
 A typical micro-controller contains a CPU, interrupts,
timer/counter, memory (RAM, ROM, or both) and other
peripherals in same Integrated Circuit(IC).
 Micro-controller are often an ideal solution for control
applications because you can use them to build an embedded
system with little additional circuitry.
 The 8-bit micro-controllers are used for process control
applications, such as the ones found in toys and smart cards. If
your processing power and memory requirements are high, you
need to choose a 16-bit or 32-bit processor.
Cont.
Microprocessor
 A number of 16-bit and 32-bit microprocessors are available
from ARM, Atmel, Intel, Motorola, National Semiconductors,
etc. In order to develop an embedded system with these
processors, you great deal of peripheral circuitry. However,
microprocessors higher clock speeds and word-length, so they
are capable of addressing higher memory.
 These processors are used for high-end applications such as
handheld computers, Internet access Devices, etc.
 A microprocessor executes a collection of machine instructions
that tell the processor what to do.
Microprocessor
Microprocessor
 Based on the instructions, a microprocessor does three basic
things:
 Using its ALU(Arithmetic/Logic Unit), a microprocessor can
perform mathematical operations like addition, subtraction,
multiplication and division. Modern microprocessors contain
complete floating-point processors that can perform extremely
sophisticated operations on large floating-point numbers.
 A microprocessor can move data from one memory location to
another.
 A microprocessor can make decisions and jump to a new set of
instructions based on those decisions.
Microprocessor
Microprocessor
Types of Microprocessor
Two classification criteria:

1. hardware characteristics
 Complex Instruction Set Computer (CISC)

large number of complex addressing modes

many versions of instructions for different operands

different execution times for instructions

few processor registers

micro programmed control logic


Microprocessor
 Reduced Instruction Set Computer (RISC)
 one instruction per clock cycle
 memory accesses by dedicated load/store instructions
 few addressing modes
 hard-wired control logic
 Very Long Instruction Word (VLIW)
 statically determined instruction-level parallelism (under
compiler control)
 instructions are composed of different machine operations
 whose execution is started in parallel
 many parallel functional units
 large register sets
Microprocessor
 Superscalar Processors
 subclass of RISCs or CISCs

 multiple instruction pipelines for overlapping execution of

instructions
 parallelism not necessarily exposed to the compiler

2. Characteristics of application areas


 GPP (General Purpose Processor) / MCU (Microcontroller Unit)

 Microprocessor

 Microcontroller

 Embedded Processor

 Digital Signal Processor

 Media Processor
Microprocessor
 SPP (Special Purpose Processor)
 ASIC (Application-Specific Integrated Circuit)
 ASIP (Application-Specific Instruction-set Processor)
 DSP (Digital Signal Processor)
 GPP core(s) or ASIP core(s) on either an Application Specific
Integrated Circuit (ASIC) or a Very Large Scale Integration
(VLSI) circuit.
Microprocessor
CISC RISC

Larger set of instructions. Easy to Smaller set of Instructions. Difficult to


program program.
Simpler design of compiler,
Complex design of compiler.
considering larger set of instructions.
Many addressing modes causing Few addressing modes, fix instruction
complex instruction formats. format.

Instruction length is variable. Instruction length varies.

Higher clock cycles per second. Low clock cycle per second.
Emphasis is on hardware. Emphasis is on software.
Control unit implements large
Each instruction is to be executed by
instruction set using micro-program
hardware.
unit.
Slower execution, as instructions are to
Faster execution, as each instruction is
be read from memory and decoded by
to be executed by hardware.
the decoder unit.
Pipelining of instructions is possible,
Pipelining is not possible.
considering single clock cycle.
Digital Signal Processor
 The digital signal processor (DSP) is a special designed
processor to handle signals, rather than data.
 Processing signals ( whether audio or video) is much more
complex than processing digital signals. To process audio
and video signals, the hardware/software needs to perform an
operation called filtering, in which unwanted frequencies are
removed.

 In signal processing, another important task is to convert the


signal in frequency domain. Analysing a signal in frequency
domain requires intensive mathematical computation, which
general-purpose processors take a lot of time to carry out.
Digital Signal Processor
 The DSP carries out such mathematical computations quickly
using a special module called the Multiplier and Accumulator.

 DSPs are available with various clock frequencies and word-


lengths, with each catering to different market segments (such as
speech processing, high-fidelity music processing, image
compression, video processing, etc).
Microprocessor Microcontroller

Microprocessors are multitasking in nature.


Single task oriented. For example, a
Can perform multiple tasks at a time. For
washing machine is designed for washing
example, on computer we can play music
clothes only.
while writing text in text editor.

RAM, ROM, I/O Ports, and Timers cannot


RAM, ROM, I/O Ports, and Timers can be be added externally. These components are
added externally and can vary in numbers. to be embedded together on a chip and are
fixed in numbers.

Fixed number for memory or I/O makes a


Designers can decide the number of
microcontroller ideal for a limited but
memory or I/O ports needed.
specific task.
External support of external memory and
Microcontrollers are lightweight and
I/O ports makes a microprocessor-based
cheaper than a microprocessor.
system heavier and costlier.
External devices require more space and A microcontroller-based system consumes
their power consumption is higher. less power and takes less space.
Embedded Systems - Architecture Types
 When data and code lie in different memory blocks, then the
architecture is referred as Harvard architecture.
 In case data and code lie in the same memory block, then the
architecture is referred as Von Neumann architecture.
Von Neumann Architecture
 The Von Neumann architecture was first proposed by a computer
scientist John von Neumann.
 In this architecture, one data path or bus exists for both
instruction and data. As a result, the CPU does one operation at a
time. It either fetches an instruction from memory, or performs
read/write operation on data. So an instruction fetch and a data
operation cannot occur simultaneously, sharing a common bus.
 Von-Neumann architecture supports simple hardware. It allows
the use of a single, sequential memory.
 Today's processing speeds vastly outpace memory access times,
and we employ a very fast but small amount of memory (cache)
local to the processor.
Von Neumann Architecture
Harvard Architecture
 The Harvard architecture offers separate storage and signal buses
for instructions and data.
 This architecture has data storage entirely contained within the
CPU, and there is no access to the instruction storage as data.
Computers have separate memory areas for program instructions
and data using internal data buses, allowing simultaneous access
to both instructions and data.
 Programs needed to be loaded by an operator; the processor
could not boot itself.
 In a Harvard architecture, there is no need to make the two
memories share properties.
Harvard Architecture
Cont.

on-Neumann Architecture Harvard Architecture

Single memory to be shared Separate memories for code


by both code and data. and data.
Processor needs to fetch
Single clock cycle is
code in a separate clock
sufficient, as separate buses
cycle and data in another
are used to access code and
clock cycle. So it requires
data.
two clock cycles.
Higher speed, thus less time Slower in speed, thus more
consuming. time-consuming.
Simple in design. Complex in design.
Criteria for Choosing Microcontroller
 While choosing a microcontroller, make sure it meets the task at hand
and that it is cost effective. We must see whether an 8-bit, 16-bit or
32-bit microcontroller can best handle the computing needs of a task.
In addition, the following points should be kept in mind while
choosing a microcontroller −
 Speed − What is the highest speed the microcontroller can support?
 Packaging − Is it 40-pin DIP (Dual-inline-package) or QFP (Quad
flat package)? This is important in terms of space, assembling, and
prototyping the end-product.
 Power Consumption − This is an important criteria for battery-
powered products.
 Amount of RAM and ROM on the chip.
 Count of I/O pins and Timers on the chip.
 Cost per Unit − This is important in terms of final cost of the product
in which the microcontroller is to be used.
Peripheral Devices in Embedded Systems
 Embedded systems communicate with the outside world via their
peripherals, such as following &mins;
 Serial Communication Interfaces (SCI) like RS-232, RS-422, RS-485, etc.
 Synchronous Serial Communication Interface like I2C, SPI, SSC, and ESSI
 Universal Serial Bus (USB)
 Multi Media Cards (SD Cards, Compact Flash, etc.)
 Networks like Ethernet, LonWorks, etc.
 Fieldbuses like CAN-Bus, LIN-Bus, PROFIBUS, etc.
 imers like PLL(s), Capture/Compare and Time Processing Units.
 Discrete IO aka General Purpose Input/Output (GPIO)
 Analog to Digital/Digital to Analog (ADC/DAC)
 Debugging like JTAG, ISP, ICSP, BDM Port, BITP, and DP9 ports
ARM
 ARM (Advanced RISC Machine) controller or processor
 ARM will be used to commercial purpose
E.g video game, modems, mobile phone, handy cams etc.
 Features: Architectural simplicity, it allows very small
implementation
 RISC – Competitive, easy to develop, cheap, Pointing the way to
feature
 ARM architecture RISC architecture pulse Enhancement
 RISC architecture includes - large uniform register file,
load/store, simple addressing modes , uniform and fixed length
instruction fields
 Enhancement includes – each instruction controls ALU and
Shifter , Auto INC and Auto DEC addressing modes, multiple
load/store , conditional execution
ARM
 Finally the ARM architecture will be
 High performance

 low code size

 low power consumption

 low silicon area

 Pipelines

 32 bit architectures

ARM modes of operation


 ARM architecture supports two types of modes

 Privileged mode (powerful mode which has a wide level of

access permissions)and non privileged mode


ARM
 ARM register organization
 Register are used to store instruction
 In ARM, there are 13 General purpose register(r0- r12) that are
available to programmer to use
 And 3 special purpose register (r13,r14,r15) used to perform
some specific task
communication interfaces
 The Communication channel which interconnects the various
components within an embedded product is referred as
Device/board level communication interface (Onboard
Communication Interface) These are classified into
 I2C (Inter Integrated Circuit) Bus
 SPI (Serial Peripheral Interface) Bus
 UART (Universal Asynchronous Receiver Transmitter)
 1-Wires Interface
 Parallel Interface
I2C (Inter Integrated Circuit) Bus:
 Inter Integrated Circuit Bus (I2C - Pronounced „I square C‟) is a
synchronous bi-directional half duplex (one-directional
communication at a given point of time) two wire serial interface
bus.
 The concept of I2C bus was developed by „Philips
Semiconductors‟ in the early 1980‟s.
 The original intention of I2C was to provide an easy way of
connection between a microprocessor/microcontroller system
and the peripheral chips in Television sets.
 The I2C bus is comprised of two bus lines, namely; Serial Clock
– SCL and Serial Data – SDA
Serial Peripheral Interface (SPI) Bus
 The Serial Peripheral Interface Bus (SPI) is a synchronous bi-
directional full duplex four wire serial interface bus.
 The concept of SPI is introduced by Motorola. SPI is a single
master multi slave system.
 It is possible to have a system where more than one SPI device
can be master, provided the condition only one master device is
active at any given point of time, is satisfied.
 SPI is used to send data between Microcontrollers and small
peripherals such as shift registers, sensors, and SD cards.
Cont.
SPI requires four signal lines for communication. They are:
Master Out Slave In (MOSI): Signal line carrying the data from

master to slave device. It is also known as Slave Input/Slave Data


In (SI/SDI)
Master In Slave Out (MISO): Signal line carrying the data from

slave to master device. It is also known as Slave Output (SO/SDO)


Serial Clock (SCLK): Signal line carrying the clock signals

Slave Select (SS): Signal line for slave device select. It is an active

low signal
1-wire interface (protocol)
 1- Wire is a device communications bus system designed by
Dallas Semiconductor Corp. that provides low-speed data,
signaling, and power over a single conductor.
 1-Wire is similar in concept to I²C, but with lower data rates and
longer range. It is typically used to communicate with small
inexpensive devices such as digital thermometers and weather
instruments.
Cont.
Parallel communication:
 In data transmission, parallel communication is a method of
conveying multiple binary digits (bits) simultaneously. It
contrasts with communication.
 The communication channel is the number of electrical
conductors used at the physical layer to convey bits.
 Parallel communication implies more than one such conductor.
For example, an 8-bit parallel channel will convey eight bits (or a
byte) simultaneously, whereas a serial channel would convey
those same bits sequentially, one at a time. Parallel
communication is and always has been widely used within
integrated circuits, in peripheral buses, and in memory devices
such as RAM.
 The Product level communication interface‟ (External
Communication Interface) is responsible for data transfer
between the embedded system and other devices or modules
 It is classified into two types

1. Wired communication interface


2. Wireless communication interface:
Wired communication interface: Wired communication interface is
an interface used to transfer information over a wired network.
It is classified into following types.
1. RS-232C/RS-422/RS 485

2. USB
USB (UNIVERSAL SERIAL BUS)
 External Bus Standard.
 Allows connection of peripheral devices.
 Connects Devices such as keyboards, mice, scanners, printers,
joysticks, audio devices, disks.
 Facilitates transfers of data at 480 (USB 2.0 only), 12 or 1.5
Mb/s (Mega bits/second).
 Developed by a Special Interest Group including Intel,
Microsoft, Compact, DEC, IBM, Northern Telecom and NEC
originally in 1994.
 Low - Speed: 10 – 100 kb/s
 1.5 Mb/s signalling bit rate
 Full-Speed: 500 kb/s – 10 Mb/s 12 Mb/s signalling bit rate
 High-Speed: 400 Mb/s
ATmega32 Architecture
Cont.
 The CPU components are shaded blue.
 The memory components are shaded green.
 The clock components are shaded in orange.
 The I/O components are shaded in purple.
 The ATmega32 microcontroller uses Harvard architecture,
meaning that storage for instructions that make up the program
and storage for data operated upon by that program use
physically separate memory structures. The “program memory”
in the ATmega32 is 32K bytes in size
ATmega32 Highlights
 Native data size is 8 bits (1 byte).
 Uses 16-bit data addressing allowing it to address 216 = 65536
unique addresses.
 Has three separate on-chip memories
 2KiB SRAM

 8 bits wide
 used to store data
 1KiB EEPROM
 8 bits wide
 used for persistent data storage
 32KiB Flash
 16 bits wide
 used to store program code
Cont.
 I/O ports A-D
 Digital input/output

 Analog input

 Serial/Parallel

 Pulse accumulator
Programmers Model
 languages like C, C++, and Java require little, if any, knowledge
of the CPU's internal configuration.
 Assembly language requires knowledge of the internals of the
CPU since we are operating at a lower level.
 Machine language is the native language of the CPU
 Consists only of 1's and 0's.

 Is what we actually download to the controller's program

memory.
 Is stored in the .hex file generated by AVR studio.

 Program hierarchy:
 High-level language gets converted into assembly language

by a compiler.
 Assembly language gets converted into machine language by

an assembler.
CPU and Registers
Cont.
 Steps to execution
 Program Counter fetches program instruction from memory
 The PC stores a program memory address that contains the

location of the next instruction.


 The PC is initialized to 0x0 on reset/power up.

 When we placed the bootloader on the chip, we set a fuse that enables
a reset vector to load the PC with the address where the bootloader
program starts.
 When the program begins, the PC must contain the address of
the first instruction in the program.
 Program instructions are stored in consecutive program
memory locations.
 The PC is automatically incremented after each instruction.
Cont.
 Note: There are jump instructions that can modify the PC
(e.g., the PC must change when calling or returning from
some other routine).
 Places instruction in Instruction Register.
 Instruction Decoder determines what the instruction is.
 Arithmetic Logic Unit executes the instruction.
Cont.
 The CPU clock determines the timing of when instructions are
fetched and executed:
Cont.
Registers
 Directly accessed by the CPU/ALU — very fast.
 Registers contain:
 Address of the next instruction to fetch from program

memory (PC).
 Machine instruction to be executed (IR).

 "Input" data to be operated on by the ALU.

 "Output" data resulting from an ALU operation.

 General Purpose Registers


 There are 32 8 bit general purpose registers, R0-R31.
 X, Y, and Z are 16 bit registers that overlap R26-R31.
 Used as address pointers.

 Or to contain values larger than 8 bits (i.e., >255).

 Only register Z may be used for access to program memory.


Registers
 Certain operations cannot be performed on the first 16
registers, R0-R15
 LDI

 ANDI

 etc...

 CLR Rx does work on all registers.


 Other Registers
 Stack pointer (SP)
 Is 16 bits wide.

 Stores return address of subroutine/interrupt calls.

 May be used to store temporary data and local variables.


Status Register (SREG)
 Is 8 bits wide.
 Contains information associated with the results of the most
recent ALU operation.
 Carry flag (C) set if CY from most signficant bit (MSB).

 Often used when adding numbers that are larger than 8 bits. Here we
need to use an add with carry instruction (ADC) to add the next most
significant byte.
 Zero flag (Z) set if result is zero.
 BREQ instruction says branch if zero flag is set.
 BRNE instruction says branch if zero flag is not set.
 Negative flag (N) set if MSB is one.
 Arithmetic instructions change the flags
 Data transfer instructions do not change the flag.
 The instruction set documentation identifies which flags each
instruction may modify.
Status Register (SREG)
 Overflow flag (V) set if 2's complement overflow occurs.
 An overflow occurs if you get the wrong sign for your result, e.g.,
6410 + 6410 = -12810 (010000002 + 010000002 = 100000002).
 Note: whenever the carry into the MSB and the carry out don't match,
we have an overflow.
 Sign bit (S) s = N EXOR V.
 Half carry flag (H) is set when carry occurs from b3 to b4.
 Used with binary coded decimal (BCD) arithemtic.
Memory
Memory
 The address bus is 16 bits wide.
 The data bus is 8 bits wide.
 Program memory is stored on Flash from 0x0000 to 0x3FFF
(F_END).
 Our boot loader is loaded in the last 1KiB of the Flash

memory.
 SRAM is used for:
 32 General Purpose registers from 0x00 to 0x1F.

 64 I/O ports from 0x20 to 0x5F.

 User data from 0x60 to 0x85F (RAMEND).

 Note: the bootloader uses the last 32 bytes of data memory,

we will consider RAMEND-0x20 as the end of data RAM.


 ROM for user data is stored on EEPROM

You might also like