Chapter Two Hbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbandout RTES.docx
1. 1
Introduction:
Chapter 2
Embedded System Architecture
Typical embedded system mainly has two parts i.e., embedded hardware and embedded software.
Embedded hardware means microprocessors, microcontrollers, memory, bus, Input/output and
Controllers. Whereas embedded software includes embedded operating systems, different
applications and device drivers. The two architectures i.e. Harvard architecture and Von
Neumann architecture are used in embedded systems.
Harvard Architecture: It 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.
Fig 2.1 Harvard architecture
Von Neumann Architecture: It 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.
Fig 2.2 Von Neumann Architecture
2. 2
2.1 Architecture of Embedded System
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
:
Fig 2.3 Embedded system architecture block diagram
Embedded System Development Life Cycle (ESDLC):
Developing an embedded system mainly goes through the following development steps:
1. Requirement analysis 3. Design 5. Test 7. Maintenance
2. Examine 4. Develop 6. Deploy
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
3. 3
2 .2 ARM Cortex M0+ Hardware Overview
The ARM (Advanced RISC Machines) Cortex-M0+ processor is the most energy-efficient Arm
processor available for constrained embedded applications. The Cortex-M0+ processor builds on
the very successful Cortex-M0 processor, retaining full instruction set and tool compatibility, while
further reducing energy consumption and increasing performance.
The exceptionally small silicon area, low power and minimal code footprint of Cortex-M0+ enables
developers to achieve 32-bit performance at an 8-bit price point, bypassing the step to 16-bit
devices. The Cortex-M0+ processor come with a wide selection of options to provide flexible
development.
Fig 2.4 ARM Cortex M0+ Hardware architecture
AHB: Advanced High-performance Bus
Cortex: higher processer in the human brain, including memory, thinking, learning, reasoning,
problem-solving, emotions, consciousness and functions related to your senses.
The cortex family has three main categories which are namely.
Cortex-A (Application Processor cores)
Cortex-R (Real Time Application cores)
Cortex-M (Microcontroller Cores)
4. 4
M0+: Microprocessor (M0, M1, M2, M3, M4….)
Features and benefits
System:
ARM Cortex-M0+ processor (revision r0p1), running at frequencies of up to 30 MHz with
single-cycle multiplier and fast single-cycle I/O port.
ARM Cortex-M0+ built-in Nested Vectored Interrupt Controller (NVIC).
System tick timer.
AHB multilayer matrix.
Serial Wire Debug (SWD) with four break points and two watch points. JTAGboundary scan (BSDL)
supported.
Macro Trace Buffer (MTB).
Memory:
Up to 32 KB on-chip flash programming memory with 64 Byte page write and erase. Code
Read Protection (CRP) supported.
4 KB SRAM.
ROM API support:
Boot loader.
Flash In-Application Programming (IAP) and In-System Programming (ISP).
Digital peripherals:
High-speed GPIO interface connected to the ARM Cortex-M0+ IO bus with up to 29 General-
Purpose I/O (GPIO) pins with configurable pull-up/pull-down resistors, programmable open-
drain mode, input inverter, and digital filter. GPIO direction control supports independent
set/clear/toggle of individual bits.
High-current source output driver (20 mA) on four pins.
High-current sink driver (20 mA) on two true open-drain pins.
GPIO interrupt generation capability with boolean pattern-matching feature on eight GPIO
inputs.
Switch matrix for flexible configuration of each I/O pin function.
CRC engine.
DMA with 18 channels and 8 trigger inputs
Timers:
SCTimer / PWM with up to 4 capture inputs and 4 match output functions for timing and
PWM applications.
5. 5
Four channel Multi-Rate Timer (MRT) for repetitive interrupt generation at up to four programmable,
fixed rates.
Self Wake-up Timer (WKT) clocked from either the IRC, a low-power, low-frequency
internal oscillator, or an external clock input in the always-on power domain.
Windowed Watchdog timer (WWDT).
Analog peripherals:
One 12-bit ADC with up to 12 input channels with multiple internal and external trigger
inputs and with sample rates of up to 1.2 M samples. The ADC supports two independent
conversion sequences.
Serial peripherals:
One USART interface with pin functions assigned through the switch matrix and one
fractional baud rate generator.
Two SPI controllers with pin functions assigned through the switch matrix.
One I2C-bus interface. Supports Fast-mode Plus with 1 Mbit/s data rates on the open-drain
pins and listen mode.
Clock generation:
12 MHz internal RC oscillator trimmed to 1.5 % accuracy that can optionally be used as a
system clock.
Crystal oscillator with an operating range of 1 MHz to 25 MHz.
Programmable watchdog oscillator with a frequency range of 9.4 kHz to 2.3 MHz.
PLL allows CPU operation up to the maximum CPU rate without the need for a high-
frequency crystal. May be run from the system oscillator, the external clock input, or the
internal RC oscillator.
Clock output function with divider that can reflect all internal clock sources.
Power control:
Power consumption in active mode as low as 90 uA/MHz in low-current mode using the IRC
as the clock source.
Integrated PMU (Power Management Unit) to minimize power consumption.
Reduced power modes: Sleep mode, Deep-sleep mode, Power-down mode, and Deep power-
down mode.
Wake-up from Deep-sleep and Power-down modes on activity on USART, SPI, andI2C
peripherals.
Timer-controlled self wake-up from Deep power-down mode.
6. 6
Power-On Reset (POR).
Brownout detects (BOD).
2.3 Communication Protocols in Embedded Systems
Communication Protocols are a set of rules that allow two or more communication systems to
communicate data via any physical medium. The rules, regulations, synchronization between
communication systems. Protocols can be implemented by both hardware and software or
combination of both. Analog and digital communication systems use various communication
protocols widely.
Embedded System is an electronic system or device which employs both hardware and software. A
processor or controller takes input from the physical world peripherals like sensors, actuators etc.,
processes the same through appropriate software and provides the desired output. Each
communicating entity should agree to some protocol to exchange information. Many different
protocols are available for embedded systems and are deployed depending upon the application
area.
Types of Communication Protocols in Embedded Systems
2.3.1 Parallel and Serial Communication
Parallel Communication
In parallel communication, all the bits of data are transmitted simultaneously on separate
communication lines. Transmission is fast however parallel communication is costly as because to
transmit n bit, n wires or lines are required. For this reason, they are usually use for shorter distance
transmission such as in printers and hard disks.
7. 7
2.3.2 Serial Communication
For serial communication, the data bits are transmitted serially bit by bit on single communication
lines. They are hence less costly and can be used for long distance transmission such as in telephone
communications.
2.4 Inter system and Intra system communication
2.4.1 Inter System Communication Protocols
Inter system protocols establish communication between two communicating devices i.e. between
PC and microprocessor kit, developmental boards, etc. In this case, the communication is achieved
through inter bus system.
2.5 ATmega32 microcontroller Architecture
Today’s microcontrollers are much different from what it were in the initial stage, and the number
of manufacturers are much more in count than it was a decade or two ago. At present some of the
major manufacturers are Microchip (publication: PIC microcontrollers), Atmel (publication: AVR
microcontrollers), Hitachi, Phillips, Maxim, NXP, Intel etc. Our interest is upon ATmega32. It
belongs to Atmel’s AVR series micro controller family. Let’s see the features
The AVR (Alf Vegard RISC) microcontroller is based on the Advanced Reduced Instruction Set
Computer (RISC) architecture. ATmega32 microcontroller is a low power CMOS technology based
controller. Due to RISC architecture AVR microcontroller can execute 1 million of instructions per
second if cycle frequency is 1 MHz provided by crystal oscillator.
8. 8
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
9. 9
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
2KB SRAM
8 bits wide
used to store data
1KB EEPROM
8 bits wide
used for persistent data storage
32KB Flash
16 bits wide
used to store program code
I/O ports A-D
Digital input/output
Analog input
Serial/Parallel
Pulse accumulator
About Microprocessor & Microcontroller:
A microprocessor is a component used for high processing applications. It operates at a high speed.
The clock speed can differ from 1GHz to 4GHz. It uses more RAM and can vary from 512MB to 32GB.
The hard disk can have 128GB to 2TB for more storage. Moreover, a microprocessor has peripheral
interfaces such as USB, UART, and high-speed Ethernet.
In a microprocessor chip, the memory elements and the IO devices are connected externally to the CPU.
In other words, RAM, ROM, serial interfaces, IO ports, timers are connected to the CPU externally.
Some common applications that use microprocessors are computers and laptops. Their applications
perform multiple processing activities such as web browsing, mathematical calculations, document
creation, gaming, image editing and many more.
A microcontroller performs a specific task. The microcontroller receives inputs and provides the
output according to the given input. The inputs can be user inputs, or they can be obtained from sensors.
A microcontroller does not operate on very high clock speed. It can be from 1MHz to 300MHz. The
RAM can be either from 2KB up to 256KB. It can have a flash memory of 32KB to 2MB. Moreover, a
microcontroller contains peripheral interfaces such as I2C, UART, and SPI.
In a microcontroller, CPU, RAM, ROM, IO ports, serial interfaces and timers are integrated into a
single chip. Overall, microcontrollers are used for embedded systems such as microwave ovens and
washing machines. These devices are designed to perform a particular task.