Normally, the host controller does not need to concern itself with padding and the CRC which the hardware EMAC will also be able to automatically generate when transmitting and verify when receiving. Otherwise, the host controller must generate the CRC and place it in the transmit buffer. Given the complexity of calculating a CRC, the hardware normally will automatically generate a valid CRC and transmit it. The FCS field is a 4-byte field which contains an industry standard 32-bit CRC calculated with the data from the DA, SA, type, payload and padding fields. If the data field is less than 46 bytes long, a padding field is required. The DA, SA, type, payload and padding of an Ethernet packet must be no smaller than 60 bytes.Īdding the required 4-byte FCS field, packets must be no smaller than 64 bytes. The padding field is a variable length field added to meet IEEE 802.3 specification requirements when small data payloads are used. This field contains the client data, such as an IP datagram. Larger data packets will violate Ethernet standards and will be dropped by most Ethernet nodes. The payload field is a variable length field, anywhere from 0 to 1500 bytes. Users implementing proprietary networks may choose to treat this field as a length field, while applications implementing protocols such as the Internet Protocol (IP) or Address Resolution Protocol (ARP), should program this field with the appropriate type defined by the protocol’s specification when transmitting packets. The following are the most common type values: The type/length field is a 2-byte field, if the value in this field is = 1536, it represents the protocol the following packet data belongs to.
#Mac ethernet drivers mac
When transmitting packets, the assigned source MAC address must be written into the transmit buffer by the host controller. More information about MAC Address used in ESP-IDF, please see MAC Address Allocation. The last three bytes are address bytes at the discretion of the company that purchased the OUI. The first three bytes are known as the Organizationally Unique Identifier (OUI). Users of Ethernet must generate a unique MAC address for each controller used. The source address field contains a 6-byte length MAC address of the node which created the Ethernet packet. When transmitting packets, the host controller is responsible for writing the desired destination address into the transmit buffer. Normally the EMAC controller incorporates receive filters which can be used to discard or accept packets with multi-cast, broadcast and/or uni-cast destination addresses. If the Least Significant bit in the first byte of the MAC address is clear, the address is a uni-cast address and will be designed for usage by only the addressed node. FF-FF-FF-FF-FF-FF, the packet is a broadcast packet and it will be directed to everyone sharing the network. If the destination address field is the reserved multi-cast address, i.e. Packets with multi-cast destination addresses are designed to arrive and be important to a selected group of Ethernet nodes. If the Least Significant bit in the first byte of the MAC address is set, the address is a multi-cast destination.įor example, 01-00-00-00-F0-00 and 33-45-67-89-AB-CD are multi-cast addresses, while 00-00-00-00-F0-00 and 32-45-67-89-AB-CD are not. The destination address field contains a 6-byte length MAC address of the device that the packet is directed to. When transmitting and receiving data, the preamble and SFD bytes will automatically be generated or stripped from the packets. It is sometimes considered to be part of the preamble. The Start-of-Frame Delimiter (SFD) is a binary sequence 10101011 (as seen on the physical medium). The preamble contains seven bytes of 55H, it allows the receiver to lock onto the stream of data before the actual frame arrives. Thus the traffic on the twist-pair cabling will appear as shown blow:Įthernet Data Frame Format Preamble and Start-of-Frame Delimiter They are made up of five or six different fields: a destination MAC address (DA), a source MAC address (SA), a type/length field, data payload, an optional padding field and a Cyclic Redundancy Check (CRC).Īdditionally, when transmitted on the Ethernet medium, a 7-byte preamble field and Start-of-Frame (SOF) delimiter byte are appended to the beginning of the Ethernet packet. Normal IEEE 802.3 compliant Ethernet frames are between bytes in length. However, with ubiquitous deployment, internet connectivity, high data rates and limitless rage expandability, Ethernet can accommodate nearly all wired communications. It is generally not well suited for low power applications. Ethernet is an asynchronous Carrier Sense Multiple Access with Collision Detect (CSMA/CD) protocol/interface.