Top Banner
Embedded Systems Basics Dr. N. Mathivanan Visiting Professor Department of Instrumentation and Control Engineering National Institute of Technology TRICHY, TAMILNADU INDIA
31

Embedded systems basics

Apr 15, 2017

Download

Engineering

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Embedded systems basics

Embedded Systems Basics

Dr. N. Mathivanan Visiting Professor

Department of Instrumentation and Control Engineering

National Institute of Technology

TRICHY, TAMILNADU

INDIA

Page 2: Embedded systems basics

• Embedded System (Embedding a computer)

o That has built-in small computer (not general-purpose)

o Software embedded with it, preprogrammed.

o Not programmable by users and not visible to users

o It is a part of a larger system

o System performing single function, repeatedly.

o Starts by itself and runs independently without human

intervention.

o Responds, monitors, controls external environment

o Uses sensors, actuators and has analog interfacing

o Generally built around microcontroller

N. Mathivanan

Page 3: Embedded systems basics

• Examples

Household appliance: Oven, DVD Player, Washing machine, Digi Camera

Automobile: Engine, brake, door, climate, stability controls

Computer peripheral controllers: Keyboard, disk drive, LAN

Computer peripheral: Printer, scanner,

Communication and networking device: Router

Building automation: safety, security, utility management systems

Bio-Medical: ECG recorder, Patient monitoring system

Industrial systems: Robotics, CNC machine controller

Environmental parameters monitoring: Temp., wind speed, RH

Scientific equipments: Spectrum analyzer, Storage oscilloscopes,

Entertainment: TV, Audio/Video equipments

Surveillance systems: Video camera, bio-metric, smart card reader N. Mathivanan

Page 4: Embedded systems basics

• Applications Simple Control: Front panel control of oven, Remote controller, etc.

Image Processing: Decompression, Descrambling in TV set top box

Signal Processing: DVD players

Data Acquisition: data loggers, remote data loggers, transmitters

Network Control: GPIB controller, CAN bus, Ethernet, surveillance

• Camera

Typically 3 microcontrollers are used,

A 32-bit mC provides auto-focus fn.

• Automobile

More than 100 microcontrollers provide ABS, ESC, etc. functions

4-bit mC checks seat belt, 8-bit mC manages dashboard function,

Networked,

N. Mathivanan

Page 5: Embedded systems basics

Embedded System Classification

• Based on functionality

Stand-alone, Networked, Real-time, Wireless

• Based on performance of microcontroller

Small scale:

Single 8/16-bit, mC/mP, little HW, SW complexity, battery operated

Medium scale:

Single/few 16/32-bit mC/DSP, RISC based, HW, SW complex,

Uses SW development tools – IDE, Simulators, debuggers

Large scale:

Large HW, SW complexity, Networking,

N. Mathivanan

Page 6: Embedded systems basics

• Embedded System Characteristics:

Low power Consumption*,

High Code Density,

Limited resources (less memory, no hard-disk)

Run time efficiency,

Real-time operation? (not required in all systems),

Sophisticated functionality, Weight, Cost

May have to withstand extreme environmental conditions

(high temperature and humidity)

Choosing right hardware and software platforms a complex task

(based on user application)

• Designer objective: To find cheapest solution that meets requirements

N. Mathivanan

Page 7: Embedded systems basics

Typical Embedded System

• Differential drive mobile robot

UART

PWM

ZigBee

Slot Sensor

Transiever

(LPC2129)

GPIO

INTSlot Sensor

EXT

MICROCONTROLLER

DRIVER

M

M

N. Mathivanan

Page 8: Embedded systems basics

• Embedded System Hardware

CPU: Processor/Microcontroller/Embedded Processor

Memory: EEPROM, SRAM,

Controllers: Memory, Bus, interrupt & DMA controllers

Peripherals: ADC, DAC, Timer/Counter, PWM, RTC

Communication interfaces: UART, I2C, SPI, USB

Network interfaces: CAN, Ethernet,

Power Control

I/O Mapping: Memory mapped I/O, I/O mapped I/O

N. Mathivanan

Page 9: Embedded systems basics

Sensors with associated signal conditioners

Actuators with associated drivers

Storage devices:

User interfaces -

Inputs: switches, touch pad, etc.

Outputs: Display devices, indicators

Reset (WDT),

Power supply,

Clock (crystal oscillator),

N. Mathivanan

Page 10: Embedded systems basics

• Embedded System Software Operating system:

Provides interface between user and hardware

Manages system resources

Memory, CPU, Device, File management

Controls execution of all kinds of programs

Provides security

Real-Time Operating System

Ensures to finish operations by deadline

Hard Real-Time

missing deadline results in system failure (safety critical)

Soft real-time:

missing deadline results in degraded performance

(playing video)

N. Mathivanan

Page 11: Embedded systems basics

• Embedded System Software Continued….. Software Development Tools

IDE, Cross Compilers, Emulators, Simulators

Debug tools

Debugger

Application software

N. Mathivanan

Page 12: Embedded systems basics

Flash Memory Reprogramming

• In-System Programming (ISP)

Requires running program to be stopped

System set to programming mode

Restarted after reprogramming is completed

• In-Application Programming (IAP)

Target board can be reprogrammed while application is running

N. Mathivanan

Page 13: Embedded systems basics

System Development Process

Hardware Software

Analyze requirements Develop program codes using tools

Define specifications Download to target system

Design block level architecture Test and Debug

Design component level hardware Repeat the above cycle till test O.K.

Assemble the target system

N. Mathivanan

Page 14: Embedded systems basics

Microprocessor based system

• Microprocessor, ROM, RAM, I/O ports, shared bus

• Data transfer – between CPU and ROM / RAM / IO ports

• No memory to memory or between memory and I/O transfers

• The above transfer only with DMA controller

N. Mathivanan

Page 15: Embedded systems basics

Microcontroller Internal Architecture

• Wide range of microcontrollers each targeted for particular appln.

• Computers are designed to have RISC / CISC architecture and Von

Neumann / Harvard architecture.

N. Mathivanan

Page 16: Embedded systems basics

Reduced Instruction Set Computer - RISC Type of processor architecture that utilizes highly optimized small set

of instructions.

Characteristics:

• Executes every instruction in one cycle (one cycle/instruction).

• All instructions have fixed length.

• Allows pipelining technology in which instruction fetch, decode

and execute stages to take place simultaneously.

• Generally incorporates large number of registers to reduce

number of memory accesses.

• Uses Load/Store instructions to access memory

• Uses less silicon, pin count, and runs at high clock speed

• Programs are lengthier (occupies more memory)

• Real-time applications

N. Mathivanan

Page 17: Embedded systems basics

• Emphasis on software

• Examples: Atmel AVR, PIC, ARM microcontrollers

N. Mathivanan

Page 18: Embedded systems basics

Primary objective of CISC architecture is to allow the use of less

amount of memory space for a program

Characteristics:

• Emphasis on hardware

• Programs are shorter (high code density) and hence execution

faster

• Very large instruction set, instructions variable length

• Instruction pipelining cannot be implemented easily, (complicated)

• More specialized addressing modes are implemented

• Normally used in PCs, Workstations, Servers

• Examples: Intel x86 variants

Complex Instruction Set Computer - CISC

N. Mathivanan

Page 19: Embedded systems basics

Von Neumann Architecture

Computer architecture that shares single common bus system

for program and data. (single storage place for storing program,

data)

Characteristics

• Have shared signals and memory for program and data

• Fetches first instruction from program memory and then data from

data memory – slows down the program execution

• Bus width same for code and data

• Design of control unit is simple

• Used in PCs, Workstations, high performance computers

N. Mathivanan

Page 20: Embedded systems basics

Harvard Architecture

Computer architecture that uses separate signals and

storage for program and data memory

Characteristics

• Allows simultaneous access of program and data

• Usually program memory is read-only and data memory is read-

write

• Width of program and data memory may be different

• Allows pipelining

• Used in embedded computers, digital signal processors

• Design of control unit is complex

• Free data memory cannot be used for instruction and vice-versa

N. Mathivanan

Page 21: Embedded systems basics

Von Neumann vs. Harvard

CPU

Program

ProgramCPU

Decoder

Control

Decoder

Von Neuman Architecture

Data

Addr

Control

Registers

Data

Registers

Addr Addr

Data

Control

Instruction Instruction

Memory MemoryData Data

Memory

Memory

Harvard Architecture

N. Mathivanan

Page 22: Embedded systems basics

Microprocessor vs. Microcontroller

Microprocessor

Basic components

ALU, Accumulator, Registers, Control

Unit, Instruction Decoder, Bus

Microcontroller

Basic Components

CPU, ROM, RAM, Peripherals, I/O ports, Serial interfaces, Controllers, Bus

N. Mathivanan

Page 23: Embedded systems basics

Microcontrollers

PIC16F84A ARM7-TDMI Based LPC2148

N. Mathivanan

Page 24: Embedded systems basics

8051 AT

89S52 68HC11

Atmega

328

PIC

16F84A

PIC

18F452

ARM7-

TDMI-S

LPC2148

ARM

Cortex-M3

LPC1768

CPU 8-bit 8-bit 8-bit 8-bit 8-bit 8-bit 16-bit/

32-bit

16-bit/

32-bit

Data Bus /

Instr bus 8-bit 8-bit 8-bit 8-bit

8-bit /

14-bit

8-bit /

16-bit

32-bit /

32-bit

32-bit /

32-bit

Address bus 16-bit 16-bit 16-bit 16-bit 14-bit 16-bit 32-bit 32-bit

Clock Speed 12 MHz 0–33 MHz 0–4 MHz 20 MHz 20 MHz 0–40 MHz 10–25 MHz 0-100 MHz

Memory

Program

Memory

Int - 4 KB

Extl - 64 KB

8 KB

(flash) 8 KB 32 KB

14-bits

1 KB 32 KB 512 kB 512 kB

Data

Memory

128 B

(64 KB ext) 256 B 256 B 2 KB

RAM - 68B

EEPROM-64B

RAM-1536 B

EEPROM-256B

32 KB +

8 KB

Up to

64 KB

Interrupts 5 8 18 2 4 18 22

DMA

Channels No No No No No No

One

(for USB)

8 Channel

Gen purpose

I/O ports 4 x 8-bit

32 I/O lines

4 x 8-bit

32 I/O

40 I/O

lines 23/28/32 13

4 x 8-bit

1 x 3-bit 45 pins 70 / 52

Comparing Microcontrollers

N. Mathivanan

Page 25: Embedded systems basics

Peripherals

8051 AT

89S52 68HC11

Atmega

328

PIC

16F84A

PIC

18F452

ARM7-

TDMI-S

LPC2148

ARM

Cortex-M3

LPC1768

ADC No No

One

8 channel

8-bit

One

8/6 Ch

10-bit

No

One

8 Channel

10-bit

Two

6+8 Chs,

10-bit

One

8 Chs,

12-bit

DAC No No No No No No One

10-bit

One

10-bit

Timers 2 x 16-bit 3x16-bit

16-bit

3 Cap

5 Comp

2x8-bit,

1x16-bit,

comp, cap

One

8-bit

4

8-bit / 16-

bit

2 x 32-bit each

with 4 Cap/Mat

Chs

4

PWM

Channels No No

8-bit–4 Ch,

16-bit–2Ch 6 No

Cap/comp

PWM – 2 6 1 + 6

RTC No No No Yes No No Yes Yes

WDT No Yes Yes Yes Yes Yes Yes Yes

N. Mathivanan

Page 26: Embedded systems basics

Serial Interfaces

8051 AT

89S52 68HC11

Atmega

328

PIC

16F84A

PIC

18F452

ARM7-

TDMI-S

LPC2148

ARM

Cortex-M3

LPC1768

I2C No No No One No Yes

(MSSP) Two Three

I2S No No No No No No No One

SPI No No One Yes No Yes

(MSSP) One One

SSP No No No No No Master SSP One 2

UART One

(Full Duplex)

Yes

One

Yes

(SCI) No No No

2 (one with

modem cont)

4 (one with

modem cont)

USART No No No Yes No Yes No No

USB No No No No No No One, (Device

compliant)

One (device/

host/ OTG)

Ethernet

Port No No No No No No No

Ethernet

MAC

CAN No No No No No No 2 Chs 2 Chs N. Mathivanan

Page 27: Embedded systems basics

Other Features

8051 AT

89S52 68HC11

Atmega

328

PIC

16F84A

PIC

18F452

ARM7-

TDMI-S

LPC2148

ARM

Cortex-M3

LPC1768

Power

Saving

Modes

No 2 modes 2 modes,

Wait & stop 6 modes Yes Yes

Yes

Two

Yes

Two

No. of

Pins,

Package

40/44/44

DIP/PLCC/

QFP

40/44/44

DIP/PLCC/

TQFP

48/52

DIP/PLCC

28/32/32p

DIP/MLF/

TQFP

18/18/20

PDIP/SOIC/

SSOP

40/44/44

PDIP/TQFP/

PLCC

64 LQFP

100 LQFP

100 TFBGA

100WLCSP

No. of

Instr. 255 ? 109 131 35 75 ? ?

CISC /

RISC CISC CISC CISC RISC RISC RISC RISC RISC

Architecture Von

Neumann

Von

Neumann

Von

Neumann ----

Harvard

(modified)

Harvard

(modified)

Von

Neumann Harvard

Pipelining ----- ---- ---- ---- 2 stage 2 stage 3 stage 3 stage

Special

Features ----- ---- ----

Multiplier,

Analog

Compar

---- Multiplier Hardware

Multiplier

Ethernet,

Memory

Management,

QEI N. Mathivanan

Page 28: Embedded systems basics

Review Questions

1. What is an embedded system?

2. Distinguish computer in embedded system from general purpose

computer.

3. List the characteristics of embedded system.

4. Brief any four major fields where embedded systems are used.

5. Compare the characteristics of SRAM and DRAM.

6. What is the function of cache memory?

7. What is interrupt?

8. What is the function of interrupt controller?

9. What is DMA? Explain basic DMA operation.

10. Draw the functional block diagram of a mP based system. Explain

11. Name any four sensors used in embedded applications.

12. What are the basic elements providing analog I/O functions?

N. Mathivanan

Page 29: Embedded systems basics

13. List various hardware components used in implementing embedded

system

14. Brief the different types of Software used in embedded

applications / embedded system development

15. Outline the hardware design of any typical embedded system (may

be a mobile robot).

16. What are referred as uni-tasking and muti-tasking?

17. List a few synchronous and asynchronous serial communication

interfaces.

18. Discuss: RISC vs. CISC

19. Discuss: Von Neumann vs. Harvard architectures

20. Distinguish PLC and embedded system

21. Name any one microcontroller for low end, mid range and high end

embedded applications.

N. Mathivanan

Page 30: Embedded systems basics

Embedded System Implementation

• Hardware

Processing element:

Microcontroller – Processor, Memory (Flash, RAM, Cache)

Peripherals:

Input & Output devices

Interfacing sensors and actuators

Communication interfaces:

Interfacing protocols

Bus system

N. Mathivanan

Page 31: Embedded systems basics

• Software

System software:

Operating system, RTOS,

Development tools: Cross compilers, emulators, simulators

Debug tools:

Application software

• Multi-tasking and concurrency

Embedded systems need to deal with several inputs and outputs and

multiple events occurring independently. Separate tasks handle the

situation

Multitasking – OS to allow switching back and forth between tasks.

Concurrency – Appearance of simultaneous execution of tasks.

N. Mathivanan