61
Unit I Embedded System Dr. P. H. Zope Assistant Professor SSBTs COET Bambhori Jalgaon North Maharashtra University India [email protected] 09860631040

Unit-I Basic Embedded System Notes

Embed Size (px)

Citation preview

Page 1: Unit-I Basic Embedded System Notes

Unit I

Embedded System

Dr. P. H. Zope Assistant Professor

SSBT s COET Bambhori Jalgaon

North Maharashtra University India

[email protected]

09860631040

Page 2: Unit-I Basic Embedded System Notes

UNIT I

Embedded system Introduction:

Introduction to Embedded System, History, Design challenges, optimizing design metrics,

time to market, applications of embedded systems and recent trends in embedded systems,

embedded design concepts and definitions, memory management, hardware and software

design and testing, communication protocols like SPI, SCI, I2C, CAN etc

Lectures 10, Marks 20

UNIT II

System Architecture:

Introduction to ARM core architecture, ARM extension family, instruction set, thumb

Instruction set, Pipeline, memory management, Bus architecture,

study of on-chip peripherals like I / O ports, timers, counters, interrupts, on-chip ADC, DAC,

RTC modules, WDT, PLL, PWM, USB etc. Lectures 10, Marks 20

UNIT III

Interfacing and Programming:

Basic embedded C programs for on-chip peripherals studied in system architecture. Need of

interfacing, interfacing techniques, interfacing of different displays including Graphic LCD

(320X240), interfacing of input devices including touch screen etc, interfacing of output

devices like thermal printer etc., embedded communication using CAN and Ethernet, RF

modules, GSM modem for AT command study etc. Lectures 10, Marks 20

Syllabus Embedded System

Page 3: Unit-I Basic Embedded System Notes

UNIT IV

Real Time Operating System Concept:

Architecture of kernel, task scheduler, ISR, Semaphores, mailbox, message queues, pipes,

events, timers, memory management, RTOS services in contrast with traditional OS.

Introduction to Ucos II RTOS, study of kernel structure of Ucos II, synchronization in Ucos II,

Inter-task communication in Ucos II, memory management in Ucos II, porting of RTOS.

Lectures 10, Marks 20

UNIT V

Embedded Linux:

Introduction to the Linux kernel, Configuring and booting the kernel, the root file system,

Root file directories, /bin, /lib etc., Linux file systems, Types of file system: Disk, RAM, Flash,

Network. Some debug techniques- Syslog and strace, GDB, TCP / IP Networking- Network

configuration, Device control from user space- Accessing hardware directly, Multi

processing on Linux and Inter Process Communication- Linux process model and IPCs,

Multithreading using pThreads - Threads verses Processes and pThreads, Linux and Real-

Time Standard kernel problems and patches. Lectures 10, Marks 20

Syllabus Embedded System

Page 4: Unit-I Basic Embedded System Notes
Page 5: Unit-I Basic Embedded System Notes

5

UNIT I

Embedded system Introduction:

An embedded system is a computer system (a combination of hardware and

software) with a dedicated function within a larger mechanical or electrical

system, often with real-time computing constraints.

Embedded systems (ES) = information processing systems embedded into a larger product

It is embedded as part of a complete device often including hardware and

mechanical parts.

Embedded systems control many devices in common use today.

• An example of an embedded system is a microprocessor that controls an automobile

engine. • An embedded system is designed to run on its own without human intervention, and

may be required to respond to events in real time.

What is an Embedded System?

Page 6: Unit-I Basic Embedded System Notes

Applications

Areas

Page 7: Unit-I Basic Embedded System Notes

Application Areas • TV • ste eo • e ote o t ol • pho e / o ile pho e • ef ige ato • i o a e • ashi g a hi e • ele t i tooth ush • o e / i e o ead ooke • at h • ala lo k • ele t o i usi al i st u e ts • ele t o i to s (stuffed animals,handheld toys, pinballs, etc.) • edi al ho e e uip e t (e.g. blood pressure, thermometer) • … • [PDAs?? Mo e like sta da d o pute s ste ] Consumer Products

Page 8: Unit-I Basic Embedded System Notes

Application Areas

• Medical Systems

– pace maker, patient monitoring systems, injection systems, intensive a e u its, …

• Office Equipment

– p i te , opie , fa , …

• Tools

– ulti ete , os illos ope, li e teste , GPS, …

• Banking

– ATMs, state e t p i te s, …

• Transportation

– (Planes/Trains/[Automobiles] and Boats)

• ada , t affi lights, sig alli g s ste s, …

Page 9: Unit-I Basic Embedded System Notes

Application Areas

• Automobiles

– engine management, trip computer, cruise control,

immobilizer, car alarm,

– ai ag, ABS, ESP, …

• Building Systems

– elevator, heater, air conditioning, lighting, key card

e t ies, lo ks, ala s ste s, …

• Agriculture

– feedi g s ste s, ilki g s ste s, …

• Space

– satellite s ste s, …

Page 10: Unit-I Basic Embedded System Notes

Examples of embedded systems

• PDA

• Microwave

• Programmable washing Machine

• Digital answering machine

• GPS

• Intelligent credit card

• Cruise control

• Car engine timing

Page 11: Unit-I Basic Embedded System Notes

Examples of embedded systems

• Industrial controller

• Guided missiles

• Digital TV

• Flight controller

• Measuring instruments

• Medical instruments

• Gaming devices

• and on and on ……

Mars, December 3, 1999 Crashed due to uninitialized variable

Page 12: Unit-I Basic Embedded System Notes

Embedded system Configuration

Hardware

Operating

System

Programs

Hardware

Including Operating

System Components

User Program

Typical Embedded system

Configuration

Typical Computer system

Configuration

Page 13: Unit-I Basic Embedded System Notes
Page 14: Unit-I Basic Embedded System Notes

A Typical Embedded System

Algorithms for

Digital Control

Data Logging

Data Retrieval

and Display

Operator

Interface

Interface Engineering

System

Remote

Monitoring System

Real-Time

Clock

Database

Ope ato s

Console

Display

Devices

Real-Time Computer

Page 15: Unit-I Basic Embedded System Notes
Page 16: Unit-I Basic Embedded System Notes

Embedded Hardware

• CPU – Intel x86

– PowerPC(Mac) G3,G4,G5

– SPARC, Alpha

– ARM

– MIPS

– ……

• DATA Wide – 8 Bit controllers(still!)

– 16 Bit controllers(mainly)

– 32 Bit controllers(start popular)

– 64 Bit controllers(high performance)

Page 17: Unit-I Basic Embedded System Notes

Characteristics of Embedded Systems

Page 18: Unit-I Basic Embedded System Notes

Characteristics of Embedded Systems

Page 19: Unit-I Basic Embedded System Notes
Page 20: Unit-I Basic Embedded System Notes

CHARACTERISTICS OF EMBEDDED SYSTEMS

• Single Functioned

• Tightl Co st ai t • ‘eal Ti e a d ‘ea ti e

• Co ple Algo ith s

• Use I te fa e

• Multi ‘ate

Page 21: Unit-I Basic Embedded System Notes

An Embedded System can execute a specific function repeatedly

i.e., dedicated function

Single Functioned

As an example, Air conditioner will be cooling the room. Cooling is

its dedicated functionality and it cannot be used for any other

purposes. AC a t be used for making calls.

Likewise mobile phone is an Embedded System that can be used to

make and receive calls and it a t be used for controlling room

temperature.

Page 22: Unit-I Basic Embedded System Notes

Consider the list of embedded systems that are being used every day.

1. Pager.

2. Microwave oven.

3. Mobile phone.

4. ATMs.

5. Car braking systems.

6. Automobile cruise controllers.

7. Pace makers.

8. Modem.

9. Network cards and many more.

Page 23: Unit-I Basic Embedded System Notes

Tightly Constraint

Whatever system is being designed, they have constraints. Embedded

Systems are also tightly constraint in many aspects. Few aspects are

being analyzed here.

1. Manufacturing Cost

2. Performance

3. Size

4. Power

The above four parameters decide the success of Embedded System.

Page 24: Unit-I Basic Embedded System Notes

Real Time and Reactive

What is real time? —A nice question to start with!

Take an instance of travel in BMW car. (Great feel it would be).

(The braking system is an embedded system). And unfortunately a

lorry is coming opposite to the car... The driver is applying brake

there!. What would be the action required? It should immediately

stop the car right. This is a real time and reactive behaviour. The brake

may be applied at any point in time. And the vehicle should be

stopped immediately at the instance of applying brake. It is never

known when brake has to be applied, so the system should be ready

to accept the input at any time and should be ready to process it.

Page 25: Unit-I Basic Embedded System Notes

Few examples can be spotted for Real time and Reactive behavior

of an Embedded System:

(a) Pace Maker’s action. (b) Flights Landing Gear Control.

(c) ECG Machines output.

A d so o … Ma e a ples ould e ited he e!

Page 26: Unit-I Basic Embedded System Notes

Complex Algorithms

The processor inside the embedded system should perform

operations that are complex in nature.

An example is digital camera. It is used to take color photographs,

motion pictures, black and white pictures, etc. It needs to pull in lots

of complex algorithms for performing all the above mentioned

operations.

So as a point to conclude, every embedded system will have lots of

complex algorithms running inside it.

Page 27: Unit-I Basic Embedded System Notes

User Interface

Multi Rate

Embedded Systems need to control and drive certain operations at

one rate and certain other operations at different rate. Example can

be Digital Camera. It is used to take pictures which are still. Also it is

capable of shooting video. So it has to be capable of driving the first

operation from a speed different than the second one.

Designing system with easier and comfortable interface is most

important. Also it should have options required for the operation of

the device.

Example is ATM machine; it has got comfortable interfaces and

options.

Page 28: Unit-I Basic Embedded System Notes

28

Characteristics of Embedded Systems

• Application-specific functionality – specialized for one or one

class of applications

• Deadline constrained operation – system may have to perform

its function(s) within specific time periods to achieve successful

results

• Resource challenged – systems typically are configured with a

modest set of resources to meet the performance objectives

• Power efficient – many systems are battery-powered and must

conserve power to maximize the usable life of the system.

• Form factor – many systems are light weight and low volume to

be used as components in host systems

• Manufacturable – usually small and inexpensive to manufacture

based on the size and low complexity of the hardware.

Page 29: Unit-I Basic Embedded System Notes

CHALLENGES IN DESIGNING AN EMBEDDED SYSTEM

Page 30: Unit-I Basic Embedded System Notes

Meeting Deadlines

How can the deadline be met that is meant for the product? Meeting

deadline accurately will need high speed hardware. Increasing

hardware components with quality would increase the cost of the

product. This is the first challenge in front of designers.

Hardware Selection

Embedded Systems never had a luxury of having much hardware. Taking

memory into consideration first, Embedded Systems will have very little

inbuilt memory.

Adding more memory of smaller size will increase cost factor. So keep

memory only as much as needed. It can have an expansion slot for the

system, if user is willing to expand memory, who bothers, let user expand.

Coming to processor selection, if a very high speed processor is selected, it

would end up in draining the battery at the earliest. But it a t be

compromised with speed also. So select a processor that perfectly fits in

with requirement. Too high speed processor would cost more and can drain

battery also.

Page 31: Unit-I Basic Embedded System Notes

Is it upgradable and maintainable?

Will it work?

Assume that a mobile phone has been designed and it is released in the market.

But after reaching people the product was found with problems in one or two aspects. The

developer would know that problem and it can be fixed. But how will it reach the phone that

had already reached public?

So it must be supporting with upgradation of versions of software for it. Keep this in mind

that the product should be upgradable with the same hardware! Secondly, when writing

software for embedded systems, it should be kept in mind on maintainability. The code

should not be just written in such a way that only developer who developed it can

understand. It should be understandable for other engineers also. Other engineers should

also be able to understand and fix bugs in the code if any, if need be.

Nice Question. Is t it? Yeah. Please ensure if the system that has been designed is really

working fine. How can it be ensured? Through rigorous testing it is possible; it needs to be

proceeded with testing in many ways. First can be unit testing, next stage is Sanity Testing

and the third stage can be Regression testing.

Also even if the product has entered, it has to be constantly monitored. If any customer

complaint rises, that bug has to be looked into and has also to be fixed. And more

importantly, the bug that is fixed should not introduce any new bugs. Let s now get to know

about the categorization of the embedded systems!

Page 32: Unit-I Basic Embedded System Notes

32

Design Constraints

Page 33: Unit-I Basic Embedded System Notes

33

Design Challenges

• Does it really work?

– Is the specification correct?

– Does the implementation meet the spec?

– How do we test for real-time characteristics?

– How do we test on real data?

• How do we work on the system?

– Observability, controllability?

– What is our development platform?

• More importantly – optimising design metrics!!

Page 34: Unit-I Basic Embedded System Notes

CATEGORIZATION OF EMBEDDED SYSTEMS

Embedded Systems can be categorized based on the complexity in

building, cost factors, purpose of the system, tools and other related

environment availability, etc.

Page 35: Unit-I Basic Embedded System Notes
Page 36: Unit-I Basic Embedded System Notes

Features of an embedded system

Embedded systems do a very specific task, they cannot be

programmed to do different things.

• Embedded systems have very limited resources, particularly the memory. Generally, they do not have secondary storage devices such as the CDROM or the floppy disk.

• Embedded systems have to work against some deadlines. A specific job has to be completed within a specific time. In some embedded systems, called real-time systems, the deadlines are stringent. Missing a dead line may cause a catastrophe – loss of life or damage to property.

Page 37: Unit-I Basic Embedded System Notes

• Embedded systems are constrained for power, As many embedded systems operate through a battery, the power consumption has to be very low.

• Embedded systems need to be highly reliable. Once in a while, pressing ALT-CTRL-DEL is OK on your desktop, but you cannot afford to reset your embedded system.

• Some embedded systems have to operate in extreme environmental conditions such as very high temperatures and humidity.

Page 38: Unit-I Basic Embedded System Notes

• Embedded systems that address the consumer market (for example electronic toys) are very cost-effective. Even a reduction of Rs.10 is lot of cost saving, because thousands or millions systems may be sold.

• Unlike desktop computers in which the hardware platform is dominated by Intel and the operating system is dominated by Microsoft, there is a wide variety of processors and operating systems for the embedded systems. So, choosing the right platform is the most complex task .

Page 39: Unit-I Basic Embedded System Notes

Classification of Embedded Systems

Based on functionality and performance requirements,

embedded systems are classified as :

• Stand-alone Embedded Systems

• Real-time Embedded Systems

• Networked Information Appliances

• Mobile Devices

Page 40: Unit-I Basic Embedded System Notes

Stand-alone Embedded Systems

As the name implies, stand-alone systems work in stand-

alone mode. They take inputs, process them and

Produce the desired output.

The input can be electrical signals from transducers or

commands from a human being such as the pressing of a

button.

The output can be electrical signals to drive another

System,an LED display or LCD display for displaying of

Information to the users.

Embedded systems used in process control, automobiles,

consumer electronic items etc. fall into this category.

Page 41: Unit-I Basic Embedded System Notes

Real-time Systems

Embedded systems in which some specific work has to be

done in a specific time period are called real-time systems.

For example, consider a system that has to open a valve

within 30 milliseconds when the humidity crosses a

particular threshold.

If the valve is not opened within 30 milliseconds, a

catastrophe may occur.

Such systems with strict deadlines are called hard real-

time systems.

Page 42: Unit-I Basic Embedded System Notes

In some embedded systems, deadlines are imposed, but

not adhering to them once in a while may not lead to a

catastrophe.

For example, consider a DVD player. Suppose, you give a

command to the DVD player from a remote control, and

there is a delay of a few milliseconds in executing that

command.

But, this dela o t lead to a se ious i pli atio . Su h

systems are called soft real-time systems .

Page 43: Unit-I Basic Embedded System Notes

Hard Real-Time Embedded System

Page 44: Unit-I Basic Embedded System Notes

Networked Information Appliances

Embedded systems that are provided with network

interfaces and accessed by networks such as Local Area

Network or the Internet are called networked information

appliances.

Such embedded systems are connected to a network,

typically a network running TCP/IP (Transmission Control

Protocol/Internet Protocol) protocol suite, such as the

Internet or a o pa s Intranet.

These systems have emerged in recent years. These

systems run the protocol TCP/IP stack and get connected

through PPP or Ethernet to an network and communicate

with other nodes in the network.

Page 45: Unit-I Basic Embedded System Notes

Here are some examples of such systems

• A networked process control system consists of a number of embedded systems connected as a local area network.

• Each embedded system can send real-time data to a central location from where the entire process control system can be monitored.

• The monitoring can be done using a web browser such as the Internet Explorer.

• A web camera can be connected to the Internet. The web camera can send pictures in real-time to any computer connected to the Internet.

• In such a case, the web camera has to run the HTTP server software in addition to the TCP/IP protocol stack.

Page 46: Unit-I Basic Embedded System Notes

The door lock of your home can be a small

embedded system with TCP/IP and HTTP server

software running on it.

When your children stand in front of the door lock

after they return from school, the web camera in the

door-lock will send an alert to your desktop over the

Internet and then you can open the door-lock

through a click of the mouse.

Page 47: Unit-I Basic Embedded System Notes

This slide shows a weather monitoring system connected

to the Internet. TCP/IP protocol suite and HTTP web

server software will be running on this system. Any

computer connected to the Internet can access this

system to obtain real-time weather information.

Page 48: Unit-I Basic Embedded System Notes

The networked information appliances need to run the

complete TCP/IP protocol stack including the application

layer protocols. If the appliance has to provide

information over the Internet, HTTP web server software

also needs to run on the system.

Page 49: Unit-I Basic Embedded System Notes

Mobile Devices

Mobile devices such as mobile phones, Personal Digital

Assistants (PDAs), smart phones etc. are a special

category of embedded systems. Though the PDAs do

many general purpose tasks, they need to be designed

just like the o e tio al e edded s ste s.

Page 50: Unit-I Basic Embedded System Notes

The limitations of the mobile devices – memory

constraints, small size, lack of good user interfaces such as

full fledged keyboard and display etc. are same as those

found in the embedded systems discussed above. Hence,

mobile devices are considered as embedded systems.

However, the PDAs are now capable of supporting general

purpose application software such as word processors,

games, etc.

Page 51: Unit-I Basic Embedded System Notes

51

Design challenge – optimizing design metrics

• Common metrics

• NRE cost (Non-Recurring Engineering cost): The

one-time monetary cost of designing the system

• Unit cost: the monetary cost of manufacturing each copy of

the system, excluding NRE cost

• Size: the physical space required by the system

• Performance: the execution time or throughput of the

system

• Power: the amount of power consumed by the system

• Flexibility: the ability to change the functionality of the

system without incurring heavy NRE cost

Page 52: Unit-I Basic Embedded System Notes

52

Design Metrics

• Common metrics (continued)

• Time-to-prototype: the time needed to build a working version

of the system

• Time-to-market: the time required to develop a system to the

point that it can be released and sold to customers

• Maintainability: the ability to modify the system after its initial

release

• Correctness, safety, many more

Page 53: Unit-I Basic Embedded System Notes

53

Trade-off in Design Metrics • Expertise with both

software and hardware

is needed to optimize

design metrics

– Not just a hardware or

software expert, as is

common

– A designer must be

comfortable with various

technologies in order to

choose the best for a

given application and

constraints

Size Performance

Power

NRE cost

Page 54: Unit-I Basic Embedded System Notes

54

Time-to-market: a demanding design metric

• Time required to develop

a product to the point it

can be sold to customers

• Market window

– Period during which the

product would have highest

sales

• Average time-to-market

constraint is about 8

months

• Delays can be costly

Re

ven

ue

s ($

)

Time (months)

Page 55: Unit-I Basic Embedded System Notes

55

Losses due to delayed market entry

• Simplified revenue model

– Product life = 2W, peak at W

– Time of market entry defines

a triangle, representing

market penetration

– Triangle area equals revenue

• Loss

– The difference between the

on-time and delayed triangle

areas

On-time Delayed

entry entry

Peak revenue

Peak revenue from

delayed entry

Market rise Market fall

W 2W

Time

D

On-time

Delayed

Re

ven

ue

s ($

)

Page 56: Unit-I Basic Embedded System Notes

56

Time to Market Design Metric

• Simplified revenue model Product life = 2W, peak at W

Time of market entry defines a triangle,

representing market penetration

Triangle area equals revenue

• Loss The difference between the on-time and delayed

triangle areas

• Avg. time to market today = 8 mth • 1 day delay may amount to $Ms

On-time Delayed

entry entry

Peak revenue

Peak revenue from

delayed entry

Market

rise

Market

fall

W 2W

Time

D

On-time

Delayed

Rev

enu

es (

$)

Page 57: Unit-I Basic Embedded System Notes

57

NRE and unit cost metrics

• But, must also consider time-to-market

$0

$40,000

$80,000

$120,000

$160,000

$200,000

0 800 1600 2400

A

B

C

$0

$40

$80

$120

$160

$200

0 800 1600 2400

Number of units (volume)

A

B

C

Number of units (volume)

tota

l co

st (

x10

00

)

pe

r p

rod

uc

t c

ost

• Compare technologies by costs -- best depends on quantity Technology A: NRE=$2,000, unit=$100 Technology B: NRE=$30,000, unit=$30 Technology C: NRE=$100,000, unit=$2

Source: Embedded System Design:

Frank Vahid/ Tony Vargis (John Wiley &

Sons, Inc.2002)

Page 58: Unit-I Basic Embedded System Notes

Example The design of a particular disk drive has an NRE cost of $100,000 and a unit cost of

$20. How much will we have to add to the cost of each product to cover our NRE

cost, assuming we sell: (a) 100 units, and (b) 10,000 units?

Page 59: Unit-I Basic Embedded System Notes

(a) added cost = NRE / # units produced

= $100,000 / 100

= $1,000

(b) added cost = NRE / # units produced

= $100,000 / 10,000

= $10

Example The design of a particular disk drive has an NRE cost of $100,000 and a unit cost of

$20. How much will we have to add to the cost of each product to cover our NRE

cost, assuming we sell: (a) 100 units, and (b) 10,000 units?

Page 60: Unit-I Basic Embedded System Notes

Example For a particular product, you determine the NRE cost and unit cost to be the

following for the three listed IC technologies: FPGA: ($10,000, $50); ASIC:

($50,000, $10); VLSI: ($200,000, $5). Determine precise volumes for which each

technology yields the lowest total cost.

Page 61: Unit-I Basic Embedded System Notes

Example For a particular product, you determine the NRE cost and unit cost to be the

following for the three listed IC technologies: FPGA: ($10,000, $50); ASIC:

($50,000, $10); VLSI: ($200,000, $5). Determine precise volumes for which each

technology yields the lowest total cost.

Total cost = NRE cost + (unit cost * # units produced)

FPGA = 10,000 + 50x

ASIC = 50,000 + 10x

VLSI = 200,000 + 5x

10,000 + 50x = 50,000 + 10x

40x = 40,000

x = 1,000

50,000 + 10x = 200,000 + 5x

5x = 150,000

x = 30,000

Technology Amount

FPGA < 1,000 units

ASIC 1,000 - 30,000 units

VLSI > 30,000 units