UNIT II - Embedded Networking
UNIT II - Embedded Networking
UNIT II - Embedded Networking
UNIT – II
EMBEDDED Networking
RS422
RS 485
CAN Bus
Page 1
EE8691: EMBEDDED SYSTEMS
UNIT-II
IO DEVICES:
A serial port is a port for serial communication. Serial communication means
that over a given line or channel one bit can communicate and the bits
transmit at periodic intervals generated by a clock. A serial port
communication is over short or long distances.
A parallel port is a port for parallel communication. Parallel
communication means that multiple bits can communicate over a set of
parallel lines at any given instance. A parallel port communicates within the
same board, between ICs or wires over very short distances of at most less
than a meter.
Ports can interconnect by wireless. Wireless or Mobile communication
is a serial communication but without wires, can be over a short range
personal area network as well as long range wireless network, and
transmission takes place by using carrier frequencies. The carrier modulates
the serial bits before transmission in an air. A receiver demodulates and
retrieves the serial bits back.
Serial and Parallel ports of IO devices can be classified into following IO types:
i) Synchronous serial input ii) Synchronous serial output
iii) Asynchronous serial UART input iv) Asynchronous serial UART output
v) Parallel port one bit input vi) Parallel port one bit output vii) Parallel port
input viii) Parallel port output. Some devices function both as input and
output: for example, a MODEM.
Page 2
EE8691: EMBEDDED SYSTEMS
The serial data input and clock pulse input are on same input line
when the clock pulses either encode or modulate serial data input bits
suitably. The receiver detects clock pulses and receives data bits after
decoding or demodulating.
When a separate SCLK input is sent, the receiver detects at the middle,
positive or negative edge of the clock pulses that indicate whether data input
is 1 or 0 saves the bits in 8-bit shift register. The processing element at the
port(peripheral) saves the byte at a port register from where the
microprocessor reads the byte.
Synchronous serial input is also called master output slave input
(MOSI) when the SCLK is sent from the sender to the receiver and slave is
forced to synchronize sent inputs from the master as per the master clock
inputs. Synchronous serial input is also called master input slave output
(MISO) when the SCLK is sent to the sender (slave) from the receiver (master)
and the slave is forced to synchronize sending the inputs to master as per the
master clock’s outputs.
Synchronous serial input is used for interprocessor transfers, audio
inputs and streaming data inputs.
Page 3
EE8691: EMBEDDED SYSTEMS
output and clock pulse input through same output line when the clock
pulses either suitably modulate or encode the serial output bits.
The processing element at the port (peripheral) sends the byte through
a shift register at the port to which the microprocessor writes the bytes.
Synchronous serial output is used for inter processor transfers, audio
outputs and streaming data outputs.
Part 5 in figure shows a synchronous serial input- output port. Each bit in
each byte synchronizes with the clock input and output. The bytes are sent or
received at constant rates as shown in part 2 and 4 in figure. The IOs are on
same IO line when the clock pulses suitably modulate or encode the serial
input and output respectively. If the clock period equals T, then the data
transfer rate is 1/T bps. The processing element at the port sends and
receives the byte at a port register to or from which the microprocessor writes
or reads byte.
Synchronous serial input/outputs are also called master input slave
output (MISO) and master output slave input (MOSI).
They are used for interprocessor transfers and streaming data. The bits
read from or written on magnetic media such as a hard disk or on optical
media such as a CD by using devices with serial synchronous IO ports.
The part 6 in figure shows the IO synchronous port when input and output
lines are separate.
Page 4
EE8691: EMBEDDED SYSTEMS
The receiver detects n bits at the intervals of T from the first indicating
bit, n=0, 1,…..10 or 11, finds out whether the data-input is 1 or 0 and
saves the bits in an 8-bit shift register. The processing element at the
port (peripheral) saves the byte at a port register, from where the
microprocessor reads the byte.
Asynchronous serial input is also called UART input if the serial input
is according to the UART protocol. Asynchronous serial input is used
for keypad and modem inputs.
Page 5
EE8691: EMBEDDED SYSTEMS
Integrated
Clock
Circuit 2
Data
Data
Integrated
Circuit 1 Clock
Data
Integrated
Circuit 3
Clock
From master
Fields Description:
Disadvantage :
Time taken by the algorithm in the master hardware that analyzes the
bits through I2C in case the slave hardware does not provide for
hardware that supports it.
The open collector drives at the master, therefore a pull up resistance of
2.2K on each line is essential.
CAN Bus
General Features:
CAN is a standard bus in a distributed network.
Mainly used in Automotive electronics.
It has a bi-directional serial line.
Sends or receives bits at the maximum rate of 1 Mbps.
It employs a twisted pair connection to each nodes, which can run up
to a maximum length of 40m.
Page 7
EE8691: EMBEDDED SYSTEMS
In idle state CANs serial line is at logic level ‘1’, it’s called recessive
state.
A node sends the output at an instance by pulling the serial line to
logic '0' or a node receives the input at any instance from the serial line
after sensing logic '0' in the line, This state is called dominant state.
A node sends data bits as data frame. Data frame always starts with '1'
and always ends with seven ‘0’s. Other field of each frame is as
explained below.
Page 8
EE8691: EMBEDDED SYSTEMS
address.
RTR is 0 means, the packet is a request for the data
from a device, the device is
defined by identifier field.
Control Field First bit is identifier extension.
Second bit is always 1.
Last 4 bits are code for data length.
Data Field information(Data) to be send, its length depends on the
data length code in the control field.
CRC Cyclic Redundancy Check word, The receiver node uses it
to detect errors if any during transmission.
ACK Field First bit is ACK Slot, Sender send it as 1 during
transmission and receiver sends back 0 in this slot when
the receiver detects an error in the reception, Sender
Second bit is ACK delimiter, It signals the end of ACK field.
End Field End of frame specification, has seven 0s.
USB Bus
Page 9
EE8691: EMBEDDED SYSTEMS
Connection : The host connects to the devices using USB port driving
software and host controller. The host system has a host controller,
which connects to a root hub. A hub is one that connects to other
nodes or hubs. The root hub connects to the hub and the node at level
1. A hub at level 1 connects to the hub at the level 2 an soon and hence
forms a tree like topology.
Pins Specifications : USB bus cable has four wires
Serial signals are Non Return to Zero (NRZI) coded and the clock is
Is synchronous transfer
USB is polled bus. i.e. The host controller regularly polls the presence
following fields
■ direction
Page 10
EE8691: EMBEDDED SYSTEMS
USB supports three types of pipes as follows, the host configures each
pipes with the data bandwidth to be used, transfer service type and
buffer size.
SONET, etc., hence there comes a need for high speed serial buses, the
Page 11
EE8691: EMBEDDED SYSTEMS
7. SONET OC -192
8. SONET OC -768
9. ATM OC-12/46/192
ISA Bus
Page 12
EE8691: EMBEDDED SYSTEMS
S Address Components/Devices
No.
1 000 – 00F DMA Chip 8237
2 020 – 021 Programmable Interrupt controller
8255
3 040 – 043 Timer 8253
4 060 – 063 Parallel port programmable parallel
interface.
5 080 – 083, 0A0 – 0AF, 0C0 Components on mother board
– 0CF, 0E0 – 0EF
6 220 – 24F, 278 – 27F, 2F0 Reserved address for peripherals
– 2F7, 3C0 – 3CF, 3E0 -
3F0
7 2F8 – 2FF, 3F8 – 3FF IBM COM ports
8 320 – 32F Hard Disk
9 3F0 – 3F7 Floppy Disk
10 300 – 31F Prototype cards like ADC card
11 380 – 389, 3A0 – 3A9 Synchronous Communication
12 380 – 38C Synchronous Data Link Control
(SDLC)
13 380 – 38F Monochrome display monitors
14 3D0 – 3DF Color and graphics display monitor
Fig
I/O port address limitations for the devices that use ISA bus :
8086 to 80286 processor has I/O mapped I/Os, not memory mapped
I/Os. Though the instruction set provides for I/O instructions for 64KB
Page 13
EE8691: EMBEDDED SYSTEMS
Specification
PCI stands for Peripheral Component Interconnect.
PCI provides superior throughput than EISA
It’s Almost platform independent, where ISA depends on IBM platform.
Its Clock rate is nearest to the sub – multiple of the system clock.
PCI provides three types of synchronous parallel interfaces
Its two versions are 32/33MHz and 64/66MHz, also recently
introduced PCI-X 64/100MHz.
Lately two super speed versions of PCI have been introduced. These are
PCI Super V2.3 264/538MBps 3.3V (on a 64bit bus), 132/264 (on a 32
Page 14
EE8691: EMBEDDED SYSTEMS
bit bus) and PCI Super V1.01 for 800MBps 64bit 3.3Volts.
PCI had 32 bit data bus extensible to 64bits also a 32 bit address bus
extensible to 64bits.
Its synchronous/asynchronous throughput is up to 132/526MBps
It operates on 3.3V to 5V signal
An exemplary PCI card has an 16MB Flash ROM with a router gateway
for a LAN
Working
A PCI driver can access the hardware automatically as well as by the
programmer assigned addresses. The PCI feature of automatically
detecting the interfacing systems for assigning new addresses is
important for coding a device driver. The PCI bus therefore simplifies
the addition and deletion (Attachment and detachment) of the system
peripherals.
A manufacturer registers a global number, for eg. 68HC11 and 80386
are globally registered numbers. A 16bit register in a PCI device
identifies this number to let that device auto detect it.
Another 16bit register identifies a device ID number. These two
numbers allow the device to carry out its auto – detection by its host
system.
Each device may use FIFO controller with a FIFO buffer for maximum
throughput.
There are three identification numbers by which a device identifies its
address space.
i. I/O port
ii. Memory locations
iii. Configuration registers of total 256B with a 4byte unique ID. This
configuration address space is the unique feature of PCI.
Interrupts are handled by the uniquely assigned interrupt type
(number). A configuration register number 60 stores the one byte for
the interrupt type that defines this unique number.
Page 15
EE8691: EMBEDDED SYSTEMS
0x10
BA0 BA1 BA2 BA3
0x00
VID DID CR SR RID CC CL LT HT BIST
VID – Vendor ID
DID – Device ID
RID – Revision ID
CR – Common Register
CC – Class Code
SR – Status Register
CL – Cache Line
LT – Latency Timer
BIST - Base Input Tick
HT – Hear Type
BA – Base Address
CBCISP – Card Based CIS Pointer
SSVID - Subsystem VID
SSDID – Subsystem DID
EXPROM – Expansion ROM
MIN-GNT – Minimum Guaranteed time
MAX-GNT – Maximum Guaranteed time
VID, DID, RID,CR,SR and HT are compulsorily configured, rests are optional.
A PCI controller must access one driver at a time, thus all the devices
within the host computer can share I/O port addresses and memory
locations but cannot share the configuration registers.
Page 16
EE8691: EMBEDDED SYSTEMS
RS 232 C STANDARD:
Page 17
EE8691: EMBEDDED SYSTEMS
Page 18
EE8691: EMBEDDED SYSTEMS
DEVICE DRIVER
Page 19
EE8691: EMBEDDED SYSTEMS
For writing the software for driver in assembly, the following points must be
clear
Page 20
EE8691: EMBEDDED SYSTEMS
Page 21
EE8691: EMBEDDED SYSTEMS
Virtual Device Drivers emulate the device hardware, for ex hard disk
generates software interrupts similar physical device drivers. The file and pipe
are two ex. of virtual devices.
Both Virtual devices and physical device drivers have functions for
device open, read, write and close.
The concept of virtual device drivers is very important in programming,
for eg.,
1. A memory block can have data buffers in analogy to buffers at an
i/o device. It can be accessed from a character driver or from a block
driver. The device is called the character device or block device when
it can access a character or a block of characters respectively.
2. A physical device transceiver or repeater is equivalent to a virtual
device called loop back device. It stores allocated memory block
using that block device driver and returns the data back from the
memory.
3. A bounded buffer device in memory can be like a printer buffer. A
data stream is sent by one routine (driver) and read by another
routine (driver). Bounded buffer device is a virtual device, usually
called pipe device.
4. A program can store in a set of memory blocks called RAM disc in
the analogous way a file system does at the hard disk. RAM disk is a
device that consists of multiple internal file devices.
Page 22
EE8691: EMBEDDED SYSTEMS
Page 23
EE8691: EMBEDDED SYSTEMS
Page 24