Embedded System
Embedded System
Embedded System
Lecture Notes
Embedded Systems
G Padmanabha Sivakumar
Assistant Professor, EIE Department
EMBEDDED SYSTEMS
CHAPTER - 1
EMBEDDED COMPUTING
Pre-requisites:
Aim:
Objectives:
3. Learn the techniques of interfacing between processors & peripheral device related to
embedded processing .
Outcome:
1
2. Interface various peripherals to processors.
4. Use the basic concepts of systems programming like operating system, assembler
compilers etc., and to understand the management task needed for developing embedded
systems.
(a) for storing the variables during program run, stack and input or output
buffers, for example, for speech or image
(b) for storing all the instructions and data
(c) for storing the programs from external secondary memory
(d) for fetching instructions and data into cache(s).
a) Atmel
b) Philips
c) Intel
2
d) All of the mentioned
a) Peripherals
b) Processors
c) OS
d) Microcontrollers
7. Which is the most commonly used language(s) used in embedded system?
a) C
b) java
c) COBOL
d) Both a and c
a) Emulator
b) ICD
c) ICE
d) HLL
3
11. 8051 series has how many 16 bit registers?
a) 2
b) 3
c) 1
d) 0
12. Which microcontrollers are adopted for designing medium scale embedded systems?
a. 8-bit
b. 16-bit to 32-bit
c. 64-bit
d. All of the above
13. Which types of an embedded systems involve the coding at a simple level in an
embedded 'C', without any necessity of RTOS?
14. Which stage associated with pipelining mechanism recognizes the instruction that is to be
executed?
a. Fetch
b. Decode
c. Execute
d. None of the above
15. In CPU structure, where is one of the operand provided by an accumulator in order to
store the result?
a. Control Unit
b. Arithmetic Logic Unit
c. Memory Unit
d. Output Unit
4
1.1 INTRODUCTION TO EMBEDDED SYSTEMS
This chapter introduces the reader to the world of embedded systems. Everything that we
look around us today is electronic. The days are gone where almost everything was
manual. Now even the food that we eat is cooked with the assistance of a microchip (oven)
and the ease at which we wash our clothes is due to the washing machine. This world of
electronic items is made up of embedded system. In this chapter we will understand the
basics of embedded system right from its definition.
a. Hardware
b. Software
c. Mechanical Components
b. Software: It has a chip on the circuit that holds the software which drives
controls & monitors the various operations possible.
5
● Example 2: Air Conditioner
b. Software: It has a chip on the circuit that holds the software which drives
controls & monitors the various operations possible. The software monitors the
external temperature through the sensors and then releases the coolant or
suppresses it.
6
● The first mass-produced embedded system was guidance computer for the
Minuteman-I missile in 1961.
● In the year 1971 Intel introduced the world's first microprocessor chip called the
4004, was designed for use in business calculators.
● It was produced by the Japanese company Busicom.
1.3.1 On generation
7
1.3.1.4. Fourth generation:
1.3.2.1. Small-scale:
1.3.2.2. Medium-scale:
1.3.2.3. Large-scale:
8
1.3.4 On triggering
9
1.4.2.1 Soft Real-Time system:
● A Real time system in which the violation of time constraints will cause
only degraded quality, but the system can continue to operate is known as
a Soft real time system. In soft real-time systems, the design focus is to
offer a guaranteed bandwidth to each real time task and to distribute the
resources to the tasks.
● Ex: A Microwave Oven, washing machine, TV remote etc.
10
connection can be either wired or wireless.
● The networked embedded system is the fastest growing area in embedded
systems applications. The embedded web server is such a system where all
embedded devices are connected to a web server and can be accessed and
controlled by any web browser.
● Ex: A home security system is an example of a LAN networked embedded
system where all sensors (e.g. motion detectors, light sensors, or smoke
sensors) are wired and running on the TCP/IP protocol.
The portable embedded devices like mobile and cellular phones, digital cameras,
MP3 players, PDA (Personal Digital Assistants) are the example for mobile embedded
systems. The basic limitation of these devices is the limitation of memory and other
resources.
The application areas and the products in the embedded domain are countless.
11
6. Computer peripherals: Printers, scanners.
7. Computer networking systems: Network routers and switches.
8. Healthcare: EEG, ECG machines.
9. Banking & Retail: Automatic teller machines, point of sales.
10. Card Readers: Barcode, smart card readers.
● First,it will give us an introduction to the various steps in embedded system design
● Second, it will allow us to consider the design methodology itself. This figure
● In this top–down view,we start with the system requirements in the next step comes
Specification.
12
1.6.1 SPECIFICATIONS
● we create a more detailed description of what we want. But the specification states
only how the system behaves, not how it is built.
● The details of the system‘s internals begin to take shape when we develop the
architecture, which gives the system structure in terms of large components.
● Once we know the components we need, we can design those components,
including both software modules and any specialized hardware we need.
● Based on those components, we can finally build a complete system.
● Top–down Design—we will begin with the most abstract description of the
system and conclude with concrete details.
● The alternative is a bottom–up view in which we start with components to
build a system. Bottom–up design steps are shown in the figure as
dashed-line arrows.
● We need bottom–up design because we do not have perfect insight into how
later stages of the design process will turn out.
● During the design process we have to consider the major goals of the design
such as
01.manufacturing cost;
02. performance (both overall speed and deadlines); and
03. power consumption.
1.6.2.1 REQUIREMENTS
Requirements may be functional or nonfunctional. We must capture the basic
functions of the embedded system, but functional description is often not sufficient. Typical
nonfunctional requirements include:
13
1. Performance:
● The speed of the system is often a major consideration both for the usability of the
system and for its ultimate cost. Performance may be a combination of soft
performance metrics such as approximate time to perform a user-level function and
hard deadlines by which a particular operation must be completed.
2. Cost:
The target cost or purchase price for the system is almost always a consideration. Cost
typically has two major components:
NonRecurring engineering (NRE) costs include the personnel and other costs of
designing the system.
● The physical aspects of the final system can vary greatly depending upon the
application. e.g) An industrial control system for an assembly line may be designed
to fit into a standard-size rack with no strict limitations on weight. But a handheld
device typically has tight requirements on both size and weight that can ripple
through the entire system design.
4. Power consumption:
5. Mock-up.
14
react to it. Physical,nonfunctional models of devices can also give customers a
better idea of characteristics such as size and weight.
Example:
REQUIREMENTS
1. User interface:
The screen should have at least 400_600 pixel resolution. The device should be
controlled by no more than three buttons.
15
2. Performance:
The map should scroll smoothly. Upon power-up, a display should take no more
than one second to appear, and the system should be able to verify its position and
display the current map within 15 s.
3. Cost:
The selling cost (street price) of the unit should be no more than $100.
5. Power consumption:
The device should run for at least eight hours on four AA batteries.
Specification
16
● Map Data
● User Interface
● Operations that must be performed to satisfy customer requests. Background
actions required to keep the system running, such as operating the GPS
receiver. UML, a language for describing specifications
Architecture Design
1. The specification does not say how the system does things, only what the system
does. Describing how the system implements those functions is the purpose of the
architecture. Figure 1.3 shows a sample system architecture in the form of a block
diagram that shows major operations and data flows among them.
2. Many implementation details should we refine that system block diagram into two
block diagrams: one for hardware and another for software. These two more
refined block diagrams are shown in Figure 1.4.The hardware block diagram clearly
shows that we have one central CPU surrounded by memory and I/O devices. In
particular, we have chosen to use two memories: a frame buffer for the pixels to be
displayed and a separate program/data memory for general use by the CPU .
17
3.
System Integration
The components built are put together and see how the system works. If we debug only a
few modules at a time, we are more likely to uncover the simple bugs and able to easily
recognize them. Only by fixing the simple bugs early will we be able to uncover the more
complex or obscure bugs.
18
1.7 Embedded processors – 8051 Microcontroller
● The Intel 8051 microcontroller is one of the most popular general purpose
microcontrollers in use today. The success of the Intel 8051 spawned a number of
clones, which are collectively referred to as the MCS-51 family of microcontrollers,
which includes chips from vendors such as Atmel, Philips, Infineon, and Texas
Instruments.
● The Intel 8051 is an 8-bit microcontroller which means that most available
operations are limited to 8 bits. There are 3 basic "sizes" of the 8051: Short,
Standard, and Extended. The Short and Standard chips are often available in DIP
(dual in-line package) form, but the Extended 8051 models often have a different
form factor, and are not "drop-in compatible".
● All these things are called 8051 because they can all be programmed using 8051
assembly language, and they all share certain features (although the different
models all have their own special features).
19
1.7.2 BASIC PIN SETUP
PIN 9: PIN 9 is the reset pin which is used to reset the microcontroller’s internal registers
and ports upon starting up. (Pin should be held high for 2 machine cycles.)
PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only connect a
crystal at these pins to provide clock pulses to the circuit.
PIN 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip needs +5V
500mA to function properly, although there are lower powered versions like the Atmel
2051 which is a scaled down version of the 8051 which runs on +3V.
20
PINS 29, 30 & 31: As described in the features of the 8051, this chip contains a built-in flash
memory. In order to program this we need to supply a voltage of +12V at pin 31. If external
memory is connected then PIN 31, also called EA/VPP, should be connected to ground to
indicate the presence of external memory. PIN 30 is called ALE (address latch enable),
which is used when multiple memory chips are connected to the controller and only one of
them needs to be selected.We will deal with this in depth in the later chapters. PIN 29 is
called PSEN. This is "program store enable". In order to use the external memory it is
required to provide the low voltage (0) on both PSEN and EA pins.
Pin 29: If we use an external ROM then it should have a logic 0 which indicates
Microcontroller to read data from memory.
Pin 30: This Pin is used for ALE that is Address Latch Enable. If we use multiple memory
chips then this pin is used to distinguish between them.It is activated periodically with a
constant rate of 1/6th of oscillator frequency. This Pin also gives program pulse input
during programming of EPROM.
Pin 31: If we have to use multiple memories then by applying logic 1 to this pin instructs
Microcontroller to read data from both memories first internal and afterwards external.
1.7.3 PORTS
PORT P1 (Pins 1 to 8): The port P1 is a general purpose input/output port which can be used for a
variety of interfacing tasks. The other ports P0, P2 and P3 have dual roles or additional functions
associated with them based upon the context of their usage.The port 1 output buffers can
sink/source four TTL inputs. When 1s are written to port 1 pins are pulled high by the internal
pull-ups and can be used as inputs.
PORT P3 (Pins 10 to 17): PORT P3 acts as a normal IO port, but Port P3 has additional functions
such as, serial transmit and receive pins, 2 external interrupt pins, 2 external counter inputs, read
and write pins for memory access.
PORT P2 (pins 21 to 28): PORT P2 can also be used as a general purpose 8 bit port when no
external memory is present, but if external memory access is required then PORT P2 will act as an
21
address bus in conjunction with PORT P0 to access external memory. PORT P2 acts as A8-A15, as
can be seen from fig 1.1
PORT P0 (pins 32 to 39) PORT P0 can be used as a general purpose 8 bit port when no external
memory is present, but if external memory access is required then PORT P0 acts as a multiplexed
address and data bus that can be used to access external memory in conjunction with PORT P2. P0
acts as AD0-AD7, as can be seen from fig 1.1
PIN 11: Serial Asynchronous Communication Output or Serial Synchronous Communication clock
Output.
● The 8051 requires an external oscillator circuit. The oscillator circuit usually runs around 12
MHz, although the 8051 (depending on which specific model) is capable of running at a
maximum of 40 MHz. Each machine cycle in the 8051 is 12 clock cycles, giving an effective
cycle rate at 1 MHz (for a 12 MHz clock) to 3.33 MHz (for the maximum 40 MHz clock). The
oscillator circuit generates the clock pulses so that all internal operations are synchronized.
● The 8051 Microcontroller can be programmed in PL/M, 8051 Assembly, C and a number of
other high-level languages. Some compilers even have support for compiling C++ for an
8051.
● Program memory in the 8051 is read-only, while the data memory is considered to be
read/write accessible. When stored on EEPROM or Flash, the program memory can be
rewritten when the microcontroller is in the special programmer circuit or, if not using a 8031,
through a preinstalled bootloader.
● The 8051 starts executing program instructions from address 0000 in the program memory.
22
1.7.5 ARCHITECTURE
23
1.8 INTRODUCTION TO ARCHITECTURES:
24
1.8.2 Harvard architecture:
A Harvard architecture.
25
1.9 ARM PROCESSOR
26
● A label, which gives a name to a memory location, comes at the beginning of the
line, starting in the first column.
● Here is an example:
➢ LDR r0,[r8];
➢ a comment label ADD r4,r0,r1
27
➢ This register is set automatically during every arithmetic, logical, or shifting
operation.
➢ The top four bits of the CPSR hold the following useful information about the results
of that arithmetic/logical operation:
❏ The negative (N) bit is set when the result is negative in two‗scomplement
arithmetic.
❏ The zero (Z) bit is set when every bit of the result is zero.
❏ The carry (C) bit is set when there is a carry out of the operation.
❏ The overflow (V ) bit is set when an arithmetic operation results in an
overflow.
1. Arithmetic Instructions
2. Logical Instructions
3. shift / rotate Instructions
4. Comparison Instructions
5. move instructions
6. Load store instructions
INSTRUCTIONS EXAMPLE:-
ADD r0,r1,r2
This instruction sets register r0 to the sum of the values stored in rl and r2. ADD r0,r1,#2
(immediate operand are allowed during addition)
Multiplication:
28
MLA:
Shift operations:
❏ The rotate modifiers always rotate right, moving the bits that fall off the
least-significant bit up to the most-significant bit in the word.
❏ The RRX modifier performs a 33-bit rotate, with the CPSR's C bit being inserted
above the sign bit of the word; this allows the carry bit to be included in the rotation
❏ compare instruction modifies flags values (Negative flag, zero flag, carry flag,
Overflow flag)
❏ CMP r0, rl computes r0 - r1, sets the status bits, and throws away the result of the
subtraction.
❏ CMN uses an addition to set the status bits.
❏ TST performs a bit-wise AND on the operands,
❏ while TEQ performs an exclusive-or
29
Load store instructions:
30
POST-TEST- MCQ TYPE
(a) i, ii and iv
(b) i, iii, iv and vi
(c) Steps i, ii and iii
(d) i , ii and vi.
2. In a multitasking OS,
3. RTOS is used in most embedded systems when the system does _______
(a) concurrent processing of multiple real time processes
(b) sequential processing of multiple processes when the tasks have real time
constraints
(c) real time processing of multiple processes
(d) the concurrent processing of multiple processes, tasks have real time
constraints and deadlines, and high priority task preempts low priority task as per
the real time constraints.
31
(a) opening or connecting or binding or reading or writing or closing or other
actions of the device
(b receiving input or sending outputs from device
(c) access to parallel or serial port by the device
(d) controlling and configuring the device for read and write functions.
(a) v correct
(b) i, iv and v correct
(c) all correct
(d) all correct except iv.
32
(a) all
(b) all except v and viii
(c) iii and vi
(d) all except i and ii
(a) all except v (b) i, ii and iii (c) all except iv (d) all
9. Cache
(i) is a fast read and write on-chip memory for the processor execution unit
(ii) stores instructions and data fetched in advance from ROM or RAM for use of
execution unit and for data write back for RAM
(iii) has advantage that processor execution unit does not have to wait for instruction and
data from external buses and also does faster write back of data meant for RAM
(iv) use is must in embedded system with large memory requirements
(v) has lower power dissipation compared to RAM
33
34
EMBEDDED SYSTEMS
UNIT - 2
MEMORY AND INPUT / OUTPUT MANAGEMENT
Aim :
To Give an insight of Embedded systems
Objectives :
The Course will enable the students to:
1.Get introduced to features that build an embedded systems
2.Learn about the various components within an embedded systems
3.Learn the techniques of interfacing between processors & peripheral devices related to
embedded processing
4.Do the efficient programs on any dedicated processor
Outcomes :
The students should be able to :
1. Understand basic building blocks of embedded systems
2. Interface various peripherals to processors
3. Program embedded systems
4. Use the basic concepts of system programming like operating systems,assembler compilers
etc.., and to understand the management task needed for developing embedded systems.
a) Flash memory
b) PROM
c) EPROM
d) ROM
1
Answer: d
a) RAM
b) Flash memory
c) Shifters
d) ROM
Answer: c
b) ferrimagnetic memory
c) anti-magnetic memory
d) anti-ferromagnetic
Answer: a
a) SRAM
b) DRAM
c) EPROM
d) EEPROM
Answer: a
a) DRAM
b) SRAM
c) EPROM
d) EEPROM
Answer: a
2
6. How many main signals are used with memory chips?
a) 2
b) 4
c) 6
d) 8
Answer: b
Answer: c
8. Which are the two main types of processor connection to the motherboard?
Answer: a
3
10. How many numbers of ways are possible for allocating the memory to the modular
blocks?
a) 1
b) 2
c) 3
d) 4
Answer:C
11. Which of the following can periodically trigger the context switch?
a) software interrupt
b) hardware interrupt
c) peripheral
d) memory
Answer:B
12. Which of the following are interfaced as the outputs to the parallel ports?
a) keyboards
b) switches
c) LEDs
d) knobs
Answer:C
a) UART
b) SPI
c) Physical interface
d) Electrical interface
Answer:D
4
14. Which of the following is not a serial protocol?
a) SPI
b) I2C
c) Serial port
d) RS232
Answer: d
15. Which of the following can transfer multiple bits of data simultaneously?
a) serial port
b) sequential port
c) concurrent unit
d) parallel port
Answer: d
❏ whenever you have output ready to be sent, you check if the bus is free and
send it. Depending on how the bus works, sending it can take a large amount
of time, during which you may not be able to do anything else.
❏ Input works similarly- every so often you check the bus to see if input exists.
5
2.1.3 Multithread polling
❏ In this method, the bus fires off an interrupt to the processor whenever IO is
ready.
❏ The processor then jumps to a special function, dropping whatever else it
was doing.
❏ The special function (called an interrupt handler, or interrupt service routine)
takes care of all IO, then goes back to whatever it was doing.
❏ This technique is great as long as dealing with the IO is a short process, such
as when you just need to set up DMA.
❏ If its a long process, use multithreaded polling or interrupts with threads.
6
that can automatically detect when the IO device is ready for more data, and
transfer that data.
➢ This technique may be used in conjunction with many of the other
techniques, for instance an interrupt may be used when the data transfer is
complete.
❏ Input and output devices usually have some analog or non-electronic component— for
instance, a disk drive has a rotating disk and analog read/write electronics.
❏ But the digital logic in the device that is most closely connected to the CPU very
strongly resembles the logic you would expect in any computer system.
❏ The interface between the CPU and the device’s internals is a set of registers. The CPU
talks to the device by reading and writing the registers.
❖ Data registers hold values that are treated as data by the device, such as the data
read or written by a disk.
❖ Status registers provide information about the device’s operation, such as whether
the current transaction has completed.
❏ Some registers may be read-only, such as a status register that indicates when the
device is done, while others may be readable or writable.
7
2.1.8 INPUT AND OUTPUT PRIMITIVES
8
2.2.1 Caches
➢ Caches are widely used to speed up memory system performance. The cache
speeds up average memory access time when properly used.
➢ It increases the variability of memory access times—accesses in the cache
will be fast, while access to locations not cached will be slow.
➢ A cache is a small, fast memory that holds copies of some of the contents of
main memory. Because the cache is fast, it provides higher-speed access for
the CPU; but since it is small, not all requests can be satisfied by the cache,
forcing the system to wait for the slower main memory.
➢ Caching makes sense when the CPU is using only a relatively small set of
memory locations at any one time; the set of active locations is often called
the working set.
➢ A cache controller mediates between the CPU and the memory system
comprising the main memory.
➢ The cache controller sends a memory request to the cache and main
memory.
➢ If the requested location is in the cache, the cache controller forwards the
location’s contents to the CPU and aborts the main memory request; this
condition is known as a cache hit.
➢ If the location is not in the cache, the controller waits for the value from main
memory and forwards it to the CPU; this situation is known as a cache miss.
9
minimum addressable unit, then the lowest bits of the address are used as
an offset to select the required value from the data field.
➢ Given the structure of the cache, there is only one block that must be
checked to see whether a location is in the cache—the index uniquely
determines that block.
➢ If the access is a hit, the data value is read from the cache.
➢ The direct-mapped cache is both fast and relatively low cost, but it does have
limits in its caching power due to its simple scheme for mapping the cache
onto main memory.
➢ The limitations of the direct-mapped cache can be reduced by going to the
set-associative cache structure .
10
2.3 Memory,Input output devices and interfacing
❏ The memory unit in an embedded system should have low access time and high
density (a memory chip has greater density if it can store more bits in the same
amount of space).
❏ Memory in an embedded system consists of ROM (only read operations permitted) and
RAM (read and write operations are permitted).
❏ The contents of ROM are non-volatile (power failure does not erase the contents) while
RAM is volatile.
❏ ROM stores the program code while RAM is used to store transient input or output
data. Embedded systems generally do not possess secondary storage devices such as
magnetic disks.
❏ As programs of embedded systems are small there is no need for virtual storage.
11
2.3.1 Volatile memory
❏ Although there are exceptions, the ROM is generally viewed as read only
device.when the ROM is implemented,positions in the array that are to store
a logical 0 have a transistor connected as shown in figure. Those positions
intended to store a logical 1 have none.
❏ A high level interface to the SRAM is very similar to that for the ROM.The
major differences arise from support for write capability. Figure 3.4
represents the major I/O signals and a typical cell in an SRAM array.
12
2.3.5 SDRAM
13
computer, provides an efficient mode of communication between the central
system and the outside environment.
❖ The most common input output devices are:
i) Monitor
ii) Keyboard
iii) Mouse
iv) Printer
v) Magnetic tapes
❏ The devices that are under the direct control of the computer are said
to be connected online.
➔ Input Output Interface provides a method for transferring information
between internal storage and external I/O devices. Peripherals connected to
a computer need special communication links for interfacing them with the
central processing unit. The purpose of communication link is to resolve the
differences that exist between the central computer and each peripheral.
1. Peripherals are electromechnical and electromagnetic devices and CPU and memory are
electronic devices. Therefore, a conversion of signal values may be needed.
2. The data transfer rate of peripherals is usually slower than the transfer rate of CPU and
consequently, a synchronization mechanism may be needed.
3. Data codes and formats in the peripherals differ from the word format in the CPU and
memory.
1) The operating modes of peripherals are different from each other and must
be controlled so as not to disturb the operation of other peripherals
connected to the CPU.
2) To Resolve these differences, computer systems include special hardware
components between the CPU and Peripherals to supervise and synchronize
all input and out transfers.
3) These components are called Interface Units because they interface between
the processor bus and the peripheral devices.
4) I/O BUS and Interface Module It defines the typical link between the
processor and several peripherals.
5) The I/O Bus consists of data lines, address lines and control lines. The I/O
bus from the processor is attached to all peripherals interface.
6) To communicate with a particular device, the processor places a device
address on address lines.
7) Each Interface decodes the address and control received from the I/O bus,
interprets them for peripherals and provides signals for the peripheral
controller.
8) It is also synchronizes the data flow and supervises the transfer between
peripheral and processor.
9) Each peripheral has its own controller. For example, the printer controller
controls the paper motion, the print timing The control lines are referred as
I/O command.
14
The commands are as following:
15
2.4.1 Hardware Interrupt
16
2. Upon reception of the same, the general sequence of handling is as follows
● Current instruction being executed is completed.
● CPU copies the internal register called PSW – Program Status Word (the
register that has the flags like Carry, Zero etc) on to stack or an internal
backup register
● Address of the next instruction to be executed is saved on the stack or
another internal backup register so that it can be resumed after interrupt
processing.
● The Program counter is set to the vector address specific to that interrupt.
3. A piece of code called the Interrupt Service Routine (ISR) is placed in the
vector location of an interrupt, to handle it. Typical flow of operation includes
● If needed, store the previous PSW and return address in memory
● Store the context – any more internal registers, status registers etc that
might be modified during the course of execution of this ISR
● Perform necessary operations to process that interrupt like copying data
to/from the peripheral, prepare for next cycle etc.
● Up on completion, restore the context back to the original values from the
stored values
● Restore the PSW and jump to the address of the instruction next to the
interrupted one.
4. While the overall interrupt mechanism remains same, the exact handling,
ways to return from interrupt etc are different for CPU architectures like
8051, ARM, AVR etc.
17
5. Interrupt Sources, Level, Masking and Priority Interrupt Controller
6. In a typical SoC, there could be hundreds of peripherals – interrupt sources
that may vie for processor attention. It is impossible to route all these signals
to the CPU.
7. So there is another special purpose peripheral called Interrupt Controller to
which all the peripheral interrupts signals are connected.
8. The controller is in turn connected to the CPU with one or few lines of
signals, with which it can interrupt the CPU.
9. Controllers are provided with various registers to mask/unmask the
interrupts, read pending/raw status, set priority etc.
10. The controller monitors the signals from peripherals and if there are any
active interrupts, based on the preconfigured priority decides the source to
be processed first. Then it signals the CPU with an interrupt.
11. The CPU, in the ISR, can then read the pending interrupt register and process
the same.
18
2.4.6 Interrupt Maskability
➢ While most of the interrupts could be enabled or disabled by the will of the
user, in some implementations, there might be some interrupts that cannot
be disabled or masked.
➢ These Non-Maskable Interrupts or NMI, as they are called, are used to
inform CPU of critical conditions like power going down, occurrence of
watchdog interrupt etc. Most likely, there is no need for special handling of
the same in software perspective.
❏ There is always a delay from the time of assertion of interrupt and the action
handling of that interrupt. This might be due to various reasons like the CPU
executing a critical section with interrupts disabled, or executing a higher
priority interrupt etc.
❏ Handling of this delay or latency determines the difference between a
General Purpose (no guaranteed latency) and a Real Time Operating System
(guaranteed latency).
19
POST TEST MCQ TEST
1. What happens when 8 bits are transferred in the SPI?
a) wait statement
b) ready statement
c) interrupt
d) remains unchanged
ANSWER: C
2. Which signal is used to select the slave in the serial peripheral interfacing?
a) slave select
b) master select
c) interrupt
d) clock signal
ANSWER: A
3. How much time period is necessary for the slave to receive the interrupt and transfer the
data?
ANSWER: B
a) disable interrupt
b) enable interrupts
c) remains unchanged
d) ready state
20
ANSWER: A
a) content-addressable memory
ANSWER: A
ANSWER: A
b) switch
c) alphanumeric display
ANSWER: B
21
9.How many registers are there to control the parallel port in the basic form?
a) 1
b) 3
c) 2
d) 5
ANSWER: C
a) output port
b) input port
c) parallel port
d) output-input port
ANSWER: A
22
EMBEDDED SYSTEMS
CHAPTER 3
PROCESSES AND OPERATING SYSTEMS
Aim :
The students are expected to learn the various aspects in Embedded systems and its
different types of systems with their respective developments. The inputs of the subject is
to make students familiarize with the developmental types and functions of embedded
systems.
Objectives :
Outcomes :
1. Help to examine the definitions and internalize the need for understanding the various
types of embedded systems.
2. Develop the responsible attitude towards the use of embedded systems as well as the
technology
3. Able to envision the social impact on the products/projects they develop in their career.
4. Analyse the professional responsibility and empowering access to information in the
workplace.
1
1. Which of the following works by dividing the processor’s time?
c) kernel
d) applications
2.Which of the following decides which task can have the next time slot?
b) applications
c) kernel
d) software
a) kernel
c) multitasking kernel
d) application manager
4. Which of the following provides a time period for the context switch?
a) timer
b) counter
c) time slice
2
d) time machine
a) software interrupt
b) hardware interrupt
c) peripheral
d) memory
a) software interrupt
b) hardware interrupt
c) peripheral
d) memory
8. Which of the following stores all the task information that the system
requires?
b) register
3
c) accumulator
9. Which of the following can implement the message passing and control?
a) application software
b) operating system
c) software
d) kernel
12. When the System processes data instructions without any delay is called as
A. online system
B. real-time system
4
C. instruction system
D. offline system
13.In Which of the following algorithm the process that requests the CPU first
is allocated the CPU first
c)Priority Scheduling
d)Round-Robin Scheduling
14. Which scheduling policy is most suitable for time shared operating system
?
b.FCFS
c.LCFS
d.Round robin
15. Which of the following scheduling algorithm associates with each process
the length of the process’s next CPU burst
c)Priority Scheduling
d)Round-Robin Scheduling
5
3.1 MULTIPLE TASKS AND MULTIPLE PROCESSES
As shown in Figure 3.1, this device is connected to serial ports on both ends. The
input to the box is an uncompressed stream of bytes. The box emits a compressed
string of bits on the output serial line, based on a predefined compression table.
Such a box may be used, for example, to compress data being sent to a modem.
The program’s need to receive and send data at different rates for example, the
program may emit 2 bits for the first byte and then 7 bits for the second byte will
obviously find itself reflected in the structure of the code. It is easy to create
irregular, ungainly code to solve this problem; a more elegant solution is to create a
queue of output bits, with those bits being removed from the queue and sent to the
serial port in 8-bit sets.
6
But beyond the need to create a clean data structure that simplifies the control
structure of the code, we must also ensure that we process the inputs and outputs at
the proper rates. For example, if we spend too much time in packaging and
emitting output characters, we may drop an input character. Solving timing
problems is a more challenging problem.
The text compression box provides a simple example of rate control problems. A
control panel on a machine provides an example of a different type of rate control
problem, the asynchronous input.
The control panel of the compression box may, for example, include a compression
mode button that disables or enables compression, so that the input text is passed
through unchanged when compression is disabled. We certainly do not know when
the user will push the compression mode button the button may be depressed
asynchronously relative to the arrival of characters for compression.
7
3.1.2Multirate Systems
Implementing code that satisfies timing requirements is even more complex when
multiple rates of computation must be handled. Multirate embedded computing
systems are very common, including automobile engines, printers, and cell phones.
In all these systems, certain operations must be executed periodically, and each
operation is executed at its own rate.
8
reasonable time reference. The deadline for a periodic process may in general
occur at some time other than the end of the period.
Rate requirements are also fairly common. A rate requirement specifies how
quickly processes must be initiated.
The period of a process is the time between successive executions. For example,
the period of a digital filter is defined by the time interval between successive input
samples.
The process’s rate is the inverse of its period. In a multirate system, each process
executes at its own distinct rate.
9
The most common case for periodic processes is for the initiation interval to be
equal to the period. However, pipelined execution of processes allows the initiation
interval to be less than the period. Figure 3.3 illustrates process execution in a
system with four CPUs.
T= ∑ Ti
10
We need a basic measure of the efficiency with which we use the CPU. The
simplest and most direct measure is utilization:
Utilization is the ratio of the CPU time that is being used for useful computations
to the total available CPU time. This ratio ranges between 0 and 1, with 1 meaning
that all of the available CPU time is being used for system purposes. The
utilization is often expressed as a percentage. If we measure the total execution
time of all processes over an interval of time t, then the CPU utilization is
U=T/t
11
To understand the basics of a context switch, let’s assume that the set of tasks is in
steady state:
Everything has been initialized, the OS is running, and we are ready for a timer
interrupt. Figure 3.4 shows a sequence diagram for a context switch in
freeRTOS.org. This diagram shows the application tasks, the hardware timer, and
all the functions in the kernel that are involved in the context switch:
vPreemptiveTick () is called when the timer ticks.
portSAVE_CONTEXT() swaps out the current task context..
vTaskSwitchContext ( ) chooses a new task.
portRESTORE_CONTEXT() swaps in the new context.
3.2.1Operating Systems
An Operating system is a program that controls the execution of application
programs and acts as an interface between the user of a computer and the computer
hardware.
12
A more common definition is that the operating system is the one program running
at all times on the computer (usually called the kernel), with all else being
applications programs.
An Operating system is concerned with the allocation of resources and services,
such as memory, processors, devices and information. The Operating System
correspondingly includes programs to manage these resources, such as a traffic
controller, a scheduler, memory management module, I/O programs, and a file
system.
13
We will see that some types of timing requirements for a set of processes imply
that we cannot utilize 100% of the CPU’s execution time on useful work, even
ignoring context switching overhead.
However, some scheduling policies can deliver higher CPU utilizations than
others, even for the same timing requirements.
One very simple scheduling policy is known as cyclostatic scheduling or
sometimes as Time Division Multiple Access scheduling. As illustrated in Figure
3.5, a cyclostatic schedule is divided into equal-sized time slots over an interval
equal to the length of the hyperperiod H. Processes always run in the same time
slot.
Two factors affect utilization: the number of time slots used and the fraction of
each time slot that is used for useful work. Depending on the deadlines for some of
the processes, we may need to leave some time slots empty. And since the time
slots are of equal size, some short processes may have time left over in their time
slot
Another scheduling policy that is slightly more sophisticated is round robin. As
illustrated in Figure 3.6, round robin uses the same hyperperiod as does cyclostatic.
It also evaluates the processes in order.
14
But unlike cyclostatic scheduling, if a process does not have any useful work to do,
the round-robin scheduler moves on to the next process in order to fill the time slot
with useful work. In this example, all three processes execute during the first
hyperperiod, but during the second one, P1 has no useful work and is skipped.
The processes are always evaluated in the same order. The last time slot in the
hyperperiod is left empty; if we have occasional, non-periodic tasks without
deadlines, we can execute them in these empty time slots. Round-robin scheduling
is often used in hardware such as buses because it is very simple to implement but
it provides some amount of flexibility.
In addition to utilization, we must also consider scheduling overhead—the
execution time required to choose the next execution process, which is incurred in
addition to any context switching overhead.
In general, the more sophisticated the scheduling policy, the more CPU time it
takes during system operation to implement it. Moreover, we generally achieve
higher theoretical CPU utilization by applying more complex scheduling policies
with higher overheads.
The final decision on a scheduling policy must take into account both theoretical
utilization and practical scheduling overhead.
3.3.1 Multiprocessor
A multiprocessor is, in general, any computer system with two or more processors
coupled together. Multiprocessors used for scientific or business applications tend
to have regular architectures: several identical processors that can access a uniform
15
memory space. We use the term processing element (PE) to mean any unit
responsible for computation, whether it is programmable or not.
Embedded system designers must take a more general view of the nature of
multiprocessors. As we will see, embedded computing systems are built on top of
an astonishing array of different multiprocessor architectures.
The first reason for using an embedded multiprocessor is that they offer
significantly better cost/performance—that is, performance and functionality per
dollar spent on the system—than would be had by spending the same amount of
money on a uniprocessor system. The basic reason for this is that processing
element purchase price is a nonlinear function of performance [Wol08].
The cost of a microprocessor increases greatly as the clock speed increases. We
would expect this trend as a normal consequence of VLSI fabrication and market
economics. Clock speeds are normally distributed by normal variations in VLSI
processes; because the fastest chips are rare, they naturally command a high price
in the marketplace.
Because the fastest processors are very costly, splitting the application so that it can
be performed on several smaller processors is usually much cheaper.
Even with the added costs of assembling those components, the total system comes
out to be less expensive. Of course, splitting the application across multiple
processors does entail higher engineering costs and lead times, which must be
factored into the project.
In addition to reducing costs, using multiple processors can also help with real time
performance. We can often meet deadlines and be responsive to interaction much
more easily when we put those time-critical processes on separate processors.
Given that scheduling multiple processes on a single
Because we pay for that overhead at the nonlinear rate for the processor, as
illustrated in Figure 3.7, the savings by segregating time-critical processes can be
large—it may take an extremely large and powerful CPU to provide the same
responsiveness that can be had from a distributed system.
16
Many of the technology trends that encourage us to use multiprocessors for
performance also lead us to multiprocessing for low power embedded computing.
Several processors running at slower clock rates consume less power than a single
large processor: performance scales linearly with power supply voltage but power
scales with V2.
Austin et al. [Aus04] showed that general-purpose computing platforms are not
keeping up with the strict energy budgets of battery-powered embedded
computing. Figure 3.8 compares the performance of power requirements of
desktop processors with available battery power. Batteries can provide only about
75 Mw of power.
17
Desktop processors require close to 1000 times that amount of power to run. That
huge gap cannot be solved by tweaking processor architectures or software.
Multiprocessors provide a way to break through this power barrier and build
substantially more efficient embedded computing platforms.
18
3.4.1 Shared Memory Communication:
Figure 3.9 illustrates how shared memory communication works in a bus-based
system. Two components, such as a CPU and an I/O device, communicate through
a shared memory location. The software on the CPU has been designed to know
the address of the shared location.
The shared location has also been loaded into the proper register of the I/O device.
If, as in the figure, the CPU wants to send data to the device, it writes to the shared
location. The I/O device then reads the data from that location. The read and write
operations are standard and can be encapsulated in a procedural interface.
19
is used for bidirectional signaling between the CPU and the I/O device, care must
be taken. Consider the following scenario:
· CPU reads the flag location and sees that it is 0.
· I/O device reads the flag location and sees that it is 0.
· CPU sets the flag location to 1 and writes data to the shared location.
· I/O device erroneously sets the flag to 1 and overwrites the data left by the
CPU.
20
microcontroller per household device—lamp, thermostat, faucet, appliance, and so
on.
The devices must communicate relatively infrequently; furthermore, their physical
separation is large enough that we would not naturally think of them as sharing a
central pool of memory.
Passing communication packets among the devices is a natural way to describe
coordination between these devices. Message passing is the natural implementation
of communication in many 8-bit microcontrollers that do not normally operate with
external memory.
3.4.3 Signals
Another form of interprocess communication commonly used in Unix is the signal.
A signal is simple because it does not pass data beyond the existence of the signal
itself. A signal is analogous to an interrupt, but it is entirely a software creation. A
signal is generated by a process and transmitted to another process by the operating
system.
A UML signal is actually a generalization of the Unix signal. While a Unix signal
carries no parameters other than a condition code, a UML signal is an object. As
such, it can carry parameters as object attributes. Figure 3.11 shows the use of a
signal in UML. The sigbehavior ( ) behavior of the class is responsible for
throwing the signal, as indicated by <<send>>.The signal object is indicated by
the <<signal>> stereotype.
21
3.5 Evaluating Operating System Performance
The scheduling policy does not tell us all that we would like to know about the
performance of a real system running processes. Our analysis of scheduling
policies makes some simplifying assumptions:
1. We have assumed that context switches require zero time. Although it is often
reasonable to neglect context switch time when it is much smaller than the process
execution time, context switching can add significant delay in some cases.
2. We have assumed that we know the execution time of the processes. In fact, we
learned in Section 5.6 that program time is not a single number, but can be
bounded by worst-case and best-case execution times.
3. We probably determined worst-case or best-case times for the processes in
isolation. But, in fact, they interact with each other in the cache. Cache conflicts
among processes can drastically degrade process execution time.
The zero-time context switch assumption used in the analysis of RMS is not
correct—we must execute instructions to save and restore context, and we must
execute additional instructions to implement the scheduling policy. On the other
hand, context switching can be implemented efficiently—context switching need
not kill performance.
The effects of nonzero context switching time must be carefully analyzed in the
context of a particular implementation to be sure that the predictions of an ideal
scheduling policy are sufficiently accurate.
In most real-time operating systems, a context switch requires only a few hundred
instructions, with only slightly more overhead for a simple real-time scheduler like
RMS. When the overhead time is very small relative to the task periods, then the
zero-time context switch assumption is often a reasonable approximation.
22
Problems are most likely to manifest themselves in the highest-rate processes,
which are often the most critical in any case.
Completely checking that all deadlines will be met with nonzero context switching
time requires checking all possible schedules for processes and including the
context switch time at each preemption or process initiation. However, assuming
an average number of context switches per process and computing CPU utilization
can provide at least an estimate of how close the system is to CPU capacity.
c) share data
23
c) can be fixed or variable sized
4.Which of the following two operations are provided by the IPC facility?
6. A thread___________
24
ii) An example of multithreading is a database server that listens for and
process numerous client request.
a.i-True, ii-False
b.i-True, ii-True
c.i-False, ii-True
d.i-False, ii-False
a)1,2,4
b)1,2,3
c)1,3,4
d)1,2,3,4
a) preemptive Only
b) nonpreemptive Only
a.Control of Processes
b.Access of Processes
c.Execution of Processes
25
d.Termination of Processes
26
27
Embedded Systems
Chapter - 4
EMBEDDED SOFTWARE
Aim :
The students are expected to learn the various aspects in Embedded systems and its
different types of systems with their respective developments. The inputs of the subject is to
make students familiarize with the developmental types and functions of embedded
systems.
Objectives :
Outcomes :
1. Help to examine the definitions and internalize the need for understanding the various
types of embedded systems.
2. Develop the responsible attitude towards the use of embedded systems as well as the
technology
3. Able to envision the social impact on the products/projects they develop in their career.
4. Analyse the professional responsibility and empowering access to information in the
workplace.
1
Pre-test MCQ type
6) Embedded system is
a) Reactive
b) Real time
c) Proactive
d) Reactive & Real time
2
8) Software for embedded system is written in
a) Flash ROM
b) RAM
c) EEPROM
14) Which software resides only in read only memory and is used to control
products and systems for the consumer and industrial markets.
a) Business
b) Embedded
c) System
d) Personal
3
15) It is a characteristic provision of some debuggers to stop the execution after
each
instruction because
a) it facilitates to analyze or vary the contents of memory and register
b) it facilitates to move the break point to a later point
c) it facilitates to rerun the program
d) it facilitates to load the object code program to system memory
4
MOV instructions are commands which the CPU runs, while ORG and END are
assembler directives.
❏ The assembler places the opcode to the memory location 0 when the ORG
directive is used, while END indicates to the end of the source code. A program
language instruction consists of the following four fields −
The label field allows the program to refer to a line of code by name. The label
fields cannot exceed a certain number of characters.
The mnemonics and operands fields together perform the real work of the
program and accomplish the tasks. Statements like ADD A , C & MOV C, #68
where ADD and MOV are the mnemonics, which produce opcodes ; "A, C" and
"C, #68" are operands.
These two fields could contain directives. Directives do not generate machine
code and are used only by the assembler, whereas instructions are translated
into machine code for the CPU to execute.
5
● The comment field begins with a semicolon which is a comment indicator.
● Notice the Label "HERE" in the program. Any label which refers to an instruction
should be followed by a colon.
❏ Embedded C is the most popular programming language in the software field for
developing electronic gadgets.
❏ Each processor used in an electronic system is associated with embedded software.
❏ Embedded C programming plays a key role in performing specific functions by the
processor.
❏ In day-to-day life we used many electronic devices such as mobile phones, washing
machines, digital cameras, etc. These all devices working are based on
microcontrollers that are programmed by embedded C.
❏ Let's see the block diagram representation of embedded system programming:
❏ The Embedded C code written in the above block diagram is used for blinking the
LED connected with Port0 of the microcontroller.
6
➢ In embedded system programming C code is preferred over other language. Due
to the following reasons:
● Easy to understand
● High Reliability
● Portability
● Scalability
Basic Declaration
➢ Function is a collection of statements that is used for performing a specific task and
a collection of one or more functions is called a programming language. Every
language is consisting of basic elements and grammatical rules.
➢ The C language programming is designed for function with variables, character set,
data types, keywords, expression and so on are used for writing a C program.
➢ The extension in C language is known as embedded C programming language. As
compared to above the embedded programming in C is also have some additional
features like data types, keywords and header file etc is represented by
1. #include<microcontroller name.h>
7
Let's see the block diagram representation of Embedded C Programming Steps:
❏ It is a vital attribute in real-time systems. Timing constraints decides the total
correctness of the result sin real-time systems. The correctness of results in
real-time system does not depends only on logical correctness but also the result
should be obtained within the time constraint. There might be several events
happening in real time system and these events are scheduled by schedulers using
timing constraints.
➢ Timing constraints associated with the real-time system is classified to identify the
different types of timing constraints in a real-time system. Timing constraints are
broadly classified into two categories:
1. Performance Constraints :
8
quickly and accurately the system is responding. It ensures that the real-time system
performs satisfactorily.
2. Behavioral Constraint :
Delay Constraint –
❏ A delay constraint describes the minimum time interval between occurrence of two
consecutive events in the real-time system.
❏ If an event occurs before the delay constraint, then it is called a delay violation. The
time interval between occurrence of two events should be greater than or equal to
delay constraint.
❏ If D is the actual time interval between occurrence of two events and d is the delay
constraint, then
D >= d
9
Deadline Constraint –
Duration Constraint –
10
4.3 Embedded Operating System
❏ Single system control loop is the simplest type of embedded operating system. It is so like
operating system but it is designed to run the only single task.
❏ It still under debate that this system should be classified as a type of operating system or not.
11
4.3.2.2 Multi-Tasking Operating System
❏ As the name suggests that this operating system can perform multiple tasks. In multi-tasking
operating system there are several tasks and processes that execute simultaneously.
❏ More than one function can be performed if the system has more than one core or processor.
❏ The operating system is switched between tasks. Some tasks wait for events while other
receive events and become ready to run.
❏ If one is using a multitasking operating system, then software development is simplified
because different components of software can be made independent to each other
➢ A system that can exist in multiple states (one state at a time) and transition from
one state to another.
4.4.2 Characteristics
➢ Every time tick, the system should check if it is time to transition to the next state
➢ When it is time to transition, appropriate control variables are updated to reflect
the new state
4.4.4 Categories
12
➢ Input-based/Timed Multi-state systems: Transitions depend both on external input
and time
Example
Time Constants
#define RED_DURATION 20
#define RED_AND_AMBER_DURATION 5
#define GREEN_DURATION 30
#define AMBER_DURATION 5
switch (Light_state_G)
case RED:
Red_light = ON;
Amber_light = OFF;
Green_light = OFF;
if (++Time_in_state == RED_DURATION)
Light_state_G = RED_AND_AMBER;
13
Time_in_state = 0;
Break;
4. Which software is used to control products and systems for the consumer and
industrial
markets?
a) System software
b) Artificial intelligence software
c) Embedded software
d) Engineering and scientific software
14
5. The loops are interchangeable, in which design activity ?
A. hardware/software partitioning
B. high-level transformation
C. scheduling
D. compilation
6. Multiprogramming systems
7. The operating system determines the manner in which all of the following occurs
except
15
16
Embedded Systems
Chapter - 5
EMBEDDED SYSTEMS DEVELOPMENT
Aim :
The students are expected to learn the various aspects in Embedded systems and its different
types of systems with their respective developments. The inputs of the subject is to make
students familiarize with the developmental types and functions of embedded systems.
Objectives :
Outcomes :
1. Help to examine the definitions and internalize the need for understanding the various types
of embedded systems.
2. Develop the responsible attitude towards the use of embedded systems as well as the
technology
3. Able to envision the social impact on the products/projects they develop in their career.
4. Analyse the professional responsibility and empowering access to information in the
workplace.
1
Pre-test MCQ type
1. Which system software is used to convert a "C" language program in to language of
another processor?
a)Compiler
b)Linker
c)Cross compiler
d)Cross Linker
6) Embedded system is
a. Reactive
b. Real time
c. Proactive
d. Reactive & Real time
2
8) Software for embedded system is written in
a. Flash ROM
b. RAM
c. EEPROM
d. ROM
14) Which software resides only in read only memory and is used to control products
and systems for the consumer and industrial markets.
a. Business
b. Embedded
3
c. System
d. Personal
15) It is a characteristic provision of some debuggers to stop the execution after each
instruction because
a. it facilitates to analyze or vary the contents of memory and register
b. it facilitates to move the break point to a later point
c. it facilitates to rerun the program
d. it facilitates to load the object code program to system memory
Stability
Safety
4
● Software Development Life Cycle (SDLC) for embedded software is characterized by
more strict requirements and limitations in terms of quality, testing, and engineering
expertise.
Security
● Security became a burning issue in the digital world.
● The related risks grow exponentially, especially so for IoT devices gaining popularity
worldwide and becoming more interconnected to each other.
● Because modern home appliances like electric cookers, refrigerators and washing
machines have connectivity features integrated by default, the Internet of Things now
is exposed to a serious risk of hacking attacks.
Launch Phase
Design Limitations
➢ The challenges in design of embedded systems have always been in the same
limiting requirements for decades:
● Small form factor;
● Low energy;
5
➢ The market demands from designers to pack more processing power and longer
battery life into smaller spaces, which is often a tradeoff.
➢ Finally, depending on applications in IoT, there is a growing demand for manufacture
of very scalable processor families ranging from cheap and ultra-low-power to
maximum performance and highly configurable processors with forward-compatible
instruction sets.
➢ There is similar demand for increased performance of system buses and
internal/external memory caches.
● Gartner Group estimation shows that, presently, most of the apps in the market are
launched by businesses younger than 3 years old.
● With all their probable expertise in software development, many of them lack
hands-on experience in implementing and updating their applications in IoT
environment, especially with regard to security implications.
● Further expansion of IoT devices on the background of their connectivity puts more
pressure on their adaptability.
● Users must be capable of administering the app through a simple user interface via
all available channels including over-the-air firmware updates, which needs extreme
compatibility across the entire ecosystem.
● Integrity becomes a function of security.
● To protect the IoT from malicious attacks or compromising, security must be
implemented within each device at every level: the end node, gateway, cloud, etc.
● Embedded solution developers are facing many specific issues along this way.
● We do not intend covering all of them in detail; let us have a look at a few of them
6
Connectivity
● There are so many different ways to connect device to the internet. Wireless connection
can be established through Wi-Fi, Ethernet, Edge, LoRa, a Bluetooth bridge, and other
channels.
● Leaving apart their pros and cons, the fact is each of them is created with a different
technology stack, which means that developers have to have expertise in all of them.
● In addition, it is complicated with an issue, which protocol to use: UDP, COAP, TCP/IP,
etc. or a few protocols at the same time plus TLS and/or MQTT on top of them.
● Pre-engineered software stacks partially resolve this complexity, but the issue remains
for developers to have enough knowledge to understand a problem if something breaks
or requires modification.
Over-the-air Updates
● The issue standing next to connection to the internet is remote updates of the firmware.
In the case of standalone devices, it is enough to send updates to a secure site and notify
users to download and install it.
● The situation is different with the IoT devices; the updates must be delivered and
executed on their own without user’s intervention. Now imagine that even a small IoT
deployment involves a few thousand devices.
● Then, developers have to fulfill the following tasks: generate a firmware update, save it
to the devices, validate that they are delivered from a trusted source, run the update on
the devices at appropriate time, and be ready to roll back the update if there is an issue.
● This job is fairly tough and time-consuming, requires a lot of skill from developers, who
have to be experienced in deploying the updates in the IoT environment.
Debugging
● Debugging is a general issue growing together with the number of connected devices –
time and effort for debugging grows in parallel.
● Along with the process of open source software integration, there occurs more
unexpected behaviors in a system adopting innumerous free flow devices than in the
one, which was specifically designed to interact with them from the start.
7
● Many embedded software developers voice that every embedded project incurs extra
cost for debugging consuming up to 40% of developers’ time.
Pace of Change
● For a few decades, technologies used for embedded systems were almost the same with
some new higher capacity processor to come out once a year.
● Then things eventually began speeding up. In the last 5 years, we witnessed fast
development of emerging technologies including artificial intelligence.
● It creates a problem for developers, because available technologies are changing faster
than they can get hold of them.
● Serial transfer: In serial transfer, data is transfer to device located many meters away
● Parallel transfer: In parallel transfer, data is transferred in 8 or more lines. In this wire
conductor is used for transferring data to a device that is only a few feet away.
● Serial communication is mostly used for transmitting and receiving the signal. The 8051
microcontroller is consisting of Universal Asynchronous Receiver Transmitter (UART)
8
used for serial communication. The signals are transmitted and received by the Rx and
Tx pins of microcontroller.
● The UART take individual bytes of data and sends the individual bits in a sequential
manner. The registers are used for collecting and storing the data inside a memory. UART
is based on half-duplex protocol.
● Half-duplex means transferring and receiving the data, but not at the same time.
● Let's see the block diagram representation of showing serial communication
between flash memory and 8051 microcontroller:
●
● Let's see the program for transmitting character 'S' using the serial window at
baud rate of 9600:
● Consider the 28800 is the maximum baud rate of the 8051 microcontroller For
obtaining the 9600 as the baud rate, the timer value is,
● #include<reg51.h>
● void main()
● {
9
● SBUF='S'; //store the character inside a register//
● TI=0;
● }
❏ Let's see the program for receiving the data from the HyperTerminal and
sending of that data to PORT 0 of the microcontroller at 9600 baud rate:
❏ Consider the 28800 is the maximum baud rate of the 8051 microcontroller
For obtaining the 9600 as the baud rate, the timer value is,
1. #include<reg51.h>
2. void main()
3. {
10. RI=0;
13. }
10
5.2 Intruder Alarm System
● In this case study, we will consider the design and implementation of a small intruder
alarm system suitable for detecting attempted thefts in a home or business
environment Figure
● Figure shows the same gallery with the alarm system installed. In this figure, each of
the windows has a sensor to detect class breakage. A magnetic sensor is also attached
to the door. In each case, the sensors appear to be simple switches as far as the alarm
system is concerned. Foll fig also shows a ‘bell box’ outside the property: this will sound
if an intruder is detected
11
● Inside the door (in Figure 10.2), we have the alarm control panel: this consists mainly of a
small keypad, plus an additional ‘buzzer’ to indicate that the alarm has sounded.
● The alarm system is designed in such a way that the user – having set the alarm by
entering a four-digit password – has time to open the door and leave the room before
the monitoring process starts. Similarly, if the user opens the door when the system is
armed, he or she will have time to enter the password before the alarm begins to sound.
When initially activated, the system is in ‘Disarmed’ state.
● In Disarmed state, the sensors are ignored. The alarm does not sound. The system
remains in this state until the user enters a valid password via the keypad (in our
demonstration system, the password is ‘1234’). When a valid password is entered, the
systems enters ‘Arming’ state.
● In Arming state, the system waits for 60 seconds, to allow the user to leave the area
before the monitoring process begins. After 60 seconds, the system enters ‘Armed’ state.
● In Armed state, the status of the various system sensors is monitored. If a window
sensor is tripped,31 the system enters ‘Intruder’ state. If the door sensor is tripped, the
system enters ‘Disarming’ state.
12
The keypad activity is also monitored: if a correct password is typed in, the system
enters ‘Disarmed’ state.
In Disarming state, we assume that the door has been opened by someone who may be
an authorized system user.
The system remains in this state for up to 60 seconds, after which – by default – it
enters Intruder state. If, during the 60- second period, the user enters the correct
password, the system enters ‘Disarmed’ state.
In Intruder state, an alarm will sound. The alarm will keep sounding (indefinitely),
until the correct password is entered
13
5.3 Controlling a Mobile Robot
● A mobile robot, is a robot that is capable of moving in the surrounding (locomotion).
Mobile robotics is usually considered to be a subfield of robotics and information
engineering.
● Mobile robots have the capability to move around in their environment and are not fixed
to one physical location. Mobile robots can be "autonomous" (AMR - autonomous
mobile robot) which means they are capable of navigating an uncontrolled environment
without the need for physical or electro-mechanical guidance devices.
14
● Alternatively, mobile robots can rely on guidance devices that allow them to travel a
predefined navigation route in relatively controlled space (AGV - autonomous guided
vehicle).
● By contrast, industrial robots are usually more-or-less stationary, consisting of a jointed
arm (multi-linked manipulator) and gripper assembly (or end effector), attached to a
fixed surface.
● Mobile robots have become more commonplace in commercial and industrial settings.
Hospitals have been using autonomous mobile robots to move materials for many
years. Warehouses have installed mobile robotic systems to efficiently move materials
from stocking shelves to order fulfillment zones.
● Mobile robots are also a major focus of current research and almost every major
university has one or more labs that focus on mobile robot research.[3] Mobile robots are
also found in industrial, military and security settings.
● The components of a mobile robot are a controller, sensors, actuators and power
system. The controller is generally a microprocessor, embedded microcontroller or a
personal computer (PC).
● The sensors used are dependent upon the requirements of the robot. The requirements
could be dead reckoning, tactile and proximity sensing, triangulation ranging, collision
avoidance, position location and other specific applications.
● Actuators usually refer to the motors that move the robot can be wheeled or legged. To
power a mobile robot usually we use DC power supply (which is battery) instead of AC.
15
c) in-circuit EPOM
d) in-code emulation
8. What is DfT?
a) discrete Fourier transform
b) discrete for transaction
c) design for testability
d) design Fourier transform
Answer: c
16
9. What is CRC?
a) code reducing check
b) counter reducing check
c) counting redundancy check
d) cyclic redundancy check
Answer: d
17
18