Professional Documents
Culture Documents
Beginners Guide Ethernet
Beginners Guide Ethernet
Technical notes on using Analog Devices DSPs, processors and development tools
a Contact our technical support at processor.support@analog.com and dsptools.support@analog.com
Or visit our on-line resources http://www.analog.com/ee-notes and http://www.analog.com/processors
Copyright 2005, Analog Devices, Inc. All rights reserved. Analog Devices assumes no responsibility for customer product design or the use or application of
customers’ products or for any infringements of patents or rights of others which may result from Analog Devices assistance. All trademarks and logos are property
of their respective holders. Information furnished by Analog Devices applications and development tools engineers is believed to be accurate and reliable, however
no responsibility is assumed by Analog Devices regarding technical accuracy and topicality of the content provided in Analog Devices Engineer-to-Engineer Notes.
a
OSI Model It consists of seven layers and each layer
describes the status of the communications, e.g.,
The OSI model provides a standard description Ethernet.
or "reference model" for how messages should
be transmitted between any two points in a Figure 2 compares the OSI model with the
telecommunication network. TCP/IP model and its protocols.
5 Session RPC
Layer
RFCs 100Mbit/s
RFCs (request for comments) are very popular in |----------100Base-T4
the Ethernet community and form a type of |----------100Base-X
regulation system. RFCs describe many of the |--------------100Base-TX
Internet protocols as well as standards, |--------------100Base-FX
procedures, rules, algorithms, and strategies for
1000Mbit/s
the communication and network area. An RFC
|----------1000Base-T
starts as a recommendation; after successful
discussion, it is then approved by the Internet |----------1000Base-X
community. After publication, this |--------------1000Base-SX
recommendation will be mostly accepted by the |--------------1000Base-LX
market. For instance, decisions of the IAB |--------------1000Base-CX
(Internet Architecture Board) are always legend :
published as RCFs.
2 = thin coaxial S = short wavelength
The most important protocols are: 5 = thick coaxial L = long wavelength
RFC 768 User Data Protocol T = twisted pair C = short copper cable
RFC 793 Transmission Control Protocol F = fiber optics
RFC 791 Internet Protocol
RFC 792 Internet Control Massage Protocol FOIRL = Fiber Optic Inter-Repeater Link
Coding Methods
Figure 4 (PHY and MAC layer) shows layer 1 in
detail, It includes the PCS, PMA, PMD, and
Auto-Negotiation units. All these units are Figure 5. Manchester Phase Encoding
supported by the PHY. The active component
gM (x) = 1+ x13 + x33 for master The Manchester code changes its value after
each bit of the signal. The NRZI code does the
gM (x) = 1+ x20 + x33 for slave same with its limited subsequent numbers of
The implementation of master and slave PHY zeros changes the bit deterministic. The 4B/5Bit
side-stream scramblers is made possible by using coding method used only two subsequent zeros
a linear-feedback shift register. For an exempted “Start of Stream” (see Table 1).
implementation of this feature, refer to the data The combination of the NRZI and MLT-3
sheet of your favorite PHY.[12] methods reduces the frequency once more, so
that the maximum frequency goes down to
Comparing Manchester Code, 4B/5B Code, and 31.25 MHz.
MLT-3
With the behavior of these coding methods, a
All bits will be transformed with NRZI, clock recovery is always possible. Thus, for
MLT-3, and scrambling methods; 10/100Mbit/s networks (Manchester or 4B/5B
therefore, you cannot measure this (e.g., with MLT-3), no additionally clock sources are
with an oscilloscope) at the line. necessary.
Full Duplex
Full duplex is a mode of operation of a network
or Physical Medium Attachment (PMA) that Figure 9. Link Pulses
supports duplex transmission as defined in IEEE With Auto-Negotiation in place, all three speeds
100. Within the scope of this standard, this mode of twisted-pair Ethernet can determine the
of operation allows for simultaneous common set of options supported between a pair
communication between a pair of stations, of "link partners". Twisted-pair link partners can
100BASE-TX Transmitter
31.25MHz
Collosion Auto-
MLT-3
magn MLT-3
Negotiation RJ45
etics
and Link
MII 25MHz
by 4 bits
100BASE-TX Receiver
Clock&Data
25MHz Descrambl 125MHz recovery MLT-3 MLT-3 RX
CSMA/ 4B/5B
er and (NRZI Converter Driver
MII
Registers of a MII-Compatible PHY Some PHYs duplex these pins with the
Each PHY has several registers for its PHY address in order to reduce the pin
configuration. The registers are split into IEEE- count. In this case, internal logic figures
compliant registers and vendor-specific registers. out the PHY address during power-
For instance, the first 16 registers are compliant up/reset.
to IEEE, but it depends on the supported features
how many registers are included. This is also
RJ45 and Twisted-Pair Cable
valid for the vendor-specific register; this means
that the number of the included registers depends The Medium Dependent Interface (MDI) shown
on the supported functions of the device. The in Figure 4 uses twisted-pair cable or optical
vendor-specific registers start from address 16 cable as the transfer medium. The RJ45 jack in
until address 32, in general. combination with twisted cable is widely used
due to its suppleness, price, and future-proof of
The registers are accessible via MII Interface
speed. The optical variant is more expensive
using the Station Management pins. It is a
because of its need for optical switches, optical
synchronous serial interface with a clock (MDC)
cables, etc.
and a data (MDIO) wire. For more information,
refer to MII Interface later in this EE-Note.
LED
The PHY can indicate the status of the system
using LEDs. By setting the appropriate registers,
the LEDs will show useful system information,
(e.g., indications for Speed-, Link-, Transmit-,
Receive-, Collision, Duplex Status, and so on). 1: TX + 3: RX +
2: TX - 6: RX –
Magnetics
An isolation-magnetic for each RJ45 connector is
required by the IEEE standard. This magnetic
isolates and offsets the signal voltage from MAC
and from RJ45 to protect the MAC and other
devices (e.g., switches) from being damaged by
Figure 12. Cross-Over Cable vs. Normal Cable high voltage at the line. Some RJ45 jacks have
already included the magnetic. For example,
What are the Benefits of Using Twisted-Pair Cable? HALO Electronics offers FastJack™ connectors
This system is based on the differential voltage with integrated high-performance magnetics.
principle. That means the data is split into two These connectors have a small industry-standard
signals. The twisted-pair cables are the transport connector design and work on some EZ-KIT Lite
medium. At the end, a comparator circuit daughter cards. Figure 14 shows the pin
combines the signals together. The following description of this RJ45 connector with
equation shows that the noise will be abrogated. integrated magnetics.[14]
20 1
40 21
------------------------------------------------------------------------------------------------------------------
-- DATA
TCP-Header
------------------------------------------------------------------------------------------------------------------
-- MAC Header IP Header TCP/UDP-Header DATA data link layer
FCS
------------------------------------------------------------------------------------------------------------------
-- 100Mbit physical layer
JK TR
Idle Idle
Signal Preamble/SFD MAC IP TCP/UDP Data FCS
SSD ESD Signal
7+1Byte Header Header Header
To understand the Ethernet data stream, it is this to the upper or lower layer, depending upon
essential to know that each layer has its own whether the stack stays in receive or transmit
structure of headers and data. All implemented mode.
layers analyze or generate the header and passes
minFrameSize
slotTime
Invalid MAC Frame Field Name min max min w/o max w/o
If the MAC frame meets any of the following Size Size Preamble Preamble
conditions, it is considered to be invalid:
Preamble 7 7
The frame length is inconsistent with the SFD 1 1
length value specified in the length/type
DST 6 6 6 6
field. If the length/type field contains a type
value above 1536 (0x600), the frame length SRC 6 6 6 6
is assumed to be consistent with this field and Type/Length 2 2 2 2
should not be considered an invalid frame on
Data 46 1500 46 1500
this basis.
Checksum 4 4 4 4
It is not an integral number of octets in
length. Total 72 1526 64 1518
The bits of the incoming frame (exclusive of Table 8. Minimal and Maximal Byte Counts
the FCS field itself) do not generate a CRC The minimum size for a data packet sent
value identical to the one received. The over Ethernet 802.3u is 70 bytes, and
contents of invalid MAC frames shall not be the maximum size is 1524 bytes.
passed MAC Control sub-layers. The
occurrence of invalid MAC frames may be Figure 23 and Table 8 give an overview of the
communicated to network management.[12] traffic on the line. The calculation of the
minimum bytes is:
18 Bytes = MAC Header + Trailer
MAC IP TCP/UDP- Trailer
Header Header Header
DATA
The maximum calculation, Min Traffic, is:
18Bytes + Datamin = 18Bytes + 46Bytes
= 64Bytes
14Byte 20Byte 24Byte DATA 4Byte
The maximum calculation, Max Traffic is:
18Bytes + Data max = 18Bytes + 1500Bytes
= 1518Bytes
46Byte(min) ---------- 1500Byte (max)
This field indicates the next level protocol used Table 10. TCP States
in the data portion of the Internet datagram. The Figure 25 shows the TCP connecting state
values for various protocols are specified in diagram, which is described in RFC793. The
"Assigned Numbers".[12] arrows are the obligatory direction, and its
Header Checksum: 16 bits descriptions symbolize the control bits of the IP
header as shown in Figure 24. Only the control
This is a checksum on the header only. Since
bits and the correct acknowledge number gives
some header fields change (e.g., time to live),
the possibility to reach the next state. This
this is re-computed and verified at each point that
acknowledges number includes the IP header as
the Internet header is processed.
well.
Checksum Algorithm
The checksum field is the 16-bit one's
complement of the one's complement sum of all
16-bit words in the header.
Closed
Active open
send SYN
passive open close
close
rcv SYN Listen send
send SYN,ACK send SYN
SYN SYN
rcv SYN
Rcvd send Ack
Send
rcv ACK of SYN rcv SYN,ACK
The next section describes the principle of a the second message from "A" (confirming B's
handshake mechanism. ACK), "A" and "B" connect successfully. The
three-way handshake is used by TCP to establish
Three-Way Handshake connections and to terminate connections. When
hosts "A" and "B" want to communicate using
Most network protocols follow the classical TCP, they must establish a connection using the
three-way handshake to establish or terminate three-way handshake. Termination or closing a
connections over a not-so-reliable link. "A" connection is also executed using the three-way
initiates a connection to "B" by sending a handshake.
message. "B" responds with an acknowledgment.
At this point, "A" sends another message back to The hosts on either end identify their TCP
"B", confirming that "A" received the connection with the other using a combination of
acknowledgment from "B". When "B" receives IP-address and port number. Upon receiving the
Connection Setup
TCP uses the three-way-handshake to set up a
successful connection. When host "A" wants to
open a connection to host "B", "A" sends an
initial segment to "B". This initial segment has
the Initial Sequence Number (ISN) required by
"B" to send data to "A". This initial segment is Figure 27. Connection Release in TCP
identified by the SYN bit set to 1 in the TCP
Some TCP/IP stacks go a different way
header. If the SYN bit is set, the 32-bit sequence
for releasing the connection while
number in the header is interpreted as the ISN. In
sending a RESET bit. This cause the
all other cases (when the SYN bit is not set), the
command to release this connection and
32-bit sequence number identifies the sequence
move immediately to CLOSED state
number of the first data byte contained in that
again.
segment. Upon receiving the SYN from "A", "B"
must respond with another SYN, and
acknowledge the SYN sent by "A". This is TCP Timers
indicated by SYN+ACK in the state machine Timers are closely knit with the TCP states.
diagram. Some values, but not all, are specified by the
RFC. Some timers are left open to individual
implementations. This document will examine
timers relevant to the discussion, including
timers at connection establishment and timers at
connection termination.
Connection Establishment Timer
Checksum
Some useful hyperlinks that can help you design
Checksum is the 16-bit one's complement of the Ethernet applications follow:
one's complement sum of a pseudo header of
information from the IP header, the UDP header,
and the data, padded with zero octets at the end
(if necessary) to make a multiple of two octets.
Network Sniffer
This tool shows exactly the data of the networking traffic. It is ideal for people working with binaries.
- ETHEREAL
o http://www.ethereal.com , a free Windows und Unix software
- TCPDUMP
o http://www.tcpdump.org , a free network analyzer for Unix
- WINDUMP
o http://netgroup-serv.polito.it/windump/ , a free version of tcpdump for Windows machines
- ANALYZER
o http://analyzer.polito.it , a free Windows software (Netgroup, Pilotecnico di Torino)
Document History
Revision Description