Professional Documents
Culture Documents
Embedded & Real Time Systems Notes: by Mr. Suman Kalyan Oduri
Embedded & Real Time Systems Notes: by Mr. Suman Kalyan Oduri
com
RS232:
In
telecommunications,
RS-232
(Recommended Standard 232) is the traditional
name for a series of standards for serial binary
single-ended data and control signals connecting
between a DTE (Data Terminal Equipment) and a
DCE (Data Circuit-terminating Equipment). It is
commonly used in computer serial ports. The
standard defines the electrical characteristics and
timing of signals, the meaning of signals, and the
physical size and pin-out of connectors. The
current version of the standard is TIA-232-F
Interface between DTE and DCE Employing Serial
Binary Data Interchange, issued in 1997.
Page 1
www.jntuworld.com
www.jntuworld.com
UART:
the
The
and
and
and
-3V
-5V
A
Universal
Asynchronous
Receiver/Transmitter, abbreviated UART, is a type
of "asynchronous receiver/transmitter", a piece of
computer hardware that translates data between
parallel and serial forms. UARTs are commonly
used in conjunction with communication standards
such as EIA RS-232, RS-422 or RS-485. The
universal designation indicates that the data
format and transmission speeds are configurable
and that the actual electric signaling levels and
methods, typically are handled by a special driver
circuit external to the UART.
A UART is usually an individual integrated
circuit used for serial communications over a
computer or peripheral device serial port. UARTs
are now commonly included in microcontrollers. A
dual UART, or DUART, combines two UARTs into a
single chip. Many modern ICs now come with a
UART that can also communicate synchronously;
these devices are called USARTs (universal
synchronous/asynchronous receiver/transmitter).
Block Diagram of UART:
Page 2
www.jntuworld.com
www.jntuworld.com
Page 3
www.jntuworld.com
www.jntuworld.com
Page 4
www.jntuworld.com
www.jntuworld.com
Ethernet:
Ethernet is a family of frame-based
computer networking technologies for local area
networks (LAN). It defines a number of wiring and
signaling standards for the Physical Layer of the
OSI networking model as well as a common
addressing format and a variety of Medium Access
Control procedures at the lower part of the Data
Link Layer. Ethernet is standardized as IEEE 802.3.
Ethernet interface is now ubiquitous. It is
available on every desktop and laptop. With the
availability of low cost Ethernet chips and the
associated protocol stack, providing an Ethernet
interface is very easy and useful to the embedded
system. Through the Ethernet interface, the
embedded system can be connected as a LAN. So,
a
number
of
embedded
systems
in
a
manufacturing unit can be connected as a LAN;
and, another node on the LAN, a desktop
computer, can monitor all these embedded
systems. The data collected by an embedded
system can be transferred to a database on the
LAN.
The Ethernet interface provides the
physical layer and data link layer functionality.
Above the data link layer, the TCP/IP protocol
stack and the application layer protocols will run.
Application Layer (SMTP, FTP, HTTP)
TCP Layer
IP Layer
Logical Link Control
Medium Access Control
Physical Layer
IEEE 802.11:
IEEE 802.11 is a set of standards for
implementing wireless local area network (WLAN)
computer communication in the 2.4, 3.6 and 5 GHz
frequency bands. They are created and maintained
by the IEEE LAN/MAN Standards Committee (IEEE
802). The base current version of the standard is
IEEE 802.11-2007.
Each wireless LAN node has a radio and
an antenna. All the nodes running the same MAC
protocol and competing to access the same
medium will form a basic service set (BSS). This
BSS can interface to a backbone LAN through
access point (AP). The backbone LAN can be a
wired LAN such as Ethernet LAN. Two or more
BSSs can be interconnected through the backbone
LAN. In trade magazines, the access points are
referred as Hotspots.
The MAC protocol used in 802.11 is called
CSMA/CA. Carrier sense multiple access with
collision avoidance (CSMA/CA) is a wireless
network multiple access method in which:
Page 5
www.jntuworld.com
www.jntuworld.com
Point-to-multipoint
communications
master and multiple slaves:
between
Scatternet:
Page 6
www.jntuworld.com
www.jntuworld.com
Page 7
www.jntuworld.com
www.jntuworld.com
Page 8
www.jntuworld.com
www.jntuworld.com
Task Scheduler:
An application in real-time embedded
system can always be broken down into a number
of distinctly different tasks. For example,
Keyboard scanning
Display control
Page 9
www.jntuworld.com
www.jntuworld.com
Round-Robin Algorithm
Non-preemptive Multitasking
Preemptive Multitasking
First In First Out (FIFO):
In FIFO scheduling algorithm, the tasks
which are ready-to-run are kept in a queue and
the CPU serves the tasks on first-come-first served
basis.
Round-Robin Algorithm:
In this scheduling algorithm, the kernel
allocates a certain amount of time for each task
waiting in the queue. For example, if three tasks 1,
2 and 3 are waiting in the queue, the CPU first
executes task1 then task2 then task3 and then
again task1.
Non-Preemptive Multitasking:
Assume that we are making a telephone
call at a public call office. We need to make many
calls, but we see another person waiting. We may
make one call, ask the other person to finish his
call, and then we can make out next call. This is
non-preemptive
multitasking
is
also
called
cooperative multitasking as the tasks have to
cooperate with one another to share the CPU time.
Preemptive Multitasking:
In preemptive multitasking, the highest
priority task is always executed by the CPU, by
preempting the lower priority task. All real-time
operating systems implement this scheduling
algorithm.
OS API
Page 10
www.jntuworld.com
www.jntuworld.com
Binary Semaphores:
A binary semaphore is a synchronization
object that can have only two states. They are not
taken and taken.
Two operations are defined:
Semaphores:
A semaphore is a protected variable or
abstract data type that provides a simple but
useful abstraction for controlling access by multiple
processes to a common resource in a parallel
programming environment.
Create a semaphore
Delete a semaphore
Acquire a semaphore
Release a semaphore
Query a semaphore
Types of Semaphores:
We will consider three different types of
Semaphores are Binary Semaphores, Counting
Semaphores and Mutexes.
Page 11
www.jntuworld.com
www.jntuworld.com
Unlock:
This
operation
relinquishes
ownership of a mutex. If there are queued
threads then a thread is removed from
the queue and resumed, ownership is
implicitly assigned to the thread.
Create a mutex
Delete a mutex
Acquire a mutex
Release a mutex
Query a mutex
Wait on a mutex
Difference between Mutex & Semaphore:
Mutexes are typically used to serialize
access to a section of re-entrant code that cannot
be executed concurrently by more than one
thread. A mutex object only allows one thread into
Create a mailbox
Delete a mailbox
Page 12
www.jntuworld.com
www.jntuworld.com
Query a mailbox
Post a message in a mailbox
Read a message form a mailbox
Message Queues:
It is used to send one or more messages
to a task. Basically Queue is an array of mailboxes.
Tasks and ISRs can send and receive messages to
the Queue through services provided by the
kernel. Extraction of messages from a queue may
follow FIFO or LIFO fashion. When a message is
delivered to the queue either the highest priority
task (Priority based) or the first task that
requested the message (FIFO based) is given the
message.
Message queue can be considered as an
array of mailboxes. Some of the applications of
message queue are:
To display output
Create a queue
Delete a queue
Flush a queue
Broadcast a message
manage
Signals:
Page 13
www.jntuworld.com
www.jntuworld.com
Ignore a signal
Memory Management:
Most RTOSs have some kind of memory
management subsystem. Although some offer the
equivalent of the C library functions malloc and
free, real-time systems engineers often avoid
these two functions because they are typically slow
and
because
their
execution
times
are
unpredictable. They favor instead functions that
allocate and free fixed-size buffers, and most
RTOSs offer fast and predictable functions for the
purpose.
The memory manager allocates memory
to the processes and manages it with appropriate
protection. There may be static and dynamic
allocations of memory. The manager optimizes the
memory needs and memory utilization. An RTOS
may disable the support to the dynamic block
allocation, MMU support to the dynamic page
allocation and dynamic binding as this increases
the latency of servicing the tasks and ISRs. An
RTOS may or may not support memory protection
in order to reduce the latency and memory needs
of the processes.
The API provides the following function
calls to manage memory:
Timers:
A timer is the scheduling of an event
according to a predefined time value in the future,
similar to setting an alarm clock. For instance, the
kernel has to keep track of different times:
Get time
Set time
Reset timer
Page 14
www.jntuworld.com
www.jntuworld.com
Page 15
www.jntuworld.com
www.jntuworld.com
Communication
protocol
stacks
for
Infrared,
Bluetooth,
IEEE
802.11
interfaces need to be integrated.
Use ROM
Include a keyboard
Provide
wired
serial
and/or
USB
connectivity
Examples of Handheld PC devices are the
NEC MobilePro 900c, HP 320LX, HP Jornada 720,
and Vadem Clio.
Microsoft has stopped developing for the
Handheld PC since 2000, instead focusing
development on the Pocket PC and Windows
Mobile. Other Handheld PCs may not use Windows
CE. Windows CE devices which match all of the
hardware requirements of the H/PC specification
Page 16
www.jntuworld.com
www.jntuworld.com
Page 17
www.jntuworld.com
www.jntuworld.com
Page 18
www.jntuworld.com
www.jntuworld.com
at their
(COTS)
Page 19
www.jntuworld.com
www.jntuworld.com
Page 20
www.jntuworld.com