Beruflich Dokumente
Kultur Dokumente
1) What is IP Addressing?
• When Internet addresses were standardized (early
Using typical example IP addresses give network 1980s), the Internet address space was divided up into
classes:
ID and host ID s for Class A, Class B and Class
– Class A: Network prefix is 8 bits long
C IP addresses. – Class B: Network prefix is 16 bits long
– Class C: Network prefix is 24 bits long
➢ An IP address is a unique global address for a network – Each IP address contained a key which
interface identifies the class:
➢ An IP address: – Class A: IP address starts with “0”
– Class B: IP address starts with “10”
- is a 32 bit long identifier – Class C: IP address starts with “110”
- encodes a network number (network bit # 0 1 7 8 31
prefix) and a host number Class A 0
•
Network Prefix Host Number
IP addresses are written in a so-called dotted decimal 8 bits 24 bits
notation bit # 0 1 2 15 16 31
bit # 0 1 2 3 23 24 31
•
The network prefix identifies a network and the host
number identifies a specific host (actually, interface on
the network).
Application Layer
The application layer is provided by the program that uses
TCP/IP for communication. An application is a user process
cooperating with another process on the same or a different
host. The interface between the application and transport
layers is defined by port numbers and sockets
Transport Layer
• The transport layer provides the end-to-end data
transfer. Multiple applications can be supported
simultaneously. The transport layer is responsible for
providing a reliable exchange of information.
• The main transport layer protocol is TCP
• Another transport layer protocol is User Datagram
Protocol (UDP)which provides a connectionless
service in comparison to TCP, which provides a
connection-oriented service.
Internetwork Layer
• The internetwork layer, also called the internet layer
or the network layer, provides the “virtual network”
image of an internet (that is, this layer shields the
higher levels from the physical network architecture
below it).
• Internet Protocol (IP) is the most important protocol
in this layer.
• It is a connectionless protocol that doesn't assume
reliability from the lower layers.
• IP does not provide reliability, flow control or error
recovery.
• IP provides this routing function.
Network Interface Layer
• The network interface layer, also called the link layer
Some implications of this algorithm are:
or the data-link layer, is the interface to the actual
network hardware. ➢ It is a change to the general IP algorithm.
• This interface may or may not provide reliable ➢ Therefore, to be able to operate this way, the
delivery, and may be packet or stream oriented. particular gateway must contain the new algorithm. Some
• In fact, TCP/IP does not specify any protocol here, but implementations may still use the general algorithm, and
can use almost any network interface available, which will not function within a subnetted network, although they
illustrates the flexibility of the IP layer. can still communicate with hosts in other networks that are
3)Develop IP routing algorithm with subnet mask subnetted.
and illustrate it with example ➢ As IP routing is used in all of the hosts (and not just
➢ IP uses a unique algorithm to route an IP the routers), all of the hosts in the subnet must have:
datagram, called the IP routing algorithm. To 1. An IP routing algorithm that supports subnetting.
send an IP datagram on the network, the 2. The same subnet mask (unless subnets are formed within
general IP routing algorithm has the following the subnet).
form ➢ If the IP implementation on any of the hosts does
not support subnetting, that host will be able to
communicate with any host in its own subnet but not with
any machine on another subnet within the same network.
➢ This is because the host sees only one IP network
and its routing cannot differentiate between an IP datagram
directed to a host on the local subnet and a datagram that
should be sent via a router to a different subnet.
➢
To be able to differentiate between subnets, the IP routing
algorithm changes and has the following form:
• The number of network numbers in use. The Class
C figures are somewhat inaccurate, because the
figures do not include many class C networks in
Europe, which were allocated to RIPE and
subsequently assigned but which are still recorded
as allocated.
• Allocated
• This includes all of the assigned networks and
additionally, those networks that have either been
reserved by IANA (for example, the 63 class A
networks are all reserved by IANA) or have been
allocated to regional registries by IANA and will
subsequently be assigned by those registries.
• There are relatively few networks that would need
as many as 65,534 host addresses, but very few for
which 254 hosts would be an adequate limit. In
➢ summary, although the Class A, Class B and Class
C divisions of the IP address are logical and easy-
to-use (because they occur on byte boundaries),
with hindsight they are not the most practical
because Class C networks are too small to be
useful for most organizations while Class B
networks are too large to be densely populated by
any but the largest organizations.
• Since 1990, the number of assigned Class B
networks has been increasing at a much lower rate
than the total number of assigned networks and the
anticipated exhaustion of the Class B network
numbers has not yet occurred. The reason for this
is that the policies of the InterNIC on network
number allocation were changed in late 1990 to
preserve the existing address space, in particular to
avert the exhaustion of the Class B address space.
• The new policies can be summarized as follows.
➢ The upper half of the Class A address
space (network numbers 64 to 127) is
reserved indefinitely to allow for the
possibility of using it for transition to a new
• numbering scheme. Class B networks are
only assigned to organizations that can clearly
demonstrate a need for them. The same is, of
4)What is The IP Address Exhaustion course, true for Class A networks. The
Problem? What are the solutions for it? requirements for Class B networks are that
the requesting organization:
• The number of networks on the Internet has been ➢ – Has a subnetting plan that documents more
approximately doubling annually for a number of than 32 subnets within its organizational
years. network
• However, the usage of the Class A, B and C ➢ – Has more than 4096 hosts Any requirements
networks differs greatly. for a Class A network would be handled on an
• The terms assigned and allocated in this context individual case basis.
have the following meanings: ➢ Organizations that do not fulfill the
• requirements for a Class B network are
• assigned a consecutively numbered block of
• Assigned Class C network numbers.
➢ The lower half of the Class C address space • An exception to the rule constitutes the Asynchronous
(network numbers 192.0.0 through Transfer Mode (ATM) technology where ARP cannot be
207.255.255) is divided into eight blocks, implemented in the physical layer as described previously.
which are allocated to regional authorities • Therefore, an ARP server is used with which every
as follows: host has to register upon initialization in order to be able
192.0.0 - 193.255.255 Multi-regional to resolve IP addresses to hardware addresses . ARP was
194.0.0 - 195.255.255 Europe designed to be used on networks that support hardware
196.0.0 - 197.255.255 Others broadcast.
198.0.0 - 199.255.255 North America
200.0.0 - 201.255.255 Central and South America
202.0.0 - 203.255.255 Pacific Rim
204.0.0 - 205.255.255 Others
206.0.0 - 207.255.255 Others
5)What is Address Resolution Protocol (ARP)?
There is no separate clock signal on the CAN bus to • If both lines are at the same voltage, the signal is a
synchronize the node the CAN frame itself is used for recessive bit.
synchronization of the clocks on all the nodes. To a effectively
achieve this CAN frames have NRZ-5 coding. If there are five • If the CAN_H line is higher than the CAN_L line by
bits at the same level in the CAN frame a sixth bit of the 0.9V, the signal line is a dominant bit.
opposite level is stuffed by the transmitter. This extra stuffed
bit is removed by the receiver node before processing the • There's no independent ground reference point for
CAN frame. There is hard synchronization and soft these two lines. The bus is therefore immune to any
synchronization of node clocks using the CAN frame while ground noise, which in a vehicle can be considerable.
all nodes have clocks running at the same baud rate. When the
transmitting node sends a CAN frame all the clocks of the
• The signals on the two CAN lines will both be subject
to the same electromagnetic influences, and so the
difference in voltages between the two lines will not
vary.
• in the recessive state both the CANH and CANL bus ➢ IDE–A dominant single identifier extension (IDE) bit
pins are biased to the same level: ~2.5V. During the means that a standard CAN identifier with no
dominant state, the CANH bus pin is biased to a higher extension is being transmitted.
voltage potential (~3.5V) and the CANL bus pin is ➢ r0–Reserved bit (for possible use by future standard
biased to a lower voltage potential (~1.5V). By
amendment).
subtracting the voltage potential of the two bus pins,
➢ DLC–The 4-bit data length code (DLC) contains the
you can determine the logical state of the bus using
Equation 1. When the Vdiff value on the bus is less than number of bytes of data being transmitted. move a
0.5V, the bus is considered to be in a recessive state. correctly received frame to its proper position in a
Alternately, Vdiff values greater than 0.9V indicate that message buffer area.
the bus is in a dominant state. Lastly, for Vdiff values ➢ Data–Up to 64 bits of application data may be
between 0.5V and 0.9V, the bus state is undefined. transmitted.
Since the difference between the two signals is used to ➢ CRC–The 16-bit (15 bits plus delimiter) cyclic
define the state of the bus, this signaling type is known redundancy check (CRC) contains the checksum
as differential signaling (number of bits transmitted) of the preceding
application data for error detection.
7)Draw CAN data frame format. How ➢ ACK–Every node receiving an accurate message
multiple devices are connected to the CAN overwrites this recessive bit in the original message
bus? What is the arbitration mechanism? with a dominate bit, indicating an error-free message
➢ SOF -The single dominant start of frame (SOF) bit has been sent. Should a receiving node detect an error
marks the start of a message, and is used to and leave this bit recessive, it discards the message and
synchronize the nodes on a bus after being idle. the sending node repeats the message after
➢ Identifier- The Standard CAN 11-bit identifier rearbitration. In this way, each node acknowledges
establishes the priority of the message. The lower the (ACK) the integrity of its data. ACK is 2 bits, one is
binary value, the higher its priority. the acknowledgment bit and the second is a delimiter.
➢ RTR–The single remote transmission request (RTR) ➢ EOF–This end-of-frame (EOF), 7-bit field marks the
bit is dominant when information is required from end of a CAN frame (message) and disables bit-
another node. All nodes receive the request, but the stuffing, indicating a stuffing error when dominant.
identifier determines the specified node. The When 5 bits of the same logic level occur in succession
responding data is also received by all nodes and used during normal operation, a bit of the opposite logic
by any node interested. level is stuffed into the data.
➢ IFS–This 7-bit interframe space (IFS) contains the 4. Unlike Carrier Sense Multiple Access with Collision
time required by the controller to move a correctly Detect (CSMA/CD) arbitration propagation delays
received frame to its proper position in a message never cause message collisions
buffer area.
8)What are the important features of CAN
network? What are the advantages of CAN
CAN Logic & Arbitration network?
1. CAN 2.0A messages begin with an 11-bit message ID Advantages of CAN
which identifies the message type and also establishes
the message priority. 1. Low cost network infrastructure which is often built
2. As with many computer interfaces, the CAN into microcontrollers.
transceivers invert the microcontroller signal. Thus, 2. Large market segment with broad availability of
the dominant bus state occurs when a logic “0” is hardware, software and systems engineering tools.
transmitted and the recessive state occurs when a logic 3. Light weight, low latency, highly deterministic design
“1” is transmitted. specifically for real-time embedded applications.
3. CAN uses the message ID to perform bus access 4. Reliable with strong error detection, fault tolerant
arbitration between nodes. versions available.
4. Each node waits for an idle bus state then begins to 5. Flexible and highly configurable with various higher
transmit its message ID. level application protocols.
5. Each node also listens to the bus to see if the bus state 6. Foundation for next generation technology controller
match its transmission. area networks.
6. If a node detects a dominant bus state while
transmitting a recessive message ID bit (logic “1”), it Features of CAN
drops out of the current arbitration round and will try
again the next time the bus is idle
• Multi-master/broadcast
• Maximum signaling rate of 1Mbps
7-bit CANopen Node ID Arbitration Example
• Absence of node addressing
– Message ID : contents, priority
• CSMA/CD with AMP (Carrier Sense Multiple Access
with Collision Detection and Arbitration on Message
Priority).
• Asynchronous Serial Bus
• Simple 2-wire differential bus
• Unlike a traditional network such as USB or Ethernet,
CAN does not send large blocks of data point-to-point
from node A to node B. In a CAN network, many short
messages like temperature or RPM are broadcast to the
entire network, which provides for data consistency in
every node of the system.
• Prioritization of messages
• Guarantee of latency times
• Multimaster
• Configuration flexibility
KEY ADVANTAGES OF CAN BUS ARBITRATION • Multicast reception with time synchronization
• Error detection and signaling
1. Fast & deterministic. • Automatic retransmission of corrupted messages
2. Highest priority message gets immediate access once
the bus is available.
3. Arbitration is essential “free” since message ID
encodes message priority.
2)Give an example of an industrial • The logic ‘1’ in RS232 is described as being in the
communication interface commonly used in voltage range of -15V to -3V and logic ‘0’ is described
embedded systems. What are special features available in as the voltage range of +3V to +15V i.e. low level
that interface? voltage is logic ‘1’ and high level voltage is logic ‘0’.
• Typically, the logic ‘1’ in RS232 will be -12V and
logic ‘0’ will be +12V.
• RS-232 defines the connection between data terminal
• The maximum slew rate in RS232 is limited to
equipment (DTE) and data circuit-terminating
30V/µs. Also, a maximum bit rate of 20 Kbps is also
equipment (DCE).
defined.
• Data terminal equipment is any end user device, such
as a computer, that can be used to send data over a
network. • These limitations of the standard help in reducing
• Data circuit-terminating equipment is a device that the cross – talk with adjacent signals.
provides the interface between the DTE and the
network, and is often a modem or terminal adapter.
9)Draw the CAN protocol stack and explain
• An RS-232-compatible interface was commonly used
for computer serial communication (COM) ports,
the functions of each layer in the protocol
which were originally intended for connecting the
computer to a modem.
• While the original RS232 standard specified 25-pin
connections, many of the pins were not used in
practice, and a 9-pin connection was implemented on
most computers.
Master Mode
• The SPI operates in master mode when the MSTR bit
is set.
• Only a master SPI module can initiate transmissions.
• A transmission begins by writing to the master SPI
Data Register.
• If the shift register is empty, the byte immediately
transfers to the shift register.
• The byte begins shifting out on the MOSI pin under
the control of the serial clock.
• S-clock
Half-duplex write configuration. The master
• The SPR2, SPR1, and SPR0 baud rate selection bits in
transmits data on the MOSI line and the slave conjunction with the SPPR2, SPPR1, and SPPR0 baud
rate preselection bits in the SPI Baud Rate register
control the baud rate generator and determine the • SS pin
speed of the transmission. The SS pin is the slave select input. Before a data
• The SCK pin is SPI clock output. Through the SCK transmission occurs, the SS pin of the slave SPI must
pin, the baud rate generator of the master controls the be low. SS must remain low until the transmission is
shift register of the slave peripheral. complete. If SS goes high, the SPI is forced into idle
• MOSI, MISO pin state.
In master mode, the function of the serial data output pin • The SS input also controls the serial data output pin, if SS
(MOSI) and the serial data input pin (MISO) is determined is high (not selected), the serial data output pin is high
by the SPC0 and BIDIROE control bits. impedance, and, if SS is low the first bit in the SPI Data
• SS pin Register is driven out of the serial data output pin.
If MODFEN and SSOE bit are set, the SS pin is configured • Also, if the slave is not selected (SS is high), then the SCK
as slave select output. The SS output becomes low during input is ignored and no internal shifting of the SPI shift
each transmission and is high when the SPI is in idle state. register takes place.
• If MODFEN is set and SSOE is cleared, the SS pin is • Although the SPI is capable of duplex operation, some SPI
configured as input for detecting mode fault error. peripherals are capable of only receiving SPI data in a
• If the SS input becomes low this indicates a mode fault slave mode. For these simpler devices, there is no serial
error where another master tries to drive the MOSI and SCK data out pin.
lines. NOTE: When peripherals with duplex capability are used,
• In this case, SPI immediately switches to slave mode, take care not to simultaneously
by clearing the MSTR bit and also disables the slave output enable two receivers whose serial outputs drive the same
buffer MISO (or SISO in bidirectional mode). system slave’s serial data
• So the result is that all outputs are disabled and SCK, output line.
MOSI and MISO are inputs. • As long as no more than one slave device drives the
• If a transmission is in progress when the mode fault system slave’s serial data output line, it is possible for
occurs, the transmission is aborted and the SPI is forced into several slaves to receive the same transmission from a
idle state. master, although the master would not receive return
• This mode fault error also sets the mode fault (MODF) information from all of the receiving slaves.
flag in the SPI Status Register (SPISR). • If the CPHA bit in SPI Control Register 1 is clear, odd
• If the SPI interrupt enable bit (SPIE) is set when the numbered edges on the SCK input cause the data at the
MODF flag gets set, then an SPI interrupt sequence is also serial data input pin to be latched. Even numbered edges
requested. cause the value previously latched from the serial data
• When a write to the SPI Data Register in the master input pin to shift into the LSB or MSB of the SPI shift
occurs, there is a half SCK-cycle delay. register, depending on the LSBFE bit.
• After the delay, SCK is started within the master. The • If the CPHA bit is set, even numbered edges on the SCK
rest of the transfer operation differs slightly, depending on input cause the data at the serial data input pin to be
the clock format specified by the SPI clock phase bit, CPHA, latched. Odd numbered edges cause the value previously
in SPI Control Register 1 latched from the serial data input pin to shift into the LSB
A change of the bits CPOL, CPHA, SSOE, LSBFE, or MSB of the SPI shift register, depending on the LSBFE
MODFEN, SPC0, BIDIROE with SPC0 set, SPPR2-SPPR0 bit.
and SPR2-SPR0 in master mode will abort a transmission in • When CPHA is set, the first edge is used to get the first
progress and force the SPI into idle state. The remote slave data bit onto the serial data output pin. When CPHA is
cannot detect this, therefore the master has to ensure that the clear and the SS input is low (slave selected), the first bit
remote slave is set back to idle state. of the SPI data is driven out of the serial data output pin.
Slave Mode After the eighth shift, the transfer is considered complete
and the received data is transferred into the SPI Data
The SPI operates in slave mode when the MSTR bit in SPI
Register. To indicate transfer is complete, the SPIF flag in
Control Register1 is clear.
the SPI Status Register is set.
• SCK clock
In slave mode, SCK is the SPI clock input from the master.
NOTE: A change of the bits CPOL, CPHA, SSOE, LSBFE,
MODFEN, SPC0 and BIDIROE
• MISO, MOSI pin
with SPC0 set in slave mode will corrupt a transmission in
In slave mode, the function of the serial data output pin
progress and has to be
(MISO) and serial data input pin (MOSI) is
avoided.
determined by the SPC0 bit and BIDIROE bit in SPI Control
Register 2.
2. How the transmission formats changes with
the value of clock phase in SPI? Explain with
neat sketch.
• During an SPI transmission, data is transmitted
(shifted out serially) and received (shifted in serially)
simultaneously.
• The serial clock (SCK) synchronizes shifting and
sampling of the information on the two serial data lines.
• A slave select line allows selection of an individual
slave SPI device, slave devices that are not selected do not
interfere with SPI bus activities.
• Optionally, on a master SPI device, the slave select
line can be used to indicate multiple-master bus
contention.
➢ When all bits are clear (the default condition), the SPI
module clock is divided by 2.
➢ When the selection bits (SPR2–SPR0) are 001 and the
preselection bits (SPPR2–SPPR0) are 000, the module
clock divisor becomes 4.
➢ When the selection bits are 010, the module clock
divisor becomes 8 etc.
➢ When the preselection bits are 001, the divisor
determined by the selection bits is multiplied by 2.
➢ When the preselection bits are 010, the divisor is
multiplied by 3, etc. See
➢ The two sets of selects allows the clock to be divided
by a non-power of two to achieve other baud rates such as
divide by 6, divide by 10, etc.
➢ The baud rate generator is activated only when the
SPI is in the master mode and a serial transfer is taking
place. In the other cases, the divider is disabled to decrease
IDD current.
ZIGBEE
1) What is the addressing mechanism in ZigBee?
➢ Each device in a network needs a unique address.
IEEE 802.15.4 uses two methods of addressing:
➢ 16-bit short addressing
➢ 64-bit extended addressing
➢ A network can choose to use either 16-bit or 64-bit
addressing.
➢ short address allows communication within a single • both ZCs and ZRs are full-function devices and a ZED
network. is a reduced-function device
➢ Using short addressing mechanism allows for a reduction • ZigBee Coordinator (ZC)- Use a ZigBee Coordinator
in length of messages & saves on required memory space that to form a network.
is allocated for storing addresses. • If network is secure, ZC must be present to add nodes
➢ combination of a unique PAN identifier & a short address to network. Otherwise, once network starts, it's just a
can be used for communication between independent router.
networks. • it contains the Trust Center. Only the Trust Center can
➢ Availability of 64-bit addressing means that maximum decide whether to allow a node on a ZigBee network,
number of devices in a network can be 2 64 , or approximately or to deny it access.
1.8* 10 .19
• ZigBee Router(ZR)- to enhance mesh in network.
➢ Therefore, an IEEE 802.15.4 wireless network has ZigBee Routers can extend range of network and
practically no limit on number of devices that can join increase its reliability.
network. • ZigBee End-Device (ZED)- if the node must be
➢ Network (NWK) layer of ZigBee protocol assigns a 16- battery-operated and sleep during network inactivity.
bit NWK address in addition to IEEE address. A ZED may be RxOnIde or not. When RxOnIdle is
➢ A simple lookup table is used to map each 64-bit IEEE false, ZEDs may sleep for long periods of time.
address to a unique NWK address. The Network Address
➢ NWK layer transactions require use of NWK address. • The network address, also called NwkAddr, short
➢ Each radio in a network can have a single IEEE address and address, or node address, is a 16-bit number used to
a single NWK address. uniquely identify a particular node on a ZigBee
➢ But there can be up to 240 devices connected to a single network.
radio. Each one of these devices is distinguished by a number • The ZigBee Coordinator is always NwkAddr 0x0000.
between 1 & 240 known as the endpoint address. • Yes, two ZigBee coordinators can exist on the same
ZIGBEE Addressing channel with NwkAddr 0x0000, because they are on
different PAN IDs.
• Addressing is the way in which a message gets from The MAC address,
one place to another in a network. • also called IEEE address, long address, or extended
• ZigBee addressing takes into account all the information address, is a 64bit number
shown in Table 4.3. • uniquely identifies this board from all other ZigBee
boards in the world.
• The top 24 bits of this address consist of the
Organizational Unique Identifier (OUI).
• The lower 40 bits are managed by the OEM producing
the boards.
• The 64-bit MAC addresses have no direct relationship
to the 16-bit NwkAddr. If a node leaves one ZigBee
network and joins another, its MAC address will
remain the same, but the NwkAddr will likely change.
•
2) How ZigBee gateway and ZigBee metaphor are while Bluetooth’s longer join time is detrimental (3
formed? seconds).
ZigBee gateway
• provides interface between a ZigBee network and
another network using a different standard.
• For eg, if ZigBee wireless networking is used to
gather patient information locally inside a room,
information might need to be transmitted over Internet to
a monitoring station.
• In this case, ZigBee gateway implements both ZigBee
protocol and Internet protocol to be able to translate
ZigBee packets to Internet protocol packet format, and •
vice versa. 4)What are the advantages of ZigBee over other
Zigbee metaphor wireless networks? Explain various ZigBee network
• One of the key characteristics of the ZigBee standard topologies.
is its mesh networking capability.
1. Compare ZigBee with wifi based on the technology
• In a large distributed mesh network, a message is
and applications?
relayed from one device to another until it reaches its
faraway destination. Similarly, when a group of honey ZigBee Networking Topologies
bees, distributed in a large field, want to communicate a 1) star topology
message all the way back to their hive, they use message • every device in the network can communicate
relaying. only with the PAN coordinator.
• Each bee performs a specific zigzag dance, which is • A typical scenario in a star network formation
repeated by the next bee that is slightly closer to the hive. is that an FFD, programmed to be a PAN coordinator,
• This process is repeated until the message gets to the is activated and starts establishing its network.
hive. The name ZigBee was selected as a metaphor for the • The first thing this PAN coordinator does is
way devices on the network find and interact with one select a unique PAN identifier that is not used by any
another. other network in its radio sphere of influence —the
region around the device in which its radio can
3)Compare ZigBee with Bluetooth based on the successfully communicate with other radios.
technology and applications? • In other words, it ensures that the PAN
• Depending on radio class, Bluetooth has a network identifier is not used by any other nearby network.
range of 1 to 100 meters while Zigbee is up to 70 meters
with a maximum network speed of 1M bit per second
to 250 M bit per second respectively.
• Bluetooth has a protocol stack size of 250 Kilo bytes
and 28K bytes for Zigbee.
• Batteries for blue tooth devices are rechargeable •
2) peer-to-peer topology
whereas for Zigbee they are not re chargeable but
• each device can communicate directly with any other
longer lasting.
device if the devices are placed close enough together to
• Zigbee aims at automation whereas Bluetooth aims at establish a successful communication link.
connectivity of mobile devices in close proximity. • Any FFD in a peer-to-peer network can play the role
• Zigbee uses low data rates, low power consumption on of the PAN coordinator.
small packet devices while blue tooth uses higher data • One way to decide which device will be the PAN
rates, higher power consumption on large packet coordinator is to pick the first FFD device that starts
devices. communicating as the PAN coordinator.
• In a peer-to-peer network, all the devices that
• Zigbee networks support longer range devices and participate in relaying the messages are FFDs because
more in number compared to Bluetooth networks RFDs are not capable of relaying the messages.
whose range is small. • However, an RFD can be part of the network and
• Given Zigbee’s almost instant network join times(30 communicate only with one particular device (a
milliseconds) its more suitable for critical applications coordinator or a router) in the network.
• A peer-to-peer network can take different shapes by 5) What are the different types of data transfer
defining restrictions on the devices that can communicate mechanism existing in ZigBee?
with each other. If there is no restriction, the peer-to-peer
network is known as a mesh topology . Another form of There are three types of data transfer in IEEE 802.15.4:
peer-to-peer network ZigBee supports is a tree topology. ● Data transfer to a coordinator from a device
● Data transfer from a coordinator to a device
● Data transfer between two peer devices
All three methods can be used in a peer-to-peer
topology. In a star topology, only the first two are
used, because no direct peer-to-peer communication is
allowed.
Data Transfer to a Coordinator
• In a beacon-enabled network, when a device decides
to transmit data to the coordinator, device
synchronizes its clock on a regular basis and
transmits data to coordinator using CSMA-CA
• method (assuming that transmission does not occur
• for during a GTS).
• coordinator may acknowledge reception of date
only if it is requested by data transmitter.
• This sequence chart is shown
•
• The device then sends a data request message to the place, and some designated devices always act as
coordinator indicating that it is active and ready to routers in the network.
receive the data. 7) Give the functional overview of the ZigBee and
• The coordinator acknowledges the receipt of the data IEEE 802.15.4 protocol layers.
request and sends the data to the device. Sending the 1) PHY Layer
acknowledgment by the device is optional. • In ZigBee wireless networking fig below,
• In a nonbeacon-enabled network, coordinator needs
to wait for the device to request the data.
• If the device requests data but there is no data
pending for that device, coordinator sends an
acknowledgment message with a specific format that
indicates there is no data pending for that device.
Alternatively, the coordinator may send a data
message with a zero-length payload.
Peer-to-Peer Data Transfer
• In a peer-to-peer topology, each device can
communicate directly with any other device.
• In many applications, the devices engaged in peer-to-
peer data transmissions and receptions are
synchronized.
•
6) What are the self forming and self healing the lowest protocol layer is the IEEE 802.15.4
characteristics of the ZigBee? Physical layer, or PHY.
• ZigBee network starts its formation as soon as devices • This layer is closest layer to hardware and directly
become active. controls and communicates with the radio transceiver.
• In a mesh network, for eg, the first FFD device that • The PHY layer is responsible for activating the radio
starts communicating can establish itself as the ZigBee that transmits or receives packets.
coordinator, and other devices then join the network • The PHY also selects the channel frequency and
by sending association requests. makes sure the channel is not currently used by any
• Because no additional supervision is required to other devices on another network.
establish a network, ZigBee networks are considered 1.1 PHY Packet General Structure
self-forming networks . • Data and commands are communicated between
• On the other hand, when a mesh network is various devices in the form of packets.
established, there is normally more than one way to • The general structure of a packet is shown in Figure.
relay a message from one device to another. Here first transmitted bit is the LSB of SHR. The
• Naturally, the most optimized way is selected to route MSB of last octet of PHY payload is transmitted
the message. last.
• However, if one of the routers stops functioning due
to exhaustion of its battery or if an obstacle blocks the
message route, the network can select an alternative
route.
• This is an example of the self-healing characteristic of
ZigBee mesh networking. ZigBee is considered an ad
hoc wireless network.
• In an ad hoc wireless network, some of the wireless
nodes are willing to forward data for other devices.
• The route that will carry a message from the source to
the destination is selected dynamically based on the • The PHY packet consists of three components:
network connectivity. • The Synchronization header (SHR)- enables
• If the network condition changes, it might be receiver to synchronize and lock into the bit stream.
necessary to change the routing in the network. • The PHY header (PHR)- contains frame length
• This is in contrast to some other networking information,
technologies in which there is an infrastructure in
• The PHY payload - is provided by upper layers and ● Beacon frame- used by a coordinator to transmit beacons.
includes data or commands for the recipient device. The beacons are used to synchronize clock of all devices
within same network.
• The MAC frame, which is transmitted to other ● Data frame- used to transmit data
devices as a PHY payload, has three sections. ● Acknowledge frame- acknowledge the
• The MAC header (MHR) -contains information successful reception of a frame.
such as addressing and security. ● MAC command frame-commands are transmitted using a
• The MAC payload - has a variable length size MAC command frame.
(including zero length) and contains commands or THE BEACON FRAME
data. • The structure is shown.
• The MAC footer (MFR)- contains a 16-bit Frame • entire MAC frame is used as a payload in a PHY packet.
Check Sequence (FCS) for data verification. The content of the PHY payload is referred to as the PHY
Service Data Unit (PSDU).
• The NWK frame has two parts: • In the PHY packet, preamble field is used by the receiver
• the NWK header (NHR) - has network-level for synchronization.
addressing and control information. • The start-of-frame delimiter (SDF) indicates the end of
• the NWK payload- is provided by the APS sublayer. SHR and start of PHR.
• The frame length specifies the total number of octets in
• In the APS sublayer frame the PHY payload (PSDU).
• The MAC frame consists of three sections:
• APS header (AHR)- has application-layer control • MAC header (MHR)
and addressing information. • MAC payload
• MAC footer (MFR)
• auxiliary frame header (auxiliary HDR) -contains • frame control field in MHR contains information defining
mechanism used to add security to frame and frame type, addressing fields, and other control flags.
security keys used. • sequence number specifies beacon sequence number
(BSN).
• These security keys are shared among the • addressing field provides source and destination addresses.
corresponding devices and help unlock the • auxiliary security header is optional and contains
information. The NWK and MAC frames can also information required for security processing.
have optional auxiliary headers for additional • MAC payload is provided by the NWK layer.
security. • superframe is a frame bounded by two beacon frames.
• superframe is optionally used in a beacon enabled network
• APS payload contains data or commands. and helps define GTSs.
• GTS field in MAC payload determines whether a GTS is
• Message Integrity Code (MIC)- is a security feature used to receive or transmit.
in the APS frame that is used to detect any • beacon frame is not only used to synchronize devices in a
unauthorized change in the content of the message. network but is also used by coordinator to let a specific
device in a network know there is data pending for that
device in coordinator.
2) MAC Layer • The device, at its discretion, will contact the coordinator and
• The Medium Access Control (MAC) layer provides request that it transmit the data to the device. This is called
interface between PHY layer and NWK layer. indirect transmission.
• The MAC is responsible for generating beacons and
synchronizing device to beacons (in a beacon-
enabled network).
• The MAC layer also provides association and
disassociation services.
Working Principle
• In the data frame itself, we incorporate one additional
field for acknowledgment (called ACK).
• Whenever party A wants to send data to party B, it will
send data along with this ACK field.
• Considering sliding window here of size 8 bits, if A
has send frames up to 5 correctly (from B), and wants
to send frames starting from frame 6, it will send
ACK6 with the data.
SYNC field
USB
1) What is the type of encoding used in USB data ➢ The bit stiffing alone is not enough to take care of the
transmission? How synchronization is achieved in synchronization between transmitter and receiver. To
the transmission? keep transmitter and receiver synchronized, SYNC
➢ The Universal Serial Bus (USB) protocol is designed field is used. In this mechanism, each packet begins
to enable communication between many devices by with a SYNC field which enables the receiver to
sharing a data bus. synchronize the clock
➢ A USB system consists of one host and many devices
➢ For low/full speed, SYNC field is of 8 bits:
Encoding Scheme KJKJKJKK. The first k serves as Start of Packet. For
high speed, SYNC field is of 32 bits: fifteen KJ
➢ The USB employs NRZI (Non Return to Zero repetitions, followed by KK. The alternate Ks and Js
Inversion) encoding mechanism to encode the data on provide transitions for synchronizing and the final two
the bus. In NRZI encoding, a ‘1’ is represented by no KKs mark the end of SYNC field.
change in level while a ‘0’ is represented by change in
level. Together with NRZI encoding, bit stiffing and End of Packet
SYNC field is used for synchronization between host
and device The End of Packet that is SE0 for 2-bit times followed by J
state for 1-bit time marks the end of packet.
➢ When long series of zeros are transmitted using NRZI, • A Universal Serial Bus (USB) is a common interface
it causes a transition in the levels. But when long series that enables communication between devices and a
of one’s is transmitted, no transition takes place as per host controller such as a personal computer (PC).
NRZI encoding scheme. No transition in levels for a
long time can confuse the receiver and makes it
desynchronized. • A USB drive is also known as USB Key, USB
stick, USB flash drive and other names.
➢ Bit stiffing is a process in which a zero is inserted in
raw data after every six consecutive ones. The
• USB drives are quite small in size and most weigh less
inserting of zero causes transition in level. The
than 35 gram. Some of the devices that can be
receiver must recognize the stuffed bits and discard
connected using a USB connection include: webcams,
them after decoding the NRZI data.
printers, digital camera, external hard drives, mouse,
➢ In case if no transition takes place in NRZI signal after keyboards, and scanners.
six consecutive one’s, then the receiver decides that bit
stiffing has not been done and discards the data • Flash drives are one of the most popular “Plug and
received. Play” devices that are commonly used all over the
world. Once the device is plugged into a computer, the
PC OS automatically identifies the required drives for
displaying content and files stored on the drive.
Router?
• The router forwards data packets along networks.
• Router is mainly a Network Layer device.
• A router is a device like a switch that routes data
packets based on their IP addresses.
• It is connected to at least two networks, commonly
two LANs or WANs or a LAN and its ISP's network.
• Routers are located at gateways, the places where two
or more networks connect.
•
• • Routers use headers and forwarding tables to
3. Why negative voltage is used in RS232 bus? determine the best path for forwarding the packets,
• The RS-232 voltage levels are important • they use protocols to communicate with each other
because they enable system to be designed to and configure the best route between any two hosts
ensure that data errors are minimise. Switch
• By assigning levels to the mark and Space • In networks the switch is the device that filters and
conditions, with a band in between it ensures forwards packets between LAN segments.
that data errors are minimised. • Switch is data link layer device.
• In addition to this the operation of the • Switches operate at the data link layer (layer 2) and
handshaking with lines including RST, CTS sometimes the network layer (layer 3) of the OSI
and DTR, the operation of the system can be Reference Model and therefore support any packet
reliable and only send data when all protocol.
equipment is ready. • LANs that use switches to join segments are called
• The dead area between +3v and -3v is switched LANs or, in the case of Ethernet networks,
designed to absorb line noise. switched Ethernet LANs.
• In RS232 specification low level -3v to-15v • keeps a record of the MAC addresses of all the
is defined as logic ‘1’ is ON state and referred devices connected to it.
as ‘Marking’ • With this information, a switch can identify which
• while high level +3v to +15v is defined as system is sitting on which port.
logic ‘0’ as OFF state and known as • So when a frame is received, it knows exactly which
‘Spacing’. port to send it to, without significantly increasing
network response times
• Switch can perform error checking before forwarding • Each specific I/O device may be connected to other
data, that makes it very efficient as it does not forward using specific interfaces, for example, with I/O device
packets that have errors and forward good packets for example, LCD controller, keyboard controller and
selectively to correct port only. print controller.
Hub • Bus communication simplifies the number of
connections and provides a common way (protocol) of
• A hub is a common connection point for devices in a
connecting different or same type of I/O devices
network.
• A hub connects multiple wires coming from different
branches,
• for example, the connector in star topology which
connects different stations.
• Hubs cannot filter data, so data packets are sent to all
connected devices.
• Hubs connect segments of a LAN.
• It contains multiple ports so when a packet arrives at
one port, it is copied to the other ports so that all
segments of the LAN can see all packets.
Gateway
• A gateway, as the name suggests, is a passage to
connect two networks together that may work
upon different networking models.
• They basically works as the messenger agents that
take data from one system, interpret it, and transfer IO Bus
it to another system. • I/O devices communicate with the processor through
• Gateways are also called protocol converters and an I/O bus, which is separate from the memory bus
can operate at any network layer. that the processor uses to communicate with the
• Gateways are generally more complex than memory system.
switch or router. • A bus has a fixed bandwidth that must be shared by
all of the devices on the bus.
5. How embedded network is different from Embedded systems Networking
computer network? • Embedded systems connected internally on same IC
• A computer network is a set of connected or systems at very short, short and long distances can
computers. Computers on a network are be networked using a type of the I/O buses- CAN, I
called nodes. 2C, USB, PCI, …
• The connection between computers can be serial bus
done via cabling, most commonly the • A serial bus has very few lines and the number of lines
Ethernet cable, or wirelessly through radio as per the protocol
waves. • A wide range of I/O devices without having to implement
• Connected computers can share resources, a specific interface for each I/O device.
like access to the Internet, printers, file Parallel bus
servers, and others.
• Using a parallel I/O bus allows a computer or
• Embedded networks are private electricity
controller or embedded system to interface with
networks that supply homes or businesses
number of internal systems at very short distances
within a specific area. They are common in
without having to implement a specific interface for
apartment buildings, shopping centres,
each I/O device
caravan parks and retirement villages.
6. What are the important features of the
communication buses used in embedded
networks?
• Bus Communication for networking Bus
Communication for networking
determined by the one with the shortest clock HIGH
period.
I2C Arbitration
➢ Arbitration, like synchronization, refers to a
1)How the clock synchronization and portion of the protocol required only if more than one
arbitration is done in multimaster master is used in the system.
configuration of I2C bus ➢ Slaves are not involved in the arbitration
• Two masters can begin transmitting on a free bus at procedure. A master may start a transfer only if the bus
the same time and there must be a method for deciding is free.
which takes control of the bus and complete its ➢ Two masters may generate a START
transmission. condition within the minimum hold time (tHD;STA)
• This is done by clock synchronization and arbitration. of the START condition which results in a valid
• In single master systems, clock synchronization and START condition on the bus.
arbitration are not needed. ➢ Arbitration is then required to determine which
clock synchronization master will complete its transmission. Arbitration
➢ performed using the wired-AND connection proceeds bit by bit.
of I2C interfaces to the SCL line. ➢ During every bit, while SCL is HIGH, each
➢ This means that a HIGH to LOW transition master checks to see if the SDA level matches what it
on the SCL line causes the masters concerned has sent.
to start counting off their LOW period and, ➢ This process may take many bits.
once a master clock has gone LOW, it holds ➢ Two masters can actually complete an entire
the SCL line in that state until the clock transaction without error, as long as the transmissions
HIGH state is reached. are identical.
➢ The first time a master tries to send a HIGH,
but detects that the SDA level is LOW, the master
knows that it has lost the arbitration and turns off its
SDA output driver.
➢ The other master goes on to complete its
transaction.
➢ No information is lost during the arbitration
process.
➢ A master that loses the arbitration can generate
clock pulses until the end of the byte in which it loses
the arbitration and must restart its transaction when the
bus is free.
➢ If a master also incorporates a slave function
➢
➢ However, if another clock is still within its LOW and it loses arbitration during the addressing stage, it
period, the LOW to HIGH transition of this clock may not is possible that the winning master is trying to address
change the state of the SCL line. it.
➢ The SCL line is therefore held LOW by the master ➢ The losing master must therefore switch over
with the longest LOW period. immediately to its slave mode.
➢ Masters with shorter LOW periods enter a HIGH wait-
state during this time.
➢ When all masters concerned have counted off their
LOW period, the clock line is released and goes HIGH.
➢ There is then no difference between the master clocks
and the state of the SCL line, and all the masters start
counting their HIGH periods.
➢ The first master to complete its HIGH period pulls the
SCL line LOW again.
➢ In this way, a synchronized SCL clock is generated
with its LOW period determined by the master with the
longest clock LOW period, and its HIGH period
➢
➢ the following combinations result in an register data to the slave, until the master has sent all the
undefined condition: data it needs to (sometimes this is only a single byte), and
• Master 1 sends a repeated START condition the master will terminate the transmission with a STOP
and master 2 sends a data bit. condition.
• Master 1 sends a STOP condition and
master 2 sends a data bit.
• Master 1 sends a repeated START condition
and master 2 sends a STOP condition.
•
Data on the I2C bus is transferred in 8-bit packets
(bytes). There is no limitation on the number of
bytes, however, each byte must be followed by an
Acknowledge bit. This bit signals whether the device
is ready to proceed with the next byte. For all data
bits including the Acknowledge bit, the master must
generate clock pulses. If the slave device does not
acknowledges transfer this means that there is no
more data or the device is not ready for the transfer The master always generates START and STOP
yet. The master device must either generate Stop or conditions. The bus is considered to be busy after the
Repeated Start condition. START condition. The bus is considered to be free
again a certain time after the STOP condition. The
5)What are the differences between bus stays busy if a repeated START (Sr) is generated
standard mode and fast mode of I2C? instead of a STOP condition.
➢ The protocol, format, logic levels and maximum
capacitive load for the SDA and SCL lines are the 7)Explain data read and write operation to
same as the Standard-mode I2C-bus specification. a slave device in I2C interfacing?
➢ Fast-mode devices are downward-compatible and can
communicate with Standard-mode devices in a 0 to
100 kbit/s I2C-bus system.
8_)What are the means to avoid chaos
when more than one master is trying to get
bus access in I2C?
• The possibility of connecting more than one
microcontroller to the I2C-bus means that
more than one master could try to initiate a
data transfer at the same time.
• To avoid the chaos that might ensue from
such an event, an arbitration procedure has
been developed.
• This procedure relies on the wired-AND
connection of all I2C interfaces to the I2C-
bus. If two or more masters try to put
information onto the bus, the first to produce
a ‘one’ when the other produces a ‘zero’ loses
the arbitration.
• The clock signals during arbitration are a
synchronized combination of the clocks
generated by the masters using the wired-
AND connection to the SCL line
• Arbitration, like synchronization, refers to a
portion of the protocol required only if more
than one master is used in the system.
Disadvantages of Ethernet: