Embedded Systems Introduction

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

CENG-336

Introduction to Embedded
Systems Development

An Introduction to Embedded Systems

Spring 2020
What is this course about?
CENG 336 Introduction to Embedded Systems Development (2-2) 3
Assembly language and controller architecture. Peripheral interfaces: A/D and D/A
conversion, parallel and serial ports, interrupts and timers/counters. I/O bus
architectures. Sensors and actuators. Design and analysis techniques. Real time
operating systems.
Prerequisite: CENG 232.
http://catalog.metu.edu.tr/

CENG-336 Introduction to Embedded Systems Development 2


Course Logistics
} Textbook
} No Textbook
} Reference Material
} PIC 18F8722 Data Sheets
} Design with PIC Microcontrollers, John B. Peatman, Prentice
Hall,1998.
} Fundamentals of Microcontrollers … (PIC18), Ramesh s. Gaonkar,
Thomson, 2007.
} Course conduct/communication:
} https://odtuclass.metu.edu.tr/

CENG-336 Introduction to Embedded Systems Development 3


Course Logistics
} Schedule:
} Two lecture hours every week
} Sec01: Wed 8:40-10:30 BMB-3 (if necessary extra Mon 12:40-13:30 BMB-3)
} Sec02: Wed 15:40-17:30 BMB-1 (if necessary extra Mon 15:40-16:30 BMB-3)
} Sec03: Tue 10:40-12:30 BMB-5 (if necessary extra Fri 12:40-13:30 BMB-4)
} Recitations are on Thursdays 17:40-19:30 BMB-1, all sections combined
} Grading:
} Midterm: 18%, Take Home Exams: 35%, Board Test 2%, Attendance %5,
Lan Review Exam 15%, Final: 25%
} Lab review exam: 15%.
} Towards the end of the semester (April 18), 3-4 hour exam in CENG labs
} You will need to implement and demonstrate a PIC program, by yourself

CENG-336 Introduction to Embedded Systems Development 4


Course Logistics
} Minimum requirements for taking the final
} At least 30/100 on the midterm
} At least 30/100 on THEs (1-2-3)
} At least 30/100 the lab review exam
} Complying with all the lab requirements.
} In the case of academic misconduct (cheating, plagiarism or any other
form) for any part of the course requirements (examinations,
assignments, etc.), the student will not be allowed to take the final
examination of the course.
Outline
} Embedded systems, Applications, Why are they “special”?,
General Structure, Examples
} Characteristics of embedded systems, Software issues,
Embedded design lifecycle
} Processors: technology, architecture, Microprocessor vs
Microcontroller, Common embedded microcontrollers
} Example: Automotive embedded systems
Embedded systems
} What exactly is an “Embedded System”?
} Any device, or collection of devices, that contain one or more
dedicated computers, microprocessors, or microcontrollers
} Where can I find one?
} Everywhere!

home appliances printers&copiers


toy industry
robotics aircrafts automotive
personal gadgetry factory coordination
CENG-336 Introduction to Embedded Systems Development 7
Embedded systems: Applications
} Consumer segment, e.g. cameras, camcorders, VCRs, washers,
microwave ovens, …
} Automobiles, e.g., engine control, anti-lock brake, air bags, …
} Office automation, e.g., copiers, printers, FAX machines, …
} Telecommunications, e.g.,, cellular phones, PDAs, interactive
game boxes, answering machines, …
} Other industrial products, e.g., door locks in hotel rooms,
automatic faucets, …

CENG-336 Introduction to Embedded Systems Development 8


Why are they “special”?
} Embedded computing devices have rigidly defined operational bounds.
} Not general purpose computers ( PC, Unix workstation )
} How about a PDA? GPS? Cell phone? PC in an industrial robot?
} Entirely different set of constraints
} cost-sensitive because of market considerations (toys, appliances)
} real-time constraints for safety critical tasks (flight control, ABS)
} limited computation and memory resources because of size, weight
power and cost constraints
} Must be very robust to operate in harsh conditions for long time
Very constrained codesign of hardware and software.
Not something you have learned about so far.

CENG-336 Introduction to Embedded Systems Development 9


Embedded system: General structure

Sensor conditioning

Output interfaces
sensor
actuator
Microcontroller
sensor
(uC) indicator
sensor

} Intense interaction with the external world


} Sensors convert physical quantities into electrical signals
} Microcontroller acquires data, processes it and issues outputs
} Actuators convert output signals into physical work
CENG-336 Introduction to Embedded Systems Development 10
Example: A hexapod robot
} RHex: Relatively simple, autonomous legged robot

CENG-336 Introduction to Embedded Systems Development 11


RHex: System design (simplified)
firewire IEEE 1394
3-axis camera
PC104 board Software tasks:
laser gyro - Periodically send appropriate
300MHz Pentium motor commands
RS232 PC104 board
- Periodically read encoder
Analog I/O sensors and computer motor
6 analog outputs PC104 board position and speed
Encoder counter - Compute motor commands
PC104 board based on “desired” position
Motor amplifier
- Periodically read gyro
board (6 units)
12 quadrature (angular velocity) and
high current channels compute body position
command signals - Wait for camera to be ready
and read image
- Process image and determine
6 hip DC motors 6 incr. encoders which direction to go

CENG-336 Introduction to Embedded Systems Development 12


Outline
} Embedded systems, Applications, Why are they “special”?,
General Structure, Examples
} Characteristics of embedded systems, Software issues,
Embedded design lifecycle
} Processors: technology, architecture, Microprocessor vs
Microcontroller, Common embedded microcontrollers
} Example: Automotive embedded systems
Characteristics of embedded systems
} Real-time constraints
} Sensor and actuator accesses are time-sensitive
} Exact time of image acquisition and angular velocity readings must be known
for proper interpretation
} Main cause: Physical events do not wait for software to catch up!
} Cost-sensitivity
} Products will often be mass-produced for a particular task
} Cost, power requirements and size of general-purpose computing platforms
is prohibitive. Only necessary components are used
} High cost of failure, need for fast self-recovery
} Embedded systems should not need baby-sitting
} Failure can be life-threatening for some systems: cars, planes, medical
equipment, nuclear reactors etc.

CENG-336 Introduction to Embedded Systems Development 14


Characteristics of embedded systems
} Power limitations and constraints
} Consider a device to track wild animal movements in nature
} Low power = less heat = fewer failures
} Low power = less energy = longer time of operation
} Low power = smaller batteries = physically lighter and smaller
} Usually requires both hardware and software elements to achieve

} Must operate in extreme environmental conditions


} Embedded systems are everywhere and this means everywhere
} Your PC would fail in a second if left outside on top of Everest
} Once again, both hardware and software should be aware of this

} Far fewer resources than a general purpose computer


} lower speed and memory, limited inputs and I/O etc.

CENG-336 Introduction to Embedded Systems Development 15


An embedded system example – Digital Cam.
Digital camera chip
CCD

CCD preprocessor Pixel coprocessor D2A


A2D

lens

JPEG codec Microcontroller Multiplier/Accum

DMA controller Display ctrl

Memory controller ISA bus interface UART LCD ctrl

q Single-functioned -- always a digital camera


q Tightly-constrained -- Low cost, low power, small, fast
q Reactive and real-time -- only to a small extent

CENG-336 Introduction to Embedded Systems Development 16


Software issues
} Specialized development tools
} You will surely not be able to use printf() or popup alerts
} Development takes places on a host, separate than the target
} Final product usually has ROM and a very small chunk of RAM
} Need for a Real-Time Operating System(RTOS)
} Regular Windows or Linux not suitable for time critical tasks
} Programming for guaranteed timeliness is hard. Deadlocks,
interrupt processing, polling for external events etc. must be
properly resolved and synchronized

} Impossible to avoid codesign of software with hardware

CENG-336 Introduction to Embedded Systems Development 17


Embedded design lifecycle

PHASE 7 – Maintenance & Upgrade


Implementation
PHASE 1 – Product Specification

PHASE 2 – HW/SW Partitioning

PHASE 5 – HW/SW
PHASE 3 – Iteration and

PHASE 6 – Acceptane testing


Integration
PHASE 4 – Detailed
HW/SW Design

HW Design Path activities

SW Design Path activities Product release

Very pretty picture!


CENG-336 Introduction to Embedded Systems Development 18
Specification and partitioning
} Product specification
} Embedded products are dedicated systems, not general purpose
} Minimal specification to capture “desired” functionality
} Hardware/Software partitioning
} Think winmodems vs. hardware capable modems
} Dedicated encoder counter chips vs. software counting
} Hardware rendering vs. software shading for graphics
} Hardware is faster but less flexible and more difficult to debug
} Software/firmware can be updated but runs slower and consumes
computational resources
} You will have to balance conflicting requirements and limitations. No
general methods, just guidelines

CENG-336 Introduction to Embedded Systems Development 19


HW/SW design and integration
} Development of HW/SW
} You have been learning about parts of this so far (except difficulties
particular to embedded systems)
} Integration
} Can be quite a nightmare if not thought out beforehand
} Software engineers usually have some tools beforehand: evaluation
boards, instruction set simulators etc.
} Hardware designers have other tools: logic analyzers, in-circuit emulators
etc.
} Unlikely to work right away: system working at full speed will quickly
reveal many inconsistencies and bad interactions
} Successful debugging requires special tools. No printf()’s or simple
debuggers will be available

CENG-336 Introduction to Embedded Systems Development 20


Testing and debugging
} Hardware failures can cause software failure and vice-versa.
For example
} Intermittent power connection causing resets
} Overdriving motors from software causing burnouts
} Multiple channels connected together mistakenly configured as
outputs
} Compliance testing may be necessary
} RF suppression for compliance with specific requirements
} Meeting robustness requirements (operational range of
temperatures etc.)
Summary: Embedded system development is not just
“software on small machines”
CENG-336 Introduction to Embedded Systems Development 21
Outline
} Embedded systems, Applications, Why are they “special”?,
General Structure, Examples
} Characteristics of embedded systems, Software issues,
Embedded design lifecycle
} Processors: technology, architecture, Microprocessor vs
Microcontroller, Common embedded microcontrollers
} Example: Automotive embedded systems
Processor technology
} The architecture of the computation engine used to
implement a system’s desired functionality
} Processor does not have to be programmable
} “Processor” is not equal to general-purpose processor
Controller Datapath Controller Datapath Controller Datapath

Control index
Control Control logic Registers
Register logic
logic and and State
file total
State register register
Custom State register
+
ALU
General
ALU
IR PC IR PC

Data Data
memory memory

Program Data Program memory


memory memory

Assembly code for: Assembly code for:

total = 0 total = 0
for i =1 to … for i =1 to …

General-purpose (“software”) Application-specific Single-purpose (“hardware”)

CENG-336 Introduction to Embedded Systems Development 23


General-purpose processors
} Programmable device used in a variety of
applications Controller Datapath
} Also known as “microprocessor” Control Register
} Features logic and
State
file

} Program memory register


General
} General datapath with large register file and IR PC ALU
general ALU
} User benefits Program
memory
Data
memory
} Low time-to-market and NRE costs Assembly
} High flexibility code for:

} “Pentium” is the most well-known, but total = 0


for i =1 to …
there are hundreds of others

CENG-336 Introduction to Embedded Systems Development 24


Application-specific processors
} Programmable processor optimized for a
particular class of applications having Controller Datapath

common characteristics Control Registers


logic and
} Compromise between general-purpose and State
register
single-purpose processors Custom
ALU
} Features IR PC

Data
} Program memory Program memory
memory
} Optimized datapath
Assembly
} Special functional units code for:

} Benefits total = 0
for i =1 to …
} Some flexibility, good performance, size and
power
CENG-336 Introduction to Embedded Systems Development 25
Single-purpose processors
} Digital circuit designed to execute exactly
one program/task Controller Datapath
} a.k.a. coprocessor, accelerator or peripheral Control index
logic
} Features total
State
} Contains only the components needed to register +
execute a single program
} No program memory Data
} Benefits memory

} Fast
} Low power
} Small size

CENG-336 Introduction to Embedded Systems Development 26


Choices for processor architecture
} CISC - Complex Instruction Set Computer
} Many instructions which can perform involved operations: compact code
} Can be many clock cycles per instruction
} Large silicon area > Higher cost per die
} RISC - Reduced Instruction Set Computer
} More modern architecture
} One instruction executed per clock cycle > Very fast
} DSP - Digital Signal Processor
} Specialized type of uP
} Designed for real time mathematical manipulation of data streams
} Radar image processing, audio/voice processing, ultrasound and photographic image
processing
} Includes instructions designed for multiplication and accumulation
Choice can be one of the three or a combination

CENG-336 Introduction to Embedded Systems Development 27


Some definitions
} Microprocessor
} An integrated circuit which forms the central processing unit for a
computer or embedded controller, but requires additional support
circuitry to function
} MC68000, 80486, Pentium, K6, etc.

} Microcontroller
} A microprocessor plus additional peripheral support devices integrated
into a single package
} Peripheral support devices may include:
} Serial ports ( COM ), Parallel ( Ports ), Ethernet ports, A/D & D/A
} Interval timers, watchdog timers, event counter/timers, real time clock Other
local processors ( DSP, numeric coprocessor, peripheral controller )
} PIC, MPC555 are microcontrollers

CENG-336 Introduction to Embedded Systems Development 28


Microprocessor vs Microcontroller
A Microprocessor-Based Embedded System A Microcontroller-Based Embedded System

program data
memory storage program data
memory storage

I/O I/O
microprocessor microprocessor

I/O core
I/O

real-time I/O real-time


clock I/O clock

To outside world
To outside world

} Microcontroller advantages
} lower cost, more reliable, better performance, faster and lower RF signature
} may be less flexible for research and development projects

CENG-336 Introduction to Embedded Systems Development 29


World-wide figures

} Over 100 Billion μCs used in embedded systems

} Average embedded system has 4-6 μC, probably more by now

} Of all μC sold, 90% go into “non-computers”, 10% in


“computers”

} You will most likely end up working with a “non-computer”at


some point in your career

CENG-336 Introduction to Embedded Systems Development 30


Common embedded microcontrollers
} 4-bit Microcontrollers: PIC ($1.79)
} 8-bit Microprocessors and microcontrollers
} Zilog: Z80 families ($1.39)
} Intel: 8042, 8048, 8051 families ($4.95)
} Motorola: 6805, 68HC11 families ($8.00)
} 16-bit Microprocessors and microcontrollers
} Intel, AMD: 80186 families
} Motorola: 68300 families
} NEC, Hitachi, Phillips
} 32-bit Microprocessors and microcontrollers
} Intel 80386, 80486, Pentium, PII, PIII,PIV, StrongARM, X-scale
} ARM: ARM7TDMI, ARM9
} AMD 486E, SC520 (Aspen)
} Motorola 680X0, ColdFIRE, PowerPC, MPC5xx
} Intel X-Scale
} 64-bit Microprocessors and microcontrollers
} MIPS family, Athlon 64
Choice depends on a variety of performance and memory size considerations

CENG-336 Introduction to Embedded Systems Development 31


Outline
} Embedded systems, Applications, Why are they “special”?,
General Structure, Examples
} Characteristics of embedded systems, Software issues,
Embedded design lifecycle
} Processors: technology, architecture, Microprocessor vs
Microcontroller, Common embedded microcontrollers
} Example: Automotive embedded systems
Example: Automotive embedded systems
} Today’s high-end automobile may have more than 100
microprocessors:
} 4-bit microcontroller checks seat belt;
} microcontrollers run dashboard devices;
} 16/32-bit microprocessor controls engine.
} Example: BMW 745i
} 2,000,000 LOC, Windows CE OS
} 53 x 8-bit μP
} 11 x 32-bit μP
} 7 x 16-bit μP
} Multiple Networks
} Buggy!
CENG-336 Introduction to Embedded Systems Development 33
Outline
} Embedded systems, Applications, Why are they “special”?,
General Structure, Examples
} Characteristics of embedded systems, Software issues,
Embedded design lifecycle
} Processors: technology, architecture, Microprocessor vs
Microcontroller, Common embedded microcontrollers
} Example: Automotive embedded systems

You might also like