Technical Note TN_157 Ethernet Explained Version 1.0 Issue Date: 2015-03-23 The FTDI FT900 32 bit MCU series, provides for high data rate, computationally intensive data transfers. One of the interfaces used for this high speed communication is Ethernet. This application note discusses some of the key features of an Ethernet link and how the FT900 assists in establishing the link. Use of FTDI devices in life support and/or safety applications is entirely at the user’s risk, and the user agrees to defend, indemnify and hold FTDI harmless from any and all damages, claims, suits or expense resulting from such use. Future Technology Devices International Limited (FTDI) Unit 1, 2 Seaward Place, Glasgow G41 1HH, United Kingdom Tel.: +44 (0) 141 429 2777 Fax: + 44 (0) 141 429 2758 Web Site: http://ftdichip.com Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 Clearance No.: FTDI# 442 Table of Contents 1 Introduction .................................................................................................................................... 3 1.1 2 What is Ethernet? ........................................................................................................................... 4 2.1 Speeds ..................................................................................................................................... 4 2.2 Connections ............................................................................................................................ 5 2.2.1 The Ethernet Media Access Controller (MAC) ................................................................ 5 2.2.2 The Ethernet Physical Layer (PHY) .................................................................................. 5 2.2.3 Magnetics ........................................................................................................................ 5 2.2.4 RJ45 connector ................................................................................................................ 5 2.2.5 FTDI MCU Ethernet Connections .................................................................................... 6 2.3 Addressing............................................................................................................................... 7 2.3.1 MAC Address ................................................................................................................... 7 2.3.2 IP Address........................................................................................................................ 7 2.4 Network Control ..................................................................................................................... 8 2.4.1 CSMA/CD ......................................................................................................................... 8 2.4.2 Hub .................................................................................................................................. 8 2.4.3 Bridges and Switches ...................................................................................................... 8 2.4.4 Collision and Broadcast Domains .................................................................................... 8 2.5 3 Scope ....................................................................................................................................... 3 Ethernet Frame ..................................................................................................................... 10 Protocols ....................................................................................................................................... 11 3.1 Transmission Control Protocol / Internet Protocol (TCP/IP) ................................................ 11 3.2 User Datagram Protocol (UDP) ............................................................................................. 11 4 FT900 Ethernet Controller ............................................................................................................ 12 5 Contact Information...................................................................................................................... 13 Appendix A – References ...................................................................................................................... 14 Document References....................................................................................................................... 14 FT900 Datasheet ............................................................................................................................... 14 Acronyms and Abbreviations ............................................................................................................ 14 Appendix B – List of Tables & Figures ................................................................................................... 15 Product Page Document Feedback 1 Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 Clearance No.: FTDI# 442 List of Tables ..................................................................................................................................... 15 List of Figures .................................................................................................................................... 15 Appendix C – Revision History .............................................................................................................. 16 Product Page Document Feedback 2 Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 Clearance No.: FTDI# 442 1 Introduction The FTDI FT900, 32 bit MCU series, provides for high data rate, computationally intensive data transfers. The devices contain a variety of high speed interfaces including Ethernet, CAN BUS, Camera I/F, DACs and ADCs. This document will explore the details of an Ethernet link. 1.1 Scope This application note discusses some of the key features of an Ethernet link and how the FT900 assists in establishing the link. Product Page Document Feedback 3 Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 Clearance No.: FTDI# 442 2 What is Ethernet? Ethernet is a full duplex serial data protocol over twisted pair wires (or wireless). The data may be transmitted to many devices over a network or peer to peer. FTDI FT900 MCU supports full-duplex and half-duplex modes. CSMA/CD protocol for half-duplex operation. IEEE 802.3x flow control for full-duplex operation. 2.1 Speeds Currently there are 3 main speed variants for Ethernet traffic: 10Base-T: 10 Mbit/s 100Base-TX: 100 Mbit/s also referred to as fast Ethernet. 1000Base-T: 1GBit/s also referred to as gigabit Ethernet FTDI FT900 MCU supports 10/100 Mbit/s transfer speeds. Product Page Document Feedback 4 Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 Clearance No.: FTDI# 442 2.2 Connections The MAC and PHY blocks are onchip on the FT900. Figure 2.1 Ethernet Link 2.2.1 The Ethernet Media Access Controller (MAC) The Ethernet media access controller is responsible for managing all data packets that are to be sent and received over a network. The controller is driven by the system software and handles all the addressing and data packetizing. The controller connects directly with the PHY. With the FT900, the link is established via a Media Independent Interface (MII), which is an internal 4-bit wide bi-directional bus (4 transmit data bits, 4 receive data bits) 2.2.2 The Ethernet Physical Layer (PHY) The Ethernet Physical Layer (PHY) is responsible for the physical link between the Ethernet controller and the network. This layer is onchip on the FT900 so only the differential signals are available at pin level. 2.2.3 Magnetics The magnetics allow different nodes on the Ethernet network to connect over long distances. It removes any connection issues created by different ground offsets at different nodes. Figure 2.2 Magnetics The turns ratio on the coils is typically 1:1. 2.2.4 RJ45 connector The RJ45 connector is a standard connector format for Ethernet link. It allows for a similar approach to cabling up USB, whereby standard connectors, with a standard pinout are used at each node. Product Page Document Feedback 5 Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 PIN 10Base-T Signal 100Base-T Signal 1 TX+ TX+ 2 TX- TX- 3 RX+ RX+ 4 nc nc 5 nc nc 6 RX- RX- 7 nc nc 8 nc nc Clearance No.: FTDI# 442 Table 2-1 RJ45 Female Connector Pinout 2.2.5 FTDI FT900 Ethernet Connections 2.2.5.1 RXIP Ethernet receive data input positive. Differential received signal pair. 2.2.5.2 RXIN Ethernet receive data input negative. Differential received signal pair. 2.2.5.3 TXOP Ethernet transmit data output positive. Differential transmitted signal pair. 2.2.5.4 TXON Ethernet transmit data output negative. Differential transmitted signal pair. 2.2.5.5 RREFSET Ethernet reference voltage input. Connect 12.3Kohm +/- 1% resistor to GND. 2.2.5.6 ENET_LED0 Ethernet activity indicator LED 0. The source can be configured via the Ethernet PHY Miscellaneous Configuration Register. 2.2.5.7 ENET_LED1 Ethernet activity indicator LED 1. The source can be configured via the Ethernet PHY Miscellaneous Configuration Register. Product Page Document Feedback 6 Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 Clearance No.: FTDI# 442 2.3 Addressing 2.3.1 MAC Address Every Ethernet controller has a unique MAC address to ensure it can be independently identified. The MAC address is 6 bytes in length with the first 3 bytes identifying the Ethernet controller manufacturer. These 3 bytes are controlled and issued by the IEEE Registration Authority. The format of the MAC address is: MM::MM::MM::SS::SS::SS MM identifies the manufacturer. For example, A0-48-1C is Hewlett Packard. SS identifies a device serial number and is a unique number. There are 224 combinations. The MAC address on FTDI FT900 MCU is programmable. 2.3.2 IP Address The IP address assigned to a device is used to identify it on a TCP/IP network. As with the MAC address different elements have specific meaning. The basic format is for a 32 bit number split into 4 octets (1 octet = 1 byte) and typically displayed as a series of decimal numbers from 0-255, e.g. 192.168.0.1 is commonly used for accessing Wi-Fi router configuration pages. The first 8 bits define a network class, while the remaining elements define the host within the network. Class Description Leading Bit values Start address A Usually reserved for government agencies and large companies 0 0.0.0.0 (00000000.x.x.x) Loopback Loopback address. The host computer can send a message back to itself 0111 1111 B Used for medium-sized networks 10 128.0.0.0 (10000000.x.x.x) C Commonly used for small to mid-size networks 110 192.0.0.0 (11000000.x.x.x) D Used for multicasts 1110 E Used for experimental purposes only 1111 240.0.0.0 Broadcast Messages that are intended for all computers on a network 11111111 255.255.255.255 127.0.0.1 (01111111.0.0.1) 224.0.0.0 (11100000.x.x.x) Table 2-2 IP Classes Product Page Document Feedback 7 Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 Clearance No.: FTDI# 442 2.4 Network Control 2.4.1 CSMA/CD Ethernet protocol regulates communication among nodes via Carrier Sense Multiple Access / Collision Detect (CSMA / CD) which is required as multiple devices can be connected on the same wires. To allow for successful communication, each node ‘listens’ to determine if the network is busy before establishing a link. It also listens to its own message while transmitting and can detect if another node started transmitting at the same time since the message would not match what was sent. When nodes detect a collision, they stop transmission, wait for a random amount of time and attempt to retransmit when the network is ready ie no other transmissions. 2.4.2 Hub An Ethernet hub is a device for connecting multiple Ethernet devices together and making them act as a single network segment. 2.4.3 Bridges and Switches To avoid congestion problems as networks increase in size, network switches and bridges can be added which can filter or repeat messages from multiple segments with the goal of reducing unnecessary traffic in a particular segment. It does this by examining the destination address of the frame before deciding how to handle it. In the figure below, if A transmits to B, the bridge receives the message and blocks or filters it from segment 2. If A transmits to C, the bridge will transmit or forward the frame to segment 2. 2.4.4 Collision and Broadcast Domains A collision domain is a part of a network where packet collisions can occur. A collision occurs when two devices send a packet at the same time on the shared network segment. The packets collide and both devices must send the packets again, which reduces network efficiency. Collisions are often in a hub environment, because each port on a hub is in the same collision domain. By contrast, each port on a bridge, a switch or a router is in a separate collision domain. A broadcast domain is a domain in which a broadcast is forwarded. A broadcast domain contains all devices that can reach each other at the data link layer by using broadcast. All ports on a hub or a switch are by default in the same broadcast domain. All ports on a router are in the different broadcast domains and routers don't forward broadcasts from one broadcast domain to another. The table below shows what effect a collision and broadcast domain on each device has. Collision Domain Broadcast Domain Ethernet Hub Continues Continues Ethernet Switch / Bridge Ends Continues Router Ends Ends Firewall Ends Ends Table 2-3 Collision and Broadcast Domains The figure below shows an example network. Note that Segment 1 and Segment 2 are on two separate collision domains because of the Bridge / Switch. Product Page Document Feedback 8 Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 Station A Clearance No.: FTDI# 442 Station C Bridge / Switch Hub Hub Station D Station B Segment 1 Segment 2 Figure 2.3 Ethernet Network Example Product Page Document Feedback 9 Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 Clearance No.: FTDI# 442 2.5 Ethernet Frame A data packet on an Ethernet link transports an Ethernet frame. The internal structure of an Ethernet frame is specified in IEEE 802.3-2012. Layer Preamble Start of Frame Delimiter MAC Dest. MAC Source 802.1Q Tag (optional) Length Payload Frame Check (32 bit CRC) Interpacket Gap 7 octets 1 octet 6 octets 6 octets 4 octets 2 octets 1500 octets max 4 octets 12 octets Layer 2 Frame Layer 1 Packet Table 2-4 Ethernet Frame Structure The table below describes the frame entries. Field Description Preamble Consists of a pattern of alternating 1 and 0 bits, which allows devices on the network to easily detect a new incoming frame Start of Frame Delimiter Marks the end of the preamble MAC Destination Destination MAC address MAC Source Source MAC address Length Indicates the size of the payload Payload The minimum payload is 42 octets when an 802.1Q tag is present and 46 octets when absent. The maximum payload is 1500 octets. Frame Check 32 bit CRC which allows detection of corrupted data within the entire frame. Interpacket gap Idle state time between packets. Table 2-5 Ethernet Frame Field Description Product Page Document Feedback 10 Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 Clearance No.: FTDI# 442 3 Protocols The Ethernet protocol specifies a set of rules for constructing frames, as discussed in the previous section. The transport layer is responsible for delivering data and establishes the concept of the port which is associated with an IP address of the host, as well as the type of protocol used for communication. The protocols that primarily use ports are discussed in this section. The table below gives an idea of port number and associated functionality. Port Range Port Functionality 0-1023 Common, well-known services 1024-49151 Registered ports used for Internet Assigned Numbers Authority (IANA)registered services 49152-65535 Can be used for any purpose Table 3-1 Ethernet Port Functionality 3.1 Transmission Control Protocol / Internet Protocol (TCP/IP) TCP is a connection-oriented protocol like a datastream and is used for many application layer protocols, including HTTP web browsing and email transfer. TCP is the more complex Internet Protocol incorporating reliable transmission and data stream services with flow and congestion control. It can detect network problems such as lost or duplicated and request re-transmission, and re-arrange out-of-order packets. Handshaking and acknowledgement is performed between nodes. The TCP header consists of: Source / Destination Port numbers Sequence Number Acknowledgement Number Header Size Control Flags Window Size Checksum for data integrity Applications include web browsers, email, FTP and peer-to-peer file sharing. 3.2 User Datagram Protocol (UDP) UDP is known as a connection-less protocol, where no prior communications is required to set up transmission channels or data paths. The delivery, arrival time, and order of arrival are not guaranteed by the network. UDP is generally used for simpler messaging transmissions with less reliability and typically gives higher throughput and shorter latency. The UDP header consists of Source / Destination Port numbers Data Length Checksum for data integrity Applications include Voice Over IP, streaming media applications and online games Product Page Document Feedback 11 Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 Clearance No.: FTDI# 442 4 FT900 Ethernet Controller The FT900 contains an Ethernet media access controller and PHY capable of supporting Ethernet protocols upto and including 10/100Base-TX. The controller is compatible with the IEEE 802.32002 specification and connects directly to the magnetics and RJ45. Using the FT900 solution will provide users with access to fast Ethernet data channels and bridge to other fast interfaces supplied in the device such as the parallel camera interface or CAN bus controllers to enable a wide variety of peripherals to be accessed via Ethernet. Additionally the FT900 Ethernet Controller supports double buffering for 2kB TX and 2kB RX memory, and promiscuous mode support to allow network activity to be monitored. Product Page Document Feedback 12 Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 Clearance No.: FTDI# 442 5 Contact Information Head Office – Glasgow, UK Branch Office – Tigard, Oregon, USA Future Technology Devices International Limited Unit 1, 2 Seaward Place, Centurion Business Park Glasgow G41 1HH United Kingdom Tel: +44 (0) 141 429 2777 Fax: +44 (0) 141 429 2758 Future Technology Devices International Limited (USA) 7130 SW Fir Loop Tigard, OR 97223-8160 USA Tel: +1 (503) 547 0988 Fax: +1 (503) 547 0987 E-mail (Sales) E-mail (Support) E-mail (General Enquiries) [email protected] [email protected] [email protected] E-Mail (Sales) E-Mail (Support) E-Mail (General Enquiries) [email protected] [email protected] [email protected] Branch Office – Taipei, Taiwan Branch Office – Shanghai, China Future Technology Devices International Limited (Taiwan) 2F, No. 516, Sec. 1, NeiHu Road Taipei 114 Taiwan , R.O.C. Tel: +886 (0) 2 8791 3570 Fax: +886 (0) 2 8791 3576 Future Technology Devices International Limited (China) Room 1103, No. 666 West Huaihai Road, Shanghai, 200052 China Tel: +86 21 62351596 Fax: +86 21 62351595 E-mail (Sales) E-mail (Support) E-mail (General Enquiries) E-mail (Sales) E-mail (Support) E-mail (General Enquiries) [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] Web Site http://ftdichip.com System and equipment manufacturers and designers are responsible to ensure that their systems, and any Future Technology Devices International Ltd (FTDI) devices incorporated in their systems, meet all applicable safety, regulatory and system-level performance requirements. All application-related information in this document (including application descriptions, suggested FTDI devices and other materials) is provided for reference only. While FTDI has taken care to assure it is accurate, this information is subject to customer confirmation, and FTDI disclaims all liability for system designs and for any applications assistance provided by FTDI. Use of FTDI devices in life support and/or safety applications is entirely at the user’s risk, and the user agrees to defend, indemnify and hold harmless FTDI from any and all damages, claims, suits or expense resulting from such use. This document is subject to change without notice. No freedom to use patents or other intellectual property rights is implied by the publication of this document. Neither the whole nor any part of the information contained in, or the product described in this document, may be adapted or reproduced in any material or electronic form without the prior written consent of the copyright holder. Future Technology Devices International Ltd, Unit 1, 2 Seaward Place, Centurion Business Park, Glasgow G41 1HH, United Kingdom. Scotland Registered Company Number: SC136640 Product Page Document Feedback 13 Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 Clearance No.: FTDI# 442 Appendix A – References Document References FT900 Datasheet Acronyms and Abbreviations Terms Description MAC Media Access Controller PHY Physical Layer MCU Micro Controller Unit IP CSMA CD TCP/IP UDP Mbit/s Internet Protocol Carrier Sense Multiple Access Collision Detection Transmission Control Protocol/Internet Protocol User Datagram Protocol Network transfer speed Mega bits per second MII Media Independent Interface USB Universal Serial Bus TX Transmit RX Receive GND Ground LED Light Emitting Diode Wi-Fi Wireless Fidelity CRC Cyclic Redundancy Check IANA Internet Assigned Numbers Authority HTTP Hypertext Transfer Protocol FTP File Transfer Protocol IEEE Institute of Electrical and Electronics Engineers Product Page Document Feedback 14 Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 Clearance No.: FTDI# 442 Appendix B – List of Tables & Figures List of Tables Table 2-1 RJ45 Female Connector Pinout ............................................................................... 6 Table 2-2 IP Classes ............................................................................................................ 7 Table 2-3 Collision and Broadcast Domains ............................................................................ 8 Table 2-4 Ethernet Frame Structure .................................................................................... 10 Table 2-5 Ethernet Frame Field Description .......................................................................... 10 Table 3-1 Ethernet Port Functionality ................................................................................... 11 List of Figures Figure 2.1 Ethernet Link ...................................................................................................... 5 Figure 2.2 Magnetics ........................................................................................................... 5 Figure 2.3 Ethernet Network Example .................................................................................... 9 Product Page Document Feedback 15 Copyright © 2015 Future Technology Devices International Limited Technical Note TN_157 Ethernet Explained Version 1.0 Document Reference No.: FT_001105 Clearance No.: FTDI# 442 Appendix C – Revision History Document Title: TN_157 Ethernet Explained Document Reference No.: FT_001105 Clearance No.: FTDI# 442 Product Page: http://www.ftdichip.com/FTProducts.htm Document Feedback: Send Feedback Revision Changes Date 0.1 Draft 2014-08-13 1.0 Version Release 2015-03-23 Product Page Document Feedback 16 Copyright © 2015 Future Technology Devices International Limited