640 likes | 853 Views
Networking for Embedded Systems. Networking for Embedded Systems. Why we use networks Network abstractions Example networks. Network elements. distributed computing platform:. PE. PE. communication link. network. PE. PEs may be CPUs or ASICs. initial processing. more processing.
E N D
Networking for Embedded Systems • Why we use networks • Network abstractions • Example networks
Network elements distributed computing platform: PE PE communication link network PE PEs may be CPUs or ASICs
initial processing more processing Networks in embedded systems PE sensor PE PE actuator
Why distributed? • Higher performance at lower cost • Physically distributed activities---time constraints may not allow transmission to central site • Improved debugging---use one CPU in network to debug others • May buy subsystems that have embedded processors
Advanced communication principles • Layering • Break complexity of communication protocol into pieces easier to design and understand • Lower levels provide services to higher level • Lower level might work with bits while higher level might work with packets of data • Physical layer • Lowest level in hierarchy • Medium to carry data from one actor (device or node) to another • Parallel communication • Physical layer capable of transporting multiple bits of data • Serial communication • Physical layer transports one bit of data at a time • Wireless communication • No physical connection needed for transport at physical layer
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
application end-use interface presentation data format session application dialog control transport connections network end-to-end service data link reliable data transport physical mechanical, electrical OSI model
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
OSI layers, cont’d. • Session: services for end-user applications: data grouping, checkpointing, etc • Presentation: data formats, transformation services • Application: interface between network and end-user programs
Error detection and correction • Often part of protocol • Error detection: ability of receiver to detect errors during transmission • Error correction: ability of receiver and transmitter to cooperate to correct problem • Typically done by acknowledgement/retransmission protocol • Bit error: single bit is inverted • Burst of bit error: consecutive bits received incorrectly • Parity: extra bit sent with word used for error detection • Odd parity: data word plus parity bit contains odd number of 1’s • Even parity: data word plus parity bit contains even number of 1’s • Always detects single bit errors, but not all burst bit errors • Checksum: extra word sent with data packet of multiple words • e.g., extra word contains XOR sum of all data words in packet
Hardware architectures • Many different types of networks: • topology • scheduling of communication • Routing • Types of physical media • Parallel • Serial • Wireless
Point-to-point networks • One source, one or more destinations, no data switching (parallel or serial port): PE 3 PE 1 PE 2 link 1 link 2
header address data ECC packet format Bus networks • Common physical connection: PE 1 PE 2 PE 3 PE 4
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 B C A B C round-robin A B C B C A A,B,C A,B,C
Crossbar out4 out3 out2 out1 in1 in2 in4 in3
Crossbar characteristics • Non-blocking • Can handle arbitrary multi-cast combinations • Size proportional to n2
Multi-stage networks • Use several stages of switching elements • Often blocking • Often smaller than crossbar
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
Parallel communication • Multiple data, control, and possibly power wires • One bit per wire • High data throughput with short distances • Typically used when connecting devices on same IC or same circuit board • Bus must be kept short • long parallel wires result in high capacitance values which requires more time to charge/discharge • Data misalignment between wires increases as length increases • Higher cost, bulky
Parallel protocols: PCI Bus • PCI Bus (Peripheral Component Interconnect) • High performance bus originated at Intel in the early 1990’s • Standard adopted by industry and administered by PCISIG (PCI Special Interest Group) • Interconnects chips, expansion boards, processor memory subsystems • Data transfer rates of 127.2 to 508.6 Mbits/s and 32-bit addressing • Later extended to 64-bit while maintaining compatibility with 32-bit schemes • Synchronous bus architecture • Multiplexed data/address lines
Parallel protocols: ARM Bus • ARM Bus • Designed and used internally by ARM Corporation • Interfaces with ARM line of processors • Many IC design companies have own bus protocol • 32-bit addressing • AMBA (Advanced Microcontroller Bus Architecture) • Advanced High-performance Bus (AHB) • Advanced System Bus (ASB) • Advanced Peripheral Bus (APB)
Serial communication • Single data wire, possibly also control and power wires • Words transmitted one bit at a time • Higher data throughput with long distances • Less average capacitance, so more bits per unit of time • Cheaper, less bulky • More complex interfacing logic and communication protocol • Sender needs to decompose word into bits • Receiver needs to recompose bits into word • Control signals often sent on same wire as data increasing protocol complexity
Serial protocols: I2C bus • Designed for low-cost, medium data rate applications • Inter-Integrated Circuit (I2C) Bus • Designed by Philips nearly 20 years ago • Enables peripheral ICs to communicate using simple comm HW • Characteristics: • Two-wire serial bus • multiple-master • Data transfer rates up to 100 kbits/s and 7-bit addressing possible in normal mode • 3.4 Mbits/s and 10-bit addressing in fast-mode • fixed-priority arbitration • Several microcontrollers come with built-in I2C controllers • Common devices capable of interfacing to I2C bus: • EPROMS, Flash, and some RAM memory, real-time clocks, watchdog timers, and microcontrollers
SCL SDA SDA SDA SDA SDA Start condition Sending 0 Sending 1 Stop condition SCL SCL SCL SCL Micro-controller (master) EEPROM (servant) LCD-controller (servant) Temp. Sensor (servant) From receiver From Servant D < 400 pF C ST ART A6 A5 A0 R/w ACK D8 D7 D0 ACK ST OP Addr=0x01 Addr=0x02 Addr=0x03 Typical read/write cycle I2C physical layer serial clock line serial data line
I2C electrical interface • Open collector/open drain interface: + SDL Assert data Data in + SCL Assert clock Clock in
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
S 7 bits r/w 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 • Address 00000000 : general call
I2C data format ... SCL ... ... SDL 8-bit byte start MSB ack stop The receiver sets the SDL to 0 if it properly receive the byte
I2C bus arbitration • Sender listens while sending address • When sender hears a conflict, it stops signaling • Low-priority senders relinquish control early enough in clock cycle to allow bit to be transmitted reliably
I2C transmissions multi-byte write S adrs 0 data data P read from slave stop S adrs 1 data P from slave write, then read S adrs 0 data S adrs 1 data P from slave
Serial protocols: CAN • CAN (Controller area network) • Protocol for real-time applications • Developed by Robert Bosch GmbH • Originally for communication among components of cars • Applications now using CAN include: • elevator controllers, copiers, telescopes, production-line control systems, and medical instruments • Data transfer rates up to 1 Mbit/s and 11-bit addressing • Common devices interfacing with CAN: • 8051-compatible 8592 processor and standalone CAN controllers • Actual physical design of CAN bus not specified in protocol • Requires devices to transmit/detect dominant and recessive signals to/from bus • e.g., ‘1’ = dominant, ‘0’ = recessive if single data wire used • Bus guarantees dominant signal prevails over recessive signal if asserted simultaneously
USB • Universal Serial Bus • Compaq, DEC, IBM, Intel, Microsoft, etc. • Spec 1.0 published in Jan. ’96 • Spec 2.0 in ’00 • USB 1.1 • 12 Mbps (full-speed), 1.5 Mbps (low-speed) • USB 2.0 • 480 Mbps
Tiered star topology Point-to-point connection between a host and a hub or function Host scheduled, token-based protocol Plug-and-Play USB, cont’d
Differential current drive Tiered star topology USB physical layer
USB data flow type • Control transfers • Used to configure a device at attach time • Bulk data transfers • Generated and consumed in relatively large and bursty quantities • Interrupt data transfers • Used for timely but reliable delivery of data • Isochronous transfers • Occupy a prenegotiated amount of USB bandwidth with a prenegotiated delivery latency
USB protocol layer • Byte/Bit ordering • LSb first, LSB first in multiple byte fields • SYNC field • All packets begin with a SYNC field • Packet identifier field (PID) • Immediately follows the SYNC field
Address field + endpoint number • Address field • 128 addressed ADDR<6:0> • 0 : reserved as the default address • Endpoint field • ENDP<3:0> • Permit more flexible addressing of functions in which more than one endpoint is required
Other fields • Frame number field • Incremented by the host on a per-frame basis • 0-7FF • Sent only in SOF tokens at the start of each (miro)frame • Data field • Zero to 1,024 bytes • CRCs • Token CRCs • Data CRCs
Packet formats • Token packets • Split transactions • Start-split (SSPLIT) • Complete-split (CSPLIT)
Packet formats, cont’d • Start of frame • 1ms for FS • 125ms for HS • Data Packets
Packet formats, cont’d • Handshake packets • Ack, Nack, etc. • Only a PID
Serial protocols: FireWire • FireWire (a.k.a. I-Link, Lynx, IEEE 1394) • High-performance serial bus developed by Apple Computer Inc. • Designed for interfacing independent electronic components • e.g., Desktop, scanner • Data transfer rates from 12.5 to 400 Mbits/s, 64-bit addressing • Plug-and-play capabilities • Packet-based layered design structure • Applications using FireWire include: • disk drives, printers, scanners, cameras
IEEE 1394 • Capable of supporting a LAN similar to Ethernet • 64-bit address: • 10 bits for network ids, 1023 subnetworks • 6 bits for node ids, each subnetwork can have 63 nodes • 48 bits for memory address, each node can have281 terabytesof distinctlocations • 1394b draft • 3.2 Gigabit 1394 • 100 meters distances
Wireless communication • Infrared (IR) • Electronic wave frequencies just below visible light spectrum • Diode emits infrared light to generate signal • Infrared transistor detects signal, conducts when exposed to infrared light • Cheap to build • Needline of sight, limited range • Radio frequency (RF) • Electromagnetic wave frequencies in radio spectrum • Analog circuitry and antenna needed on both sides of transmission • Line of sight not needed, transmitter power determines range
Wireless protocols: IrDA • IrDA • Protocol suite that supports short-range point-to-point infrared data transmission • Created and promoted by the Infrared Data Association (IrDA) • Data transfer rate of 9.6 kbps and 4 Mbps • IrDA hardware deployed in notebook computers, printers, PDAs, digital cameras, public phones, cell phones • Lack of suitable drivers has slowed use by applications • Windows 2000/98 now include support • Becoming available on popular embedded OS’s
Wireless protocols: Bluetooth • Bluetooth • New, global standard for wireless connectivity • Based on low-cost, short-range radio link • Connection established when within 10 meters of each other • No line-of-sight required • e.g., Connect to printer in another room
Wireless Protocols: IEEE 802.11 • IEEE 802.11 • Proposed standard for wireless LANs • Specifies parameters for PHY and MAC layers of network • PHY layer • physical layer • handles transmission of data between nodes • provisions for data transfer rates of 1 or 2 Mbps • operates in 2.4 to 2.4835 GHz frequency band (RF) • or 300 to 428,000 GHz (IR) • MAC layer • medium access control layer • protocol responsible for maintaining order in shared medium • collision avoidance/detection
Ethernet • Dominant non-telephone LAN • Versions: 10 Mb/s, 100 Mb/s, 1 Gb/s • Goal: reliable communication over an unreliable medium