Engineer-to-Engineer Note EE-269 - Analog

Transcription

Engineer-to-Engineer NoteaEE-269Technical notes on using Analog Devices DSPs, processors and development toolsContact our technical support at processor.support@analog.com and dsptools.support@analog.comOr visit our on-line resources http://www.analog.com/ee-notes and http://www.analog.com/processorsA Beginner’s Guide to Ethernet 802.3Contributed by Ralf NeuhausIntroductionThis EE-Note provides an overview of theEthernet specification and some popularprotocols that can be used “on top of” anEthernet driver. The goal is to provide the readerwith the fundamentals of the protocols and thehardware. The figures and explanations willprovide excellent guidance for anyone startingoff on Ethernet. This EE-Note does not show anysoftware implementations such as a TCP/IPstack, but will simplify their use.Additionally, this EE-Note serves as thetheoretical complement to the Ethernet MACchapter of the ADSP-BF537 Blackfin Processor Hardware Reference [16] and to theRev 1 – June 6, 2005EE-Note Ethernet Network Interface for ADSPBF535 Blackfin Processors (EE-214). [17]HistoryThe Ethernet Sourcebook, ed. Robyn E.Shotwell (New York: North-Holland, 1985), titlepage.When we talk about “Ethernet”, we refer to theimplementation methods of layer 1 and layer 2 ofthe Open Systems Interconnection model(OSI model).These layers form the physical layer for variousEthernet hardware implementations, while theother OSI layers are implemented in software. The diagram . wasdrawn by Dr. Robert M.Metcalfe in 1976 topresent Ethernet . to theNationalComputerConference in June ofthat year. On the drawingare the original terms fordescribingEthernet.Since then other termshave come into usageamongEthernetenthusiasts.'”Figure 1. Ethernet HistoryCopyright 2005, Analog Devices, Inc. All rights reserved. Analog Devices assumes no responsibility for customer product design or the use or application ofcustomers’ products or for any infringements of patents or rights of others which may result from Analog Devices assistance. All trademarks and logos are propertyof their respective holders. Information furnished by Analog Devices applications and development tools engineers is believed to be accurate and reliable, howeverno responsibility is assumed by Analog Devices regarding technical accuracy and topicality of the content provided in Analog Devices Engineer-to-Engineer Notes.

aOSI ModelThe OSI model provides a standard descriptionor "reference model" for how messages shouldbe transmitted between any two points in atelecommunication network.Layer7OSI modelTCP/IP Internet2Data LinkLayerNetwork1PhysicalLayerIt consists of seven layers and each layerdescribes the status of the communications, e.g.,Ethernet.Figure 2 compares the OSI model with theTCP/IP model and its protocols.TCP/IP n ControlProtocol TCPUser Data ProtocolUDPInternet Protocol IPEthernetIEEE 802.3twistedPairopticalfiberToken RingDQDBcoaxial cableFigure 2. Comparison between OSI and TCP/IP ModelsTCP/IP ModelThe TCP/IP model consists of four layers.Network LayerThe Network layer combines the Data Link layerand Physical layer, including the twisted paircable, the Physical layer device (PHY), and theEthernet Media Access Controller (MAC).Internet LayerThe Internet layer consists primarily of asoftware implementation. The IP header isevaluated or generated by software.UDP is a very simple protocol and is perfect forstreaming sequences (e.g., audio or video).TCP is a highly reliable host-to-host protocol fora controlled connection. TCP is appropriate forapplications that require guaranteed delivery.Application LayerThe Application layer includes all availablesoftware implementations (e.g., FTP, HTTP,SMTP, DNS, ) that make up the lower layers.These applications can work only in combinationwith the API of TCP or UDP, which form thesoftware implementation of the Transport layer.Transport LayerThe Transport layer defines what should be donewith the data. This layer is based on thefollowing two popular protocols:A Beginner’s Guide to Ethernet 802.3 (EE-269)TCP/IP ProtocolsThe third column of Figure 2 shows possibleways (combinations of sub protocols andPage 2 of 26

aphysical medium) to build a stack. For instance,FTP, HTTP, or SMTP applications can use TCP,IP, Ethernet IEEE 802.3, and the twisted-paircable as one way.10Mbit/s ---------10Base2 ----------10Base5 ----------10Base-T ----------FOIRL Æ 10Base-FThere are many more protocolsestablished as shown in Figure 2. --------------10Base-FB --------------10Base-FP --------------10Base-FLRFCs100Mbit/sRFCs (request for comments) are very popular in ----------100Base-T4the Ethernet community and form a type ofregulation system. RFCs describe many of theInternet protocols as well as standards,procedures, rules, algorithms, and strategies forthe communication and network area. An RFCstarts as a recommendation; after successfuldiscussion, it is then approved by the ion will be mostly accepted by themarket. For instance, decisions of the IAB(Internet Architecture Board) are alwayspublished as RCFs. ----------100Base-X --------------100Base-TX --------------100Base-FX1000Mbit/s ----------1000Base-T ----------1000Base-X --------------1000Base-SX --------------1000Base-LX --------------1000Base-CXlegend :2 thin coaxialS short wavelengthThe most important protocols are:5 thick coaxialL long wavelengthRFC 768 User Data ProtocolT twisted pairC short copper cableRFC 793 Transmission Control ProtocolF fiber opticsRFC 791 Internet ProtocolRFC 792 Internet Control Massage ProtocolRFC 826 Address Resolution ProtocolRFCs are one of the main ingredients whichcontribute to the success story of the Ethernet.Ethernet Family TreeThe Ethernet family tree (Figure 3) gives anoverview about the class with the reference to thetransport medium. This EE-Note described10Base-T and 100Base-TX Ethernet only.A Beginner’s Guide to Ethernet 802.3 (EE-269)FOIRL Fiber Optic Inter-Repeater LinkFigure 3. Ethernet Family TreeHardwareThis section goes deeper in the Physical and DataLink layer of the OSI model. It also describes theRJ45 jack, Magnetic, Power over Ethernet (PoE),and Media Independent Interface (MII) interface.All frequencies are shown in detail to provide thereader with a feeling of the signal chain in thePhysical layer and the Data Link layer.Page 3 of 26

aOverviewFigure 4 shows layer 1 and layer 2 in detail anddescribe all sub-layers of the PHY. For furtherinformation, refer to specification IEEE802.32002.Generally, PHYs work in layer 1, andEthernet MACs are placed in layer 2.depends on the medium only, such as 10BaseTand 100BaseTX (speed) or 100BaseTX and100BaseFX (twisted pair - optical), and so on.This EE-Note describes focuses on the 10BaseTand the 100BaseTX standards. These standardsuse the following coding mechanisms.10Mbit/s Manchester coding100Mbit/s 4B/5B codingManchester (PCS layer):802.3 Ethernet uses Manchester Phase Encoding(MPE) as the support medium for 10BaseTsystems.A data bit '1' from the level-encoded signal isrepresented by a full cycle of the inverted signalfrom the master clock, which matches with the '0'to '1' rise of the phase-encoded signal (i.e., -V inthe first half and V in the second half of thesignal.Figure 4. PHY and MAC Layer 100-Mbit Network*MII is optional for 10 Mb/s DTEs and for 100 Mb/s systems andis not specified for 1 Mb/s systems.** PMD is specified for 100BASE-X only; 100BASE-T4 does notuse this layer.*** AUTONEG is optional.The data bit '0' from the level-encoded signal isrepresented by a full normal cycle of the masterclock, which gives the '1' to '0' fall of the phaseencoded signal (i.e., V in the first half and -V inthe second half of the signal.The standard connection between the MAC andPHY is the Media Independent Interface (MII).MII Interface is described later in this documentafter the description of PHY tasks. For 10Mbit/snetworks, the PHY works with the Manchesterencode and decode mechanism. In 100-Mbit/snetworks, the supporting tasks are 4B/5B ted (NRZI) coding, and MLT-3conversion. Auto-Negotiation is based in theAUTONEG level and works all the time.Coding MethodsFigure 4 (PHY and MAC layer) shows layer 1 indetail, It includes the PCS, PMA, PMD, andAuto-Negotiation units. All these units aresupported by the PHY. The active componentA Beginner’s Guide to Ethernet 802.3 (EE-269)Figure 5. Manchester Phase EncodingPage 4 of 26

aFigure 5 shows how MPE operates. The exampleat the bottom of the diagram indicates how thedigital bit stream 10110 is encoded.A transition in the middle of each bit makes itpossible to synchronize the sender and receiver.At any instant, it can be in one of three states:transmitting a 0 bit (-0.85V), transmitting a 1 bit(0.85V) or idle (0 volts). Having a normal clocksignal as well as an inverted clock signal leads toregulartransitions,thismeansthatsynchronization of clocks is easily achieved evenif there are a series of 0s or 1s. This results inhighly reliable data transmission. The masterclock speed for Manchester encoding alwaysmatches the data speed. This determines thecarrier signal frequency; so, for 10Mbit/sEthernet, the carrier is 10 MHz.[11]NRZI (PMA Layer)With the introduction of the new 100Base-TXstandard, the coding method switched fromManchester coding to a non-return-tozero/inverted (NRZI) method.Logical 1s are now represented by signal edges.If the signal polarity does not alter, this indicatesa logical 0.With NRZI, a 1 bit is represented by either0 volts or V volts, depending on the previouslevel. If the previous voltage was 0 volts, the 1bit will be represented by V volts; however, ifthe previous voltage was V volts, the 1 bit willbe represented by 0 volts. A 0 bit is representedby whatever voltage level was used previously.This means that only a 1 bit can 'invert' thevoltage and a 0 bit has no effect on the voltage (itremains the same as the previous bit, whateverthat voltage was).This can be demonstrated in the followingexamples for the binary patterns 10110 and11111.A Beginner’s Guide to Ethernet 802.3 (EE-269)Figure 6. NRZI CodingNote that a '1' inverts the voltage, and a '0' leavesit where it is. This means that the encoding isdifferent for the same binary pattern, dependingon the voltage starting point.The bandwidth usage is minimized with NRZI,and frequent voltage changes are required forclock synchronization.With fiber, there are no issues with power output,enabling the use of a higher clock frequency.With copper, NRZI is not acceptable.[1]4B/5B Coding Method (PCS Layer)Obviously, the NRZI method causes less signaledges than Manchester coding. This condition iswelcome when increasing the bit rate from10Mbit/s to 100Mbit/s. Zero data has no signaledges, resulting in new challenges to the clocksynchronization at the receiver side.To guarantee a minimum of signal edge to thereceiver, the data is not converted into NRZIform directly. Rather, every 4-bit nibble isconverted into a 5-bit word first. The 5-bit wordsprovide 25 (32) different bit patterns rather thanjust 24 (16). As shown in Table 1, 16 patterns areused for data coding and seven more patternshave special meaning. Patterns with fewer thantwo 1s are not used at all. This so-called 4B/5Bcoding scheme guarantees at least two signaledges per 5-bit word.Page 5 of 26

aCode type4B CodeName5B tart of stream0101J11000Start of stream0101K10001End of streamundefinedT01101End of streamundefinedR00111Transmit errorundefinedH00111Invalid codeundefinedV00000Invalid codeundefinedV00001Invalid codeundefinedV00010Invalid codeundefinedV00011Invalid codeundefinedV00100Invalid codeundefinedV00101Invalid codeundefinedV00110Invalid codeundefinedV01000Invalid codeundefinedV10000Invalid codeundefinedV11001Table 1. 4B/5B CodingA Beginner’s Guide to Ethernet 802.3 (EE-269)If we use same procedure for the100Mbit/s system as used for the10Mbit/s system, the frequency wouldincrease up to 125 MHz because of theadditional 5th of the 4B/5B encoding.The additional implementation of theNon-Return-to-Zero/Inverted(NRZI)feature reduces the maximum frequencyto 62.5 MHz.Figure 10 shows an overview of allpossible frequencies (theoretical PHYblock diagram in 100Base-TX mode).The data sequence in Figure 7 shows the bitconstellation without transformation andscrambling (i.e., without any alterations).Due to the changes from 4- to 5-bit data, we getadditional groups. These groups are either 16data (from 0 to F) or commands with names fromI to H (see Table 1). All other 5-bit combinationsare invalid codes with the name V. Some may bereserved candidates to represent new codes in thefuture.Start of Stream and End of StreamThe 10Mbit Ethernet does not recognize anyother bit constellations as data, except the Startof Frame Delimiter command (SFD). With100Mbit Ethernet, there are more controlcommands present (see Table 1) with thepossibility to reduce the dc portions whilesending idle symbols “1111” to the lines. Fordeclaration of the valid data packet, the “start ofstream” and “end of stream” commands will beembedded all the time. The gain is less dcportions on the line and the idle symbols willused for synchronizations. Figure 7 shows thecomplete data stream on the line, with idlesymbols, start of stream (SSD), preamble withSFD, data on the MAC layer, and the end ofstream data (ESD).[1]Page 6 of 26

DPreamble/SFD7 yteData46 - 1500 ByteESDIdleSignalData MAC layerData on the lineFigure 7. Bytes on the Line, 100Mbit/sMLT3 and Scrambling (PMD Layer)The 100Base-TX transfers data with MultilevelThreshold-3 (MLT3) mechanism at the line.Three values ( 1, 0, and -.1) are possible to codefrom NRZI signal and vice versa. The benefit ofthe MLT3 method is to half the NRZI transferfrequency from 62.5 MHz to 31.25 MHz.In 100Base-TX transmission requires scramblingto reduce the radiated emissions on the twistedpair cable, but Scrambler and Descrambler aredisabled for 10Base-T operation.[18]The side-stream scrambler polynomials aregenerated by the Physical Medium Depend(PMD) and has the following equationsgM (x) 1 x13 x33 for mastergM (x) 1 x20 x33 for slaveThe implementation of master and slave PHYside-stream scramblers is made possible by usinga linear-feedback shift register. For animplementation of this feature, refer to the datasheet of your favorite PHY.[12]Comparing Manchester Code, 4B/5B Code, andMLT-3All bits will be transformed with NRZI,MLT-3, and scrambling methods;therefore, you cannot measure this (e.g.,with an oscilloscope) at the line.A Beginner’s Guide to Ethernet 802.3 RZIand MLT-30-AFigure 8. Manchester vs. NRZI-Code [9]The Manchester code changes its value aftereach bit of the signal. The NRZI code does thesame with its limited subsequent numbers ofzeros changes the bit deterministic. The 4B/5Bitcoding method used only two subsequent zerosexempted “Start of Stream” (see Table 1).The combination of the NRZI and MLT-3methods reduces the frequency once more, sothat the maximum frequency goes down to31.25 MHz.With the behavior of these coding methods, aclock recovery is always possible. Thus, for10/100Mbit/s networks (Manchester or 4B/5Bwith MLT-3), no additionally clock sources arenecessary.Page 7 of 26

aOne of the most common causes ofperformance issues on 10/100Mbit/sEthernet links is when one port on thelink operates at half-duplex while theother port operates at full-duplex.CSMA/CDCSMA/CD is supported by the PHY and isrequired for networking in case of multipleaccesses. CS carrier sense MA multiple access CD Collision detectionCarrier sense controls the line if there is traffic. IfCS detects the line as free, data transfer can bestarted.If other devices started at the same time, MA isdesigned to yield a stable network. The Ethernetnetwork was designed such that multipleaccesses are normal.CD detects this multiple access, waits a time(random number), and gives the command torestart the procedure of a new data transfer.Modes: Half Duplex and Full DuplexHalf DuplexHalf duplex is a mode of operation withCSMA/CD support of a local area network(LAN) in which Data Terminal Equipment(DTEs) contend for access to a shared medium.Multiple, simultaneous transmissions in a halfduplex mode CSMA/CD LAN result ininterference, which requires resolution by theCSMA/CD access control protocol.provided that the Physical Layer is capable ofsupporting simultaneous transmission e different modes are described in these IEEEspecifications:Half-Duplex: 10 MBit/s(IEEE 802.3)Full-Duplex: 100 MBit/s(IEEE 802.3u)Full-Duplex: Gigabit-Ethernet (IEEE 802.3ab)is Full-Duplex transfer with allfour pairsAuto-NegotiationThe Auto-Negotiation function automaticallyconfigures the PHY to optimal link parametersbased on the capabilities of its link partners.[15]The twisted-pair Auto-Negotiation systemdefined in Clause 28 of the standard 802.3-2002has since been extended to include all threespeeds of Ethernet supported over twisted-paircable: 10Mbit/s 10Base-T, 100Mbit/s 100BaseTX and 1000 Mbit/s 1000Base-T. The physicalsignaling portion of all three twisted-pair systemsuses the same Auto-Negotiation signalingstandard. While Auto-Negotiation can bedisabled on 10Base-T and 100Base-TX links, itis required on 1000Base-T systems since GigabitEthernet systems use Auto-Negotiation toestablish the master-slave signal timing controlrequired to make the link operational.NLP’sFLPFull DuplexFull duplex is a mode of operation of a networkor Physical Medium Attachment (PMA) thatsupports duplex transmission as defined in IEEE100. Within the scope of this standard, this modeofoperationallowsforsimultaneouscommunication between a pair of stations,A Beginner’s Guide to Ethernet 802.3 (EE-269)Figure 9. Link PulsesWith Auto-Negotiation in place, all three speedsof twisted-pair Ethernet can determine thecommon set of options supported between a pairof "link partners". Twisted-pair link partners canPage 8 of 26

ause Auto-Negotiation to figure out the highestspeed that they each support, for example, aswell as automatically setting full-duplexoperation if both ends support that mode.Auto-Negotiation takes place using Fast LinkPulse (FLP) signals. These signals are a modifiedversion of the Normal Link Pulse (NLP) signalsused to verify link integrity. The FLP signals aregenerated automatically at power-up, or may beselected manually through the managementinterface to an Auto-Negotiation device. TheFLP signals are used to send information aboutdevice capabilities. The Auto-Negotiationprotocol contains rules for device configurationbased on this information.[10]Auto-Negotiation PriorityIf two Auto-Negotiation devices with multiplecapabilities are connected together, they findtheir highest performance mode of operationbased on a priority Table 2, because bothvariants are compatible with the first pulse.The priorities are listed in Table 2 and are rankedfrom the highest to the lowest. The full-duplexmode of operation is given higher priority thanthe original (half-duplex) Ethernet, since a fullduplex system can send more data than a halfduplex link operating at the same speed.Therefore, if the devices at both ends of the linkcan support full-duplex operation, and if theyalso both support Auto-Negotiation of thisA Beginner’s Guide to Ethernet 802.3 (EE-269)capability, they will au

carrier signal frequency; so, for 10Mbit/s Ethernet, the carrier is 10 MHz.[11] NRZI (PMA Layer) With the introduction of the new 100Base-TX standard, the coding method switched from Manchester coding to a non-return-to-zero/inverted (NRZI) method. Logical 1s are now represented by signal edges. If the signal polarity does not alter, this indicatesFile Size: 447KB