Ktustudents - In: Ec 308 Embedded Systems Module-3
Ktustudents - In: Ec 308 Embedded Systems Module-3
MODULE-3
SYLLABUS
Memory devices and systems - memory map – DMA - I/O Devices – Interrupts - ISR –
Device drivers for handling ISR – Memory Device Drivers – Device Drivers for on-board
bus.
KTUStudents.in
ROM
ROM stands for Read Only Memory.
The memory from which we can only read but cannot write onit.
This type of memory is non-volatile.
An embedded system has ROM unit(s) for storing ROM image and flash to save
non- volatile data and results
ROM image holds the programs, operating system, and data required by the
system.
Following are the various types of ROM:
KTUStudents.in
MROM (Masked ROM)
The very first ROMs were hard-wired devices that contained a pre programmed
set of data or instructions. These kind of ROMs are known as masked ROMs.
MROM programming is performed during IC fabrication.
It is inexpensive ROM.
Used for large scale manufacturing
Uses:
1. A finalised ROM image of system program.
2. Data, pictograms, image pixels, pixels for the fonts of a language.
PROM (One Time Programmable ROM –OTP ROM)
PROM is read-only memory that can be modified only once by a user.
The user buys a blank PROM and enters the desired contents using a PROM
programmer.
A PROM once written is not erasable.
Uses:
1. Smart card identity number and personal information.
2. Storing boot programs.
3. ATM card or credit card or identity card.
KTUStudents.in
Flash memory is a form of EEPROM in which a sector of bytes can be erased in a
flash (very short duration corresponding to a single clock cycle)
Uses:
1. Storing pictures in digital camera.
2. Storing SMS, MMS messages in a mobile phone.
3. Storing voice compressed form in a voice recorder.
RAM
The RAM can be both read and, write.
RAM is used to hold the programs, operating system, and data required by a
computer system.
In embedded systems, it holds the stack and temporary variables of the
programs, operating system, and data.
RAM is generally volatile, (does not retain the data stored in it when the system 's
power is turned off)
Used for saving the variables, stacks, process control blocks, input buffer, output
buffer, decompressed format of program and data at the ROM image.
KTUStudents.in
previous one is being fetched;
SDRAM is used in systems with clock rates up to 1 GHz.
RDRAM (Rambus* DRAM)
RDRAM accesses in bursts of four successive words in single fetch; .
used for 1 GHz + performance of the system
Parameterised Distributed RAM
Parameterised Distributed RAM is the RAM distributes in various system
subunits.
IO units and transceiver sub units can have a slice of RAM each.
Example-1
KTUStudents.in
KTUStudents.in
Memory map for example-2
There are memory space gaps between the origin of ROM,RAM and EEPROM in
spite of very small lengths of available memory.
This gap is due to a design feature of its hardware designer providing expansion of
these memories in the future.
DMA
The DMA requires the CPU to provide two additional bus signals:
KTUStudents.in
■ The bus request is an input to the CPU through which DMA controllers ask
for ownership of the bus.
■ The bus grant signals that the bus has been granted to the DMA controller.
The CPU controls the DMA operation through registers in the DMA controller.
A typical DMA controller includes the following three registers:
■ A starting address register specifies where the transfer is to begin.
■ A length register specifies the number of words to be transferred.
■ A status register allows the DMA controller to be operated by the CPU.
DMA Process:
The bus request is asserted by the DMA controller when it wants to control the
bus.
The CPU will finish all pending bus transactions before granting control of the bus
to the DMA controller.
The bus grant is asserted by the CPU when the bus is ready.
3.4 IO Devices
Some of the input and output devices commonly used in embedded computing
systems are explained below.
Some of these devices are often found as on-chip devices in micro-controllers;
others are generally implemented separately but are still commonly used.
KTUStudents.in
1. Timers and Counters
Timers and counters are distinguished from one another largely by their use, not
their logic.
Both are built from adder logic with registers to hold the current value, with an
increment input that adds one to the current register value.
A timer has its count connected to a periodic clock signal to measure time
intervals,
A counter has its count input connected to an a periodic signal in order to count
the number of occurrences of some external event.
Because the same logic can be used for either purpose, the device is often called a
counter/timer.
Figure shows the internals of a counter/timer to illustrate its operation.
KTUStudents.in
An n-bit counter/timer uses an n-bit register to store the current state of the count
and an array of half subtractors to decrement the count when the count signal is
asserted.
Combinational logic checks when the count equals zero and the done output
signals the zero count.
It is often useful to be able to control the time-out, rather than require exactly 2ᵑ
events to occur.
For this purpose, a reset register provides the value with which the count register
is to be loaded.
The counter/timer provides logic to load the reset register.
Most counters provide both cyclic and acyclic modes of operation. In the cyclic
mode, once the counter reaches the done state, it is automatically reloaded and the
counting process continues.
3. Keyboards
KTUStudents.in
A keyboard is basically an array of switches, but it may include some internal
logic to help simplify the interface to the microprocessor.
A switch uses a mechanical contact to make or break an electrical circuit.
An encoded keyboard uses some code to represent which switch is currently being
depressed.
At the heart of the encoded keyboard is the scanned array of switches shown in
Figure.
4. LEDs
Light-emitting diodes (LEDs) are often used as simple displays by themselves.
Arrays of LEDs may form the basis of more complex displays.
Figure shows how to connect an LED to a digital output.
KTUStudents.in
An LED connected to a digital output
A resistor is connected between the output pin and the LED to limit the current.
When the digital output goes to 0, the LED voltage is in the device’s off region
and the LED is not on.
5. Displays
A display device may be either directly driven or driven from a frame buffer.
Typically, displays with a small number of elements are driven directly by logic,
while large displays use a RAM frame buffer.
The n-digit array, shown in Figure is a simple example of a display that is usually
directly driven.
KTUStudents.in
single liquid crystal.
LCD displays present a very different interface to the system because the array of
pixel LCDs can be randomly accessed.
6. Touch screens
A touch screen is an input device overlaid on an output device. The touch screen
registers the position of a touch to its surface. By overlaying this on a display, the
user can react to information shown on the display.
The two most common types of touch screens are resistive and capacitive. A
resistive touch screen uses a two-dimensional voltmeter to sense position. As
shown in Figure , the touch screen consists of two conductive sheets separated by
spacer balls. The top conductive sheet is flexible so that it can be pressed to touch
the bottom sheet.
A voltage is applied across the sheet; its resistance causes a voltage gradient to
appear across the sheet. The top sheet samples the conductive sheet’s applied
voltage at the contact point. An analog/digital converter is used to measure the
voltage and resulting position.
KTUStudents.in
3.5 Interrupts
Hardware sources can be internal or external for interrupt of ongoing routine and
thereby diversion to corresponding ISR.
KTUStudents.in
13. Timer capture on inputs
Software sources for interrupt are related to software detecting computational error
or exceptional condition during execution and there up on executing a SWI
KTUStudents.in
Upon return from the ISR restores the context and enables interrupts and return.
In a system with multiple interrupts, each and every interrupt may be assigned a
priority level.
Here there is a possibility to occur multiple interrupts at a time.
There are two types of interrupt service mechanisms for the case of multiple
interrupts. Non Nested ISR and Nested ISR
In this case, Processors don't permit in-between routine diversion to higher priority
interrupts.
These processors provide auto disabling of all maskable interrupt when ISR
execution starts and auto re-enabling of all maskable interrupt on return from ISR.
These processors may also provide for auto saving the CPU registers (context)
when ISR execution starts and auto return of saved values into the CPU registers
on return from ISR. This help in fast transfer to pending higher priority interrupt
KTUStudents.in
Figure (a) shows multiple interrupts with diversion to higher priority interrupts
only at the end of present ISR.
Whenever an interrupt occurs the processor diverts the execution to the
corresponding ISR (at time t₀). During the execution of this first ISR, suppose
another interrupt with higher priority occurs (at time t₁)but the processor will
continue the first ISR and finished it (at time t₂) then only execution will be
diverted to the second ISR (at time t₂+t’).
Context switching
Whenever an interrupt occurs, before start the ISR the following steps carried out:
KTUStudents.in
Context Switching Time
Time taken to complete the context switching is called the context switch time.
Interrupt Latency
Interrupt Latency
For every interrupt, there is a fixed location in memory that holds the address of its
interrupt service routine, ISR.
The table of memory locations set aside to hold the addresses of ISRs is called as
the Interrupt Vector Table.
The software that handles interrupts on the master processor and manages
interrupt hardware mechanisms (i.e., the interrupt controller) consists of the device
drivers for interrupt-handling.
These functions implemented in software usually depend on the following criteria:
KTUStudents.in
o The types, number, and priority levels of interrupts available (determined
by the interrupt hardware mechanisms on-chip and on-board).
o How interrupts are triggered.
o The interrupt policies of components within the system that trigger
interrupts, and the services provided by the master CPU processing the
interrupts.
Following are some of the device drivers for handling interrupt.
Interrupt-Handling Startup:
This driver is used for initialization of the interrupt hardware (i.e., interrupt
controller, activating interrupts, etc.) upon power-on or reset.
Interrupt-Handling Shutdown;
This driver is used for configuring interrupt hardware (i.e., interrupt controller,
deactivating interrupts, etc.) into its power-off state.
Interrupt-Handling Disable:
This driver is used for allowing other software to disable active interrupts on the-
fly (not allowed for Non-Maskable Interrupts (NMIs), which are interrupts that
cannot be disabled).
The software must provide the processors in the system with the ability to access
various portions of the memory map.
The software involved in managing the memory on the master processor and on
the board, as well as managing memory hardware mechanisms, consists of the
device drivers for the management of the overall memory subsystem.
Following are some of the device drivers for handling memory
KTUStudents.in
Memory Subsystem Startup
This driver is used for initialization of the hardware upon power-on or reset
(initialize TLBs for MMU, initialize/configure MMU).
Memory Subsystem Shutdown
This driver is used for configuring hardware into its power-off state.
Memory Subsystem Disable
This driver is used for allowing other software to disable hardware on-the-fly
(disabling cache).
Memory Subsystem Enable
This driver is used for allowing other software to enable hardware on-the-fly
(enable cache).
Memory Subsystem Write
This driver is used for storing in memory a byte or set of bytes (i.e., in cache,
ROM, and main memory).
Memory Subsystem Read
This driver is used for retrieving from memory a “copy” of the data in the form of
a byte or set of bytes (i.e., in cache, ROM, and main memory).
KTUStudents.in
This driver is used for allowing other software to enable bus on-the-fly.
Bus Acquire
This driver is used for allowing other software to gain singular (locking) access to
bus.
Bus Release
This driver is used for allowing other software to free (unlock) bus.
Bus Read
This driver is used for allowing other software to read data from bus.
Bus Write
This driver is used for allowing other software to write data to bus.
Bus Install
This driver is used for allowing other software to install new bus device on-the-fly
for expandable buses.
Bus Uninstall
This driver is used for allowing other software to remove installed bus device on-
the-fly for expandable buses.
Which of the routines are implemented and how they are implemented depends on the
actual bus.