UNIT - 1 Notes
UNIT - 1 Notes
PART- B
➢ First Mass Produced Embedded System: Autonetics D-17 Guidance computer for
Minuteman-I missile
❑ Card Readers: Barcode, Smart Card Readers, Hand held Devices etc.
● Data Collection/Storage/Representation
● Data Communication
● Monitoring
● Control
Embedded systems possess certain specific characteristics and these are unique to
each Embedded system.
4. Distributed
6. Power concerns
7. Single-functioned
8. Complex functionality
9. Tightly-constrained
10. Safety-critical
• Each E.S has certain functions to perform and they are developed in such a
manner to do the intended functions only.
• E.S are in constant interaction with the real world through sensors and
user-defined input devices which are connected to the input port of the
system.
• Any changes in the real world are captured by the sensors or input devices in
real time and the control algorithm running inside the unit reacts in a designed
manner to bring the controlled output variables to the desired level.
• Real Time system operation means the timing behavior of the system should
be deterministic ie the system should respond to requests in a known amount
of time.
• Example – E.S which are mission critical like flight control systems,
Antilock Brake Systems (ABS) etc are Real Time systems.
• The design of E.S should take care of the operating conditions of the area
where the system is going to implement.
6. Power Concerns:-
9. Tightly-constrained:- Low cost, low power, small, fast, etc 10. Safety-critical:-
Must not endanger human life and the environment
❑ Based on Triggering
First Generation: The early embedded systems built around 8-bit microprocessors
like 8085 and Z80 and 4-bit microcontrollers EX. stepper motor control units, Digital
Telephone Keypads etc.
Second Generation: Embedded Systems built around 16-bit microprocessors and 8
or 16-bit microcontrollers, following the first generation embedded systems
EX.SCADA, Data Acquisition Systems etc.
Third Generation: Embedded Systems built around high performance 16/32 bit
Microprocessors/controllers, Application Specific Instruction set processors like
Digital Signal Processors (DSPs), and Application Specific Integrated Circuits
(ASICs).The instruction set is complex and powerful. EX. Robotics, industrial
process control, networking etc.
➢ Small Scale: The embedded systems built around low performance and low cost 8
or 16 bit microprocessors/ microcontrollers. It is suitable for simple applications and
where performance is not time critical. It may or may not contain OS.
➢ Medium Scale: Embedded Systems built around medium performance, low cost
16 or 32 bit microprocessors / microcontrollers or DSPs. These are slightly complex
in hardware and firmware. It may contain GPOS/RTOS.
1. Soft Real time Systems: Missing a deadline may not be critical and can be
tolerated to a certain degree
1. Event Triggered : Activities within the system (e.g., task run-times) are
dynamic and depend upon occurrence of different events .
● Address bus is an external bus that carries the address from the Memory Address
Register(MAR) to the memory as well as to the IO devices and other units of the system.
● Data bus is an external bus that carries the data from or to the address determined by
Memory Address Register(MAR).
● Control Bus is an external bus that carries, control signals to or between the processor and
memory.
Instruction Units
The processor executes several operations with the help of a piece of code or program called
instructions. All these instruction are arranged in a queue called Instruction Queue(IQ). This
helps the Instruction Register to execute the instructions without the need to wait.
Branch Target Cache(BT Cache) facilitates the ready availability of the next instruction set,
when a branch instruction like jump, call or loop is encountered. Its fetch unit foresees a
branching instruction in the I – cache.
Data Cache(D – Cache) stores the pre – fetched data from the external memory. A data cache
holds both the address and data together at a location. It also stores the write-through data
that is to be transferred to the external memory addresses. Write-through data is nothing but
the output data from the execution unit.
Control Units
The control unit(CU) is one of the important structural units in an any embedded processor. It
is responsible for all the control of the bus activities and unit functions needed for processing.
It directs all the units of a processor to respond to the instruction that is executed.
Pre fetch control Unit(PFCU) controls the fetching of data into the I-Cache and D-Cache in
advance from the memory unit. The instructions and data are delivered when needed to the
processor’s execution units.
Memory Management Unit(MMU) manages the memories such that the instructions and data
are readily available for processing. There are several memory management methods for
managing the memory in an embedded processor such as fixed block allocation, dynamic
block allocation, dynamic page allocation, etc.
Processing Units
Processing units receives the input data, process it and produces the output. Depending on the
function of the embedded system, the processing is done through different units like ALU,
FLPU, AOU and advanced units.
Arithmetic Logic Unit(ALU) is used for the execution the arithmetic and logic instructions
according to the instruction present at the Instruction Register.
Floating point processing unit(FLPU) is different from ALU, used primarily for floating
point processing. It is essential for fast processing mathematical functions in a
microprocessor or Digital Signal Processor.
Atomic operation unit(AOU) lets a user (compiler) instruction when broken into number of
processor instructions called atomic operations, finish before an interrupt of the processor
occurs.
The embedded processor also has Advanced processing units for multistage pipeline
processing, multi-line superscalar processing to obtain processing speeds higher than one
instruction per cycle.
Register Sets
Application Register Set(ARS) is a set of on-chip registers used during processing of
instructions of the application program of the user. A register window consists of a subset of
registers with each subset storing static variables of software – routine.
System Register Set(SRS) is a set of registers used while processing the instructions of the
supervisory system program.
Floating point register set(FRS) is dedicated for storing floating point numbers in the
standard format and used by Floating point Processing Units for its data.
Memory Registers
Registers are smallest part of the CPU, where the data and address can be stored and accessed
quickly. There are various registers like accumulator, general purpose registers, flag registers,
memory address register, memory data register, program counter, stack pointer, etc.
Memory Address Register(MAR) holds the address of the data byte or word that is to be
fetched from external memories. Memory Data Register(MDR) holds the data byte or word
that is fetched from external memory or stored to the external memory.
Stack pointer is a register that stores the address of the last program request in a stack. It is a
pointer for an address which corresponds to a stack top in the memory.
¬ Performance Considerations
¬ Power considerations
¬ Peripheral Set
¬ Operating Voltage
1. Performance Considerations:
♣ The first and foremost consideration in selecting the processor is its performance.
♣ Branch prediction, speculative execution etc. are some other techniques used for
improving the execution rate
2. Power Considerations:
♣ Increasing the logic density and clock speed has adverse impact on power
requirement of the processor.
♣ A higher clock implies faster charge and discharge cycles leading to more power
consumption.
♣ More logic leads to higher power density there by making the heat dissipation
difficult.
♣ Techniques like
¬ Frequency scaling
¬ Voltage scaling
– varying the voltage based on load can help in achieving lower power usage.
♣ SoC comes with advanced power gating techniques that can shut down clocks and
power to unused modules
3. Peripheral Set:
♣ Every system requires not only a processor but also peripherals for input and output
operations.
♣ In an embedded system, almost all the processors used are SoCs, So it is better if
the necessary peripherals are available in the chip itself. This offers various benefits
compared to peripherals in external IC’s.
4. Operating Voltages:
♣ Each and every processor will have its own operating voltage condition. The
operating voltage maximum and minimum ratings will be provided in the respective
data sheet or user manual.
♣ While higher end processors typically operate with 2 to 5 voltages including 1.8V
for Cores/Analogue domains, 3.3V for IO lines, needs specialized PMIC(Power
Management IC) devices, it is a deciding factor in low end micro-controllers based on
the input voltage.
♣ Apart from the core, presence of various co-processors and specialized processing
units can help achieving necessary processing performance.
♣ Some of the popular co-processors include DSP, GPU and Floating point co-
processor
6. Packaging:
7. Software tools:
♣ Make sure you have tools such as compilers, debuggers, and assemblers etc.,
available with the processor/controller.
8. Cost:
Direct Memory Access (DMA) is a process of transferring data from one memory location
to another without the direct involvement of the processor (CPU). The main benefit of using
DMA is more efficient data movement in the embedded system.
Principle of Operation
There are many different types of DMA implementations, some of them for very specific use
cases. In this article, we will focus on the general principles of operation. Let’s start with the
simple system shown below in Fig.1.
As the CPU and the DMA controller use the same bus, there must be some form of
handshaking between them. They can’t access the bus simultaneously. The handshaking can
be implemented as a dedicated interface between the CPU and the DMA controller or can be
part of the bus protocol. The DMA controller contains registers that the CPU must configure.
The configuration may include: the source address of the transfer, the destination address of
the transfer, the number of bytes to be transferred, interrupt request to the CPU on completion
of a transfer, etc.
An important thing to remember is that DMA is not cost-free and it may affect the CPU
operation in certain situations. If the CPU is using the memory bus the DMA has to wait. If
the DMA starts a transfer, then the CPU has to wait for it to finish if it wants to access the
bus. For avoiding these situations some systems are designed with multiple areas of memory
(see Fig.2). Each memory area has its own dedicated bus and DMA controller. In that
scenario, the CPU may be accessing one area of the memory, while a DMA controller is
accessing at the same time another area. Bus bridges and interconnects are used for
connecting all subsystems and forming a single memory space.
Fig.2 Simplified block diagram of an embedded system with two DMA subsystems
Type of Transfers
The most common configuration in modern microcontrollers is the use of a single memory
address space, where all types of memories (Code Flash, RAM, Data flash, etc.) and
peripheral units are mapped into the same address space. For the DMA controller, all
transfers are memory-to-memory. For us as developers however, by knowing what
functionality is behind each memory address we can use the DMA for the following type of
transfers:
Each DMA controller has FIFO buffers. They are used in case a busy resource is preventing
the transfer from completing. Using FIFO allows the DMA controller to perform two-step
transfers:
1. Read access – data is transferred from the source address to the DMA FIFO
2. Write access – data is transferred from the DMA FIFO to the destination address
Fig.3 Two-step DMA transfer
DMA is used for moving data from one address of the memory to another. When used
properly it can improve the efficiency of an embedded system. The CPU can be more focused
on performing calculations, without having to waste too many instruction cycles for
transferring data. This can result in improving the speed of our program.
Another benefit can be the reduction of power consumption. The two common ways of
transferring data without the use of DMA are:
● based on interrupts – interrupt is generated when a new data is available and CPU has
to transfer it
● polling – the CPU waits for a new data to become available and then transfers it
Both methods require the CPU to be awake. In contrast, some DMA controllers can perform
data transfers while the CPU is in sleep mode (low-power mode).
Fence Register
● In this approach, the operating system keeps track of the first and last location available
for the allocation of the user program
● The operating system is loaded either at the bottom or at top
Operating System
p1
p2
Operating System
p3
p4
Partition Table
Once partitions are defined operating system keeps track of the status of memory partitions it
is done through a data structure called a partition table.
0k 200k allocated
Fragmentation
Fragmentation is defined as when the process is loaded and removed after execution from
memory, it creates a small free hole. These holes can not be assigned to new processes
because holes are not combined or do not fulfill the memory requirement of the process. In
the operating systems two types of fragmentation are:
● Internal fragmentation: Internal fragmentation occurs when memory blocks are
allocated to the process more than their requested size. Due to this some unused space is
left over and creating an internal fragmentation problem. .
● External fragmentation: In External Fragmentation, we have a free memory block, but
we can not assign it to a process because blocks are not contiguous.
The benefit of auto-reload mode is that you can have the timer to always contain a value from
200 to 255. If you use mode 0 or 1, you would have to check in the code to see the overflow
and, in that case, reset the timer to 200. In this case, precious instructions check the value
and/or get reloaded. In mode 2, the microcontroller takes care of this. Once you have
configured a timer in mode 2, you don't have to worry about checking to see if the timer has
overflowed, nor do you have to worry about resetting the value because the microcontroller
hardware will do it all for you. The auto-reload mode is used for establishing a common baud
rate.
When Timer 0 is in split mode, the real Timer 1 (i.e. TH1 and TL1) can be set in modes 0, 1
or 2, but it cannot be started/stopped as the bits that do that are now linked to TH0. The real
timer 1 will be incremented with every machine cycle.
Reading a Timer
A 16-bit timer can be read in two ways. Either read the actual value of the timer as a 16-bit
number, or you detect when the timer has overflowed.
● Interrupt Flags – Set when the timer overflows or hits a compare value.
Applications:
● Delays and Time Measurement
● Event Counting
● Pulse Width Modulation (PWM)
● Frequency Measurement
● Real-Time Clock (RTC)
9. WATCHDOG TIMER:
What is a Watchdog Timer?
A Watchdog Timer is a hardware timer that runs independently of the main program. It must
be regularly reset (or “kicked”/“petted”) by the software within a specified time interval. If
the software fails to reset the watchdog before the timer expires, the WDT assumes the
system has become unresponsive and forces a system reset.
Purpose of the Watchdog Timer
Recover from software hangs or infinite loops
Ensure system reliability in mission-critical applications
Restart the system after unexpected behaviour
🌀
How Watchdog Timer Works
Normal Operation
● The watchdog timer starts counting down.
● The software resets the timer periodically within the allowed time.
● Timer never expires → System runs normally.
⚠️Faulty Operation
● Software hangs, crashes, or enters an infinite loop.
● Watchdog is not reset in time.
● Timer expires → Triggers system reset or interrupt.
WDT operation
Detection of MCU faults
The watchdog timer communicates with the MCU at a set interval. If the MCU does not
output a signal, outputs too many signals or outputs signals that differ from a predetermined
pattern, the timer determines that the MCU is malfunctioning and sends a reset signal to the
MCU.
The WDT uses a number of methods (modes) to detect MCU faults and the type of faults it
detects varies with the mode.The following is a description of WDT operation and features
by mode.
Time-out mode
In this mode, the watchdog timer determines the MCU is malfunctioning and outputs a reset
signal if it does not receive a signal from the MCU within the set interval.
The time-out mode is a major WDT monitoring mode or method, but it sometimes fails to
detect MCU faults.
In Time-out mode, the WDT will not detect an MCU fault if the MCU inputs multiple signals
(= double pulse) in the set period.
WINDOW MODE
The window mode enables more accurate detection of faults than the Time-out mode.
In window mode, the watchdog timer determines that the MCU is malfunctioning and outputs
a reset signal if it does not receive a signal, or receives multiple signals (= double pulse) from
the MCU within the set interval.
A window mode watchdog timer may be more suitable for applications such as automotive
devices that require greater safety
Q&A (Question & Answer) mode
The Q&A mode enables more accurate detection of faults than the previous two modes.
In Q&A mode, the MCU sends predetermined data to the WDT. The WDT determines
whether or not the MCU is operating normally depending on whether or not the signal sent by
the MCU matches predetermined data.
Devices that require a high degree of safety, may require a Q&A mode WDT. However,
unlike the window and the timeout modes, this mode relies on data communication between
the MCU and WDT, which makes operation more complex.
Component Description
WDT Register Control and configure WDT (enable, timeout period, etc.)
Timeout Period The max time allowed before a reset is triggered
Reset Mechanism Typically triggers a system reset
Interrupt Option Some WDTs can first trigger an interrupt before reset
Enable/Disable Usually must be enabled at startup or via fuse bits (e.g., in AVR)
The operational quality attributes represent the relevant quality attributes related to
the embedded system when it is in the operational mode or online mode.
1. Response :- It is the measure of quickness of the system. It tells how fast the
system is tracking the changes in input variables.
Most of the E.S demands fast response which should be almost realtime.
2. Throughput :- It deals with the efficiency of a system. It can be defined as the rate
of production or operation of a defined process over a stated period of time. The rates
can be expressed in terms of products, batches produced or any other meaningful
measurements.
Ex – In case of card reader throughput means how many transactions the reader can
perform in a minute or in an hour or in a day. Throughput is generally measured in
terms of “Benchmark”. A Benchmark is a reference point by which something can be
measured
3. Reliability :-
• It is a measure of how much we can rely upon the proper functioning of the
system.
• Mean Time Between Failure (MTBF) and Mean Time To Repair (MTTR)
are the terms used in determining system reliability.
• MTTR specifies how long the system is allowed to be out of order following
a failure.
• For embedded system with critical application need, it should be of the order
of minutes.
4. Maintainability:-
• It deals with support and maintenance to the end user or client in case of
technical issues and product failure or on the basis of a routine system
checkup.
5. Security:-
• Integrity deals with the protection of data and application from unauthorized
modification.
6. Safety :-
Safety deals with the possible damages that can happen to the operator, public and the
environment due to the breakdown of an Embedded System. The breakdown of an
embedded system may occur due to a hardware failure or a firmware failure. Safety
analysis is a must in product engineering to evaluate the anticipated damages and
determine the best course of action to bring down the consequences of damage to an
acceptable level.
The quality attributes that needs to be addressed for the product not on the basis of
operational aspects are grouped under this category.
• Testability deals with how easily one can test the design, application and by
which means it can be done.
• Embedded hardware testing ensures that the peripherals and total hardware
functions in the desired manner, whereas firmware testing ensures that the
firmware is functioning in the expected way.
• 1.Hardware level
2.software level
• 2. Software level: It is employed for finding the errors created by the flaws
in the software.
2. Evolvability :-
• For an embedded system evolvability refers to the ease with which the
embedded product can be modified to take advantage of new firmware or
hardware technologies.
3. Portability:-
• Cost is a factor which is closely monitored by both end user and product
manufacturer. Cost is highly sensitive factor for commercial products
• Proper market study and cost benefit analysis should be carried out before
taking a decision on the per-unit cost of the embedded product.
• The ultimate aim of the product is to generate marginal profit so the budget
and total cost should be properly balanced to provide a marginal profit.