Unit I&Unit II
Unit I&Unit II
Unit I&Unit II
Embedded Hardware
Peripherals
Washing machine is one of the examples of Application specific embedded systems
It contains sensors, actuators, control unit, timers and application-specific user interface
etc.
The basic controls consists of timer, cycle selector mechanism, water temperature selector,
load size selector, start/stop button.
The mechanism includes the motor, transmission, clutch, pump, agitator, inner tub, outer
tub and water inlet valve.
The integrated control panel consists of μc based
board with I/O interface and a control algorithm
running in it.
Input interface consists of wash type selector,
namely Wash, Spin & Rinse, cloth type selector
namely Light, Medium & Heavy, washing time etc.
The output interface consists of LED/LCD displays, status
indication LEDs etc. connected to the μc.
The other types of I/O interfaces are sensor interfaces,
like water temp sensor, water level sensor and other
actuator interfaces including motor control for agitator &
tub movement control, inlet water flow control etc.
The major application domains of embedded systems are consumer, industrial,
automotive, telecom etc.
Automotive Embedded System (AES) are the one where electronics take control over the
mechanical system. Ex. Simple viper control
Some of the uses of embedded controllers in a vehicle are listed below:
Air Conditioner
Engine Control
Fan Control
Headlamp Control
Automatic break system control
Wiper control
Air bag control
Power Windows
AES are normally built around microcontrollers
or DSPs or a hybrid of the two and are generally
known as Electronic Control Units (ECUs).
Types Of Electronic Control Units(ECU):
High-speed Electronic Control Units (HECUs):
▪ HECUs are deployed in critical control units requiring fast
response.
▪ They Include fuel injection systems, antilock brake systems,
engine control, electronic throttle, steering controls,
transmission control and central control units.
Low Speed Electronic Control Units (LECUs):
▪ They are deployed in applications where response time is not so
critical. They are built around low cost microprocessors and
microcontrollers and digital signal processors.
▪ Audio controller, passenger and driver door locks, door glass
control etc.
Automotive Communication Buses
Embedded system used inside an automobile communicate with each other using serial buses.
This reduces the wiring required. Following are the different types of serial Interfaces used in
automotive embedded applications:
▪ Controller Area Network (CAN):
▪ CAN bus was originally proposed by Robert Bosch. It supports medium speed and high speed data
transfer.
▪ CAN is an event driven protocol interface with support for error handling in data transmission.
▪ Local Interconnect Network (LIN):
▪ LIN bus is single master multiple slave communication interface with support for data rates up to 20 Kbps
and is used for sensor/actuator interfacing.
▪ LIN bus follows the master communication triggering to eliminate the bus arbitration problem.
▪ LIN bus applications are mirror controls, fan controls, seat positioning controls
▪ Media-Oriented System Transport(MOST):
▪ MOST is targeted for automotive audio/video equipment interfacing.
▪ A MOST bus is a multimedia fiber optics point–to-point network implemented in a star , ring or
daisy chained topology over optical fiber cables.
▪ MOST bus specifications define the physical as well as application layer , network layer and media
access control.
A memory map is a table that shows the name and address
range of each memory device and peripheral that is located
in the memory space.
A Memory Map is the processor's "address book."
The I/O map contains one entry for each of the peripheral.
To create an I/O map, simply create a table of peripheral
names and address ranges, organized in such a way that the
lowest addresses are at the bottom.
The I/O map is also useful when creating the header file for
your board.
Polling
In this technique the processor polls the device (asks
question) repeatedly at regular intervals to check if
the device has completed the given task or has any
new task to execute.
Interrupts
A peripheral interrupts a processor for some task.
When a fresh interrupt signal is received, the
processor temporarily sets aside its current work and
executes a small piece of software called the interrupt
service routine (ISR). When the ISR completes, the
processor returns to the work that was interrupted.
The Interrupt Map is a table that contains a list of interrupt types and the devices
to which they refer.
In order for the processor to execute the correct ISR, a mapping must exist
between interrupt pins and ISRs (Interrupt Service Routines). This mapping
usually takes the form of an interrupt vector table.
The vector table is usually just an array of pointers to functions, located at some
known memory address. The processor uses the interrupt type (a unique number
associated with each interrupt pin) as its index into this array. The value stored at
that location in the vector table is usually just the address of the ISR to be
executed.
Three main type of memories:
RAM, ROM and Hybrid
RAM ROM Hybrid Memory Devices
(Random Access Memory) (Read only Memory)
Memory can be read and Memory will be read only. Combines both RAM, ROM
written to.
Volatile Memory, retains the Non-Volatile memory, the Non-Volatile memory
contents as long as contents are retained
electricity is supplied. even after electricity is
switched.
Data at any memory location Data at any memory location It has certain features of
can be read or written. can be only read. RAM and some of ROM
Data access to RAM is very Data access to ROM is slow Slower than RAM
fast compared to RAM
Two Types of RAM Three Types of ROM Three Types of Hybrid
a) SRAM (Static RAM) a) Masked ROM Memory Devices.
b) DRAM (Dynamic RAM) b) PROM a) EEPROM
c) EPROM b) Flash
c) NVRAM
Two Types:
SRAM & DRAM
SRAM (Static RAM)
Contents of SRAM are lost after power is off.
DRAM (Dynamic RAM)
Extremely short Data lifetime, even with power.
DRAM Controller is used to refresh and retain the
contents of a DRAM for a longer duration.
Three Types: Masked ROM, PROM, EPROM
Masked ROM:
Hardwired memory devices
Contains Pre-programmed instructions, cannot be
modified or appended, hence low in cost.
PROM (PROGRAMMABLE ROM )
one-time-programmable (OTP) device.
un-programmed state the data is entirely made up of 1’s.
EPROM (ERASABLE-AND-PROGRAMABLE ROM)
Same as PROM, but can be erased and reprogrammed.
Erased by exposing to UV light.
Three Types: EEPROM, Flash Memory & NVRAM
EEPROM
EEPROMs stand for Electrically Erasable and
Programmable ROM.
Erased Electronically, one byte at a time.
Flash
Flash memory devices are high density, low cost,
nonvolatile, fast (to read, but not to write), and
electrically reprogrammable.
Can only be erased one sector at a time.
NVRAM
Stands for Non Volatile RAM, Just as SRAM with Battery Backup
More Expensive than SRAM.
DMA is a technique for transferring blocks of data
directly between two hardware devices.
If DMA controller absent Processor has to transfer the
data between devices.
Working of DMA
The Processor provides the DMA Controller with source
and destination address & total number of bytes of the
block of data which needs transfer.
After copying each byte each address is incremented &
remaining bytes are reduced by one.
When number of bytes reaches zeros the block transfer
ends & DMA Controller sends an Interrupt to Processor.
Memory Testing and its purpose
The purpose of a memory test is to confirm that each storage
location in a memory device is working.
Memory testing is performed to check the address and data
lines are correctly wired and memory chips are working
properly.
The basic idea is to write some data values at each address in
memory and read back to verify. If a value is written at a given
memory location and read back properly then the memory
device passes the test.
Only through careful selection of data values can make sure
passing result to be meaningful. It can be difficult to detect all
memory problems with a simple test.
The wires that connect from microcontroller to Memory chip are:
Address line to select the memory location, Data Line to transfer the data and
Control Line to do read or write operation.
Catastrophic Failure is a memory problem that occurs due to physical and
electrical damage, it is uncommon and easily detectable.
A common source of memory problems is associated with the circuit board.
Typical circuit board problems are:
1. Circuit board wiring between Processor & Memory device.
▪ Usually caused due to an error in design, error in production board,
damaged after manufacturing.
▪ Two wiring problems: Open Wire & Shorted wire.
2. Missing Memory chip.
A missing memory chip is detectable by eyes.
but due to the capacitive nature of unconnected electrical wires, some
memory tests will not detect missing memory chips.
To test it, if we write a value and read it as soon as its written we might not
find that the chip is missing. Instead we will write all values at first and then
sequentially read it back, and if by doing so we get the correct values being
read then we can say the memory chip is intact and not missing.
3. Improperly inserted Memory chip.
The chip will be wrongly inserted or connected.
Will either not be connected to the socket at all or will be connected at the
wrong place
System behaves same as though there is a wiring problem or a missing chip.
Detected by any test.
Strategy for memory testing:
It would be best to have three individual memory tests
▪ A data bus test: Checks electrical wiring problems
▪ Walking 1's test
▪ An address bus test: Checks improperly inserted chips
▪ A device test: Checks to detect missing chips and catastrophic
failures and problems with the control bus wiring
▪ Increment test
These tests have to be executed in a proper order which is:
data bus test first, followed by the address bus test, and then the
device test. That's because the address bus test assumes a
working data bus, and the device test results are meaningless
unless both the address and data buses are known to be good.
Data Bus Test
It is used to check data bus wiring.
In this test we need to confirm that the received data is same as the data sent by processor.
Here we write all possible data values and verify that the memory device stores each one
successfully.
Walking 1’s test: 00000001
▪ This test is used to independently test every bit. 00000010
▪ A single data bit is set to 1 and “walked” through the entire data word. 00000100
▪ If the data bus is working properly the function will return 0.
00001000
▪ Because data bus is being tested any address in the memory will do.
▪ The figure shows consecutive data values for walking 1’s test.
00010000
Address Bus Test. 00100000
It is used to check data bus wiring. 01000000
The address Bus problem leads to overlapping memory locations. 10000000
In the address bus test we need to confirm that each of the address pins can be set to 0 & 1 without affecting any
of the others.
The smallest set of addresses that will cover all possible combinations is the set of “power of two” addresses.
After writing one of the addresses we must check none of the other has been over written.
Device Test
It is used to test the integrity of the memory device.
For thorough and complete device test every memory location has to be visited twice.
The thing to test is that every bit in the device can hold 0 & 1.
A simple increment test for the same is as follows:
▪ The first column represents the memory location.
▪ The second column represents the data that is written at the memory location as given in the
column 1 in incremental fashion.
▪ The third column represents the data in column 2 in inverted format.
▪ During the first pass the data in column 1 is verified and during the second pass data in column
2 is verified.
Address Data 1 Data 2
000h 00000001 11111110
001h 00000010 11111101
… … …