You are on page 1of 62

Networking for Embedded Systems

Why we use networks. Network abstractions. Example networks.

2000 Morgan Kaufman

Overheads for Computers as Components

Network elements
distributed computing platform:
PE PE communication link network PE PEs may be CPUs or ASICs.
2000 Morgan Kaufman Overheads for Computers as Components

Networks in embedded systems


initial processing

more processing PE
PE

sensor

PE

actuator

2000 Morgan Kaufman

Overheads for Computers as Components

Why distributed?
Higher performance at lower cost. Physically distributed activities---time constants may not allow transmission to central site. Improved debugging---use one CPU in network to debug others. May buy subsystems that have embedded processors.
2000 Morgan Kaufman Overheads for Computers as Components

Network abstractions
International Standards Organization (ISO) developed the Open Systems Interconnection (OSI) model to describe networks:
7-layer model.

Provides a standard way to classify network components and operations.


2000 Morgan Kaufman Overheads for Computers as Components

OSI model
application presentation session transport network

end-use interface
data format application dialog control connections end-to-end service

data link
physical
2000 Morgan Kaufman Overheads for Computers as Components

reliable data transport


mechanical, electrical

OSI layers
Physical: connectors, bit formats, etc. Data link: error detection and control across a single link (single hop). Network: end-to-end multi-hop data communication. Transport: provides connections; may optimize network resources.
2000 Morgan Kaufman Overheads for Computers as Components

OSI layers, contd.


Session: services for end-user applications: data grouping, checkpointing, etc. Presentation: data formats, transformation services. Application: interface between network and end-user programs.
2000 Morgan Kaufman Overheads for Computers as Components

Hardware architectures
Many different types of networks:
topology; scheduling of communication; routing.

2000 Morgan Kaufman

Overheads for Computers as Components

Point-to-point networks
One source, one or more destinations, no data switching (serial port):

PE 1 link 1

PE 2 link 2

PE 3

2000 Morgan Kaufman

Overheads for Computers as Components

Bus networks
Common physical connection:

PE 1

PE 2

PE 3

PE 4

header
2000 Morgan Kaufman

address

data

ECC

packet format

Overheads for Computers as Components

Bus arbitration
Fixed: Same order of resolution every time. Fair: every PE has same access over long periods.
round-robin: rotate top priority among Pes.
fixed

A A
A,B,C

B B

C C
A,B,C

A B

B C

C A

round-robin

2000 Morgan Kaufman

Overheads for Computers as Components

Crossbar

out4 out3 out2 out1

in1
2000 Morgan Kaufman

in2

in3

in4

Overheads for Computers as Components

Crossbar characteristics
Non-blocking. Can handle arbitrary multi-cast combinations. Size proportional to n2.

2000 Morgan Kaufman

Overheads for Computers as Components

Multi-stage networks
Use several stages of switching elements. Often blocking. Often smaller than crossbar.

2000 Morgan Kaufman

Overheads for Computers as Components

Message-based programming
Transport layer provides message-based programming interface:
send_msg(adrs,data1);

Data must be broken into packets at source, reassembled at destination. Data-push programming: make things happen in network based on data transfers.
2000 Morgan Kaufman Overheads for Computers as Components

I2C bus
Designed for low-cost, medium data rate applications. Characteristics:
serial; multiple-master; fixed-priority arbitration.

Several microcontrollers come with builtin I2C controllers.


2000 Morgan Kaufman Overheads for Computers as Components

I2C physical layer

master 1 SDL SCL slave 1

data line
clock line

master 1

slave 1

2000 Morgan Kaufman

Overheads for Computers as Components

I2C data format

SCL

...

...

SDL
start
2000 Morgan Kaufman

... MSB
Overheads for Computers as Components

ack

I2C electrical interface


Open collector interface:
SDL +

+
SCL

2000 Morgan Kaufman

Overheads for Computers as Components

I2C signaling
Sender pulls down bus for 0. Sender listens to bus---if it tried to send a 1 and heard a 0, someone else is simultaneously transmitting. Transmissions occur in 8-bit bytes.

2000 Morgan Kaufman

Overheads for Computers as Components

I2C data link layer


Every device has an address (7 bits in standard, 10 bits in extension).
Bit 8 of address signals read or write.

General call address allows broadcast.

2000 Morgan Kaufman

Overheads for Computers as Components

I2C bus arbitration


Sender listens while sending address. When sender hears a conflict, if its address is higher, it stops signaling. Low-priority senders relinquish control early enough in clock cycle to allow bit to be transmitted reliably.

2000 Morgan Kaufman

Overheads for Computers as Components

I2C transmissions
multi-byte write S adrs 0 data data P

read from slave


S adrs 1 data P

write, then read S


2000 Morgan Kaufman

adrs

data

adrs

data

Overheads for Computers as Components

Multiprocessor networks
Multiple DSPs are often connected by high-speed networks for signal processing:
DSP DSP

DSP
2000 Morgan Kaufman

DSP

Overheads for Computers as Components

SHARC link ports


Six per CPU. Four bits per link port. Packets have 32- or 48-bit payload. Can be controlled by DMA. Are half-duplex---must be turned around by program.
2000 Morgan Kaufman Overheads for Computers as Components

Ethernet
Dominant non-telephone LAN. Versions: 10 Mb/s, 100 Mb/s, 1 Gb/s Goal: reliable communication over an unreliable medium.

2000 Morgan Kaufman

Overheads for Computers as Components

Ethernet topology
Bus-based system, several possible physical layers:
A B C

2000 Morgan Kaufman

Overheads for Computers as Components

CSMA/CD
Carrier sense multiple access with collision detection:
sense collisions; exponentially back off in time; retransmit.

2000 Morgan Kaufman

Overheads for Computers as Components

Exponential back-off times

time
2000 Morgan Kaufman Overheads for Computers as Components

Ethernet packet format

preamble

start frame

source adrs

dest data length padding CRC adrs payload

2000 Morgan Kaufman

Overheads for Computers as Components

Ethernet performance
Quality-of-service tends to non-linearly decrease at high load levels. Cant guarantee real-time deadlines. However, may provide very good service at proper load levels.

2000 Morgan Kaufman

Overheads for Computers as Components

Internet Protocol
Internet Protocol (IP) is basis for Internet. Provides an internetworking standard: between two Ethernets, Ethernet and token ring, etc. Higher-level services are built on top of IP.

2000 Morgan Kaufman

Overheads for Computers as Components

IP in communication
application presentation session IP network data link application presentation session

transport
network data link

transport
network data link

physical
node A
2000 Morgan Kaufman

physical
router
Overheads for Computers as Components

physical
node B

IP packet
Includes:
version, service type, length time to live, protocol source and destination address data payload

Maximum data payload is 65,535 bytes.

2000 Morgan Kaufman

Overheads for Computers as Components

IP addresses
32 bits in early IP, 128 bits in IPv6. Typically written in form xxx.xx.xx.xx. Names (foo.baz.com) translated to IP address by domain name server (DNS).

2000 Morgan Kaufman

Overheads for Computers as Components

Internet routing
Best effort routing:
doesnt guarantee data delivery at IP layer.

Routing can vary:


session to session; packet to packet.

2000 Morgan Kaufman

Overheads for Computers as Components

Higher-level Internet services


Transmission Control Protocol (TCP) provides connection-oriented service. Quality-of-service (QoS) guaranteed services are under development.

2000 Morgan Kaufman

Overheads for Computers as Components

The Internet service stack

FTP HTTP SMTP telnet TCP

SNMP UDP User Datagram Protocol

IP

2000 Morgan Kaufman

Overheads for Computers as Components

Networks
Network-based design.
Communication analysis. System performance analysis.

Internet-enabled systems.

2000 Morgan Kaufman

Overheads for Computers as Components

Communication analysis
First, understand delay for single message. Delay for multiple messages depends on:
network protocol; devices on network.

2000 Morgan Kaufman

Overheads for Computers as Components

Message delay
Assume:
single message; no contention.

Delay:
tm = tx + tn + tr = xmtr overhead + network xmit time + rcvr overhead
2000 Morgan Kaufman Overheads for Computers as Components

Example: I2C message delay


Network transmission time dominates. Assume 100 kbits/sec, one 8-bit byte. Number of bits in packet:
npacket = start + address + data + stop = 1 + 8 + 8 + 1 = 18 bits

Time required to transmit: 1.8 x 10-4 sec. 20 instructions on 8 MHz controller adds 2.5 x 10-6 delay on xmtr, rcvr.
2000 Morgan Kaufman Overheads for Computers as Components

Multiple messages
If messages can interfere with each other, analysis is more complex. Model total message delay:
ty = td + tm = wait time for network + message delay

2000 Morgan Kaufman

Overheads for Computers as Components

Arbitration and delay


Fixed-priority arbitration introduces unbounded delay for all but highestpriority device.
Unless higher-priority devices are known to have limited rates that allow lower devices to transmit.

Round-robin arbitration introduces bounded delay proportional to N.


2000 Morgan Kaufman Overheads for Computers as Components

Example: adjusting messages to reduce delay


Task graph:
3
execution time 3

Network:
allocation M1 M2 M3

P1 d1
4 P3

P2
d2

Transmission time = 4
2000 Morgan Kaufman Overheads for Computers as Components

Initial schedule
M1 M2 M3 network d1 d1 P1 P2 P3

Time = 15 0
2000 Morgan Kaufman

10
Overheads for Computers as Components

15

20 time

New design
Modify P3:
reads one packet of d1, one packet of d2 computes partial result continues to next packet

2000 Morgan Kaufman

Overheads for Computers as Components

New schedule
M1
M2

P1
P2 P3 P3 P3 P3 d1d2d1d2d1d2d1d2 Time = 12 0 5 10
Overheads for Computers as Components

M3
network

15

20 time

2000 Morgan Kaufman

Further complications
Acknowledgment time. Transmission errors.

2000 Morgan Kaufman

Overheads for Computers as Components

Priority inversion in networks


In many networks, a packet cannot be interrupted. Result is priority inversion:
low-priority message holds up higher-priority message.

Doesnt cause deadlock, but can slow down important communications.


2000 Morgan Kaufman Overheads for Computers as Components

Multihop networks
In multihop networks, one node receives message, then retransmits to destination (or intermediate).
hop 1 A Network 1 B hop 2 Network 2 C

2000 Morgan Kaufman

Overheads for Computers as Components

System performance analysis


System analysis is difficult in general.
multiprocessor performance analysis is hard; communication performance analysis is hard.

Simple example: uncertainty in P1 finish time -> uncertainty in P2 start time.


P1 P2

2000 Morgan Kaufman

Overheads for Computers as Components

Analysis challenges
P2 and P3 can delay each other, even though they are in separate tasks. Delays in P1 propagate to P2, then P3, then to P4.
P1

P2
P3

P4

2000 Morgan Kaufman

Overheads for Computers as Components

Lower bounds on system


Computational requirements:
sum up process requirements over least-common multiple of periods, average over one period.

Communication requirements:
Count all transmissions in one period.

2000 Morgan Kaufman

Overheads for Computers as Components

Hardware platform design


Need to choose:
number and types of PEs; number and types of networks.

Evaluate a platform by allocating processes, scheduling processes and communication.

2000 Morgan Kaufman

Overheads for Computers as Components

I/O-intensive systems
Start with I/O devices, then consider computation:
inventory required devices; identify critical deadlines; chooses devices that can share PEs; analyze communication times; choose PEs to go with devices.
2000 Morgan Kaufman Overheads for Computers as Components

Computation-intensive systems
Start with shortest-deadline tasks:
Put shortest-deadline tasks on separate PEs. Check for interference on critical communications. Allocate low-priority tasks to common PEs wherever possible.

Balance loads wherever possible.


2000 Morgan Kaufman Overheads for Computers as Components

Internet-enabled embedded system


Internet-enabled embedded system: any embedded system that includes an Internet interface (e.g., refrigerator). Internet appliance: embedded system designed for a particular Internet task (e.g. email).

2000 Morgan Kaufman

Overheads for Computers as Components

Examples
Laser printer. Personal digital assistant (PDA). Home automation system.

2000 Morgan Kaufman

Overheads for Computers as Components

Example: Javacam
Hardware platform:
parallel-port camera; National Semi NS486SXF; 1.5 Mbytes memory.

Uses memory-efficient Java Nanokernel.

2000 Morgan Kaufman

Overheads for Computers as Components

Javacam architecture
QuickCam Web browser applet Quickcam server HTTP

QuickCam
Java VM Java nanokernel 486

2000 Morgan Kaufman

Overheads for Computers as Components