42. Ethernet (ETH): media access control (MAC) with DMA controller

42.1 Ethernet introduction

Portions Copyright (c) 2004, 2005 Synopsys, Inc. All rights reserved. Used with permission.

The Ethernet peripheral enables the STM32F76xxx and STM32F77xxx to transmit and receive data over Ethernet in compliance with the IEEE 802.3-2002 standard.

The Ethernet provides a configurable, flexible peripheral to meet the needs of various applications and customers. It supports two industry standard interfaces to the external physical layer (PHY): the default media independent interface (MII) defined in the IEEE 802.3 specifications and the reduced media independent interface (RMII). It can be used in number of applications such as switches, network interface cards, etc.

The Ethernet is compliant with the following standards:

42.2 Ethernet main features

The Ethernet (ETH) peripheral includes the following features, listed by category:

42.2.1 MAC core features

Store-and-Forward mode

42.2.2 DMA features

42.2.3 PTP features

42.3 Ethernet pins

The table below shows the MAC signals and the corresponding MII/RMII signal mapping. All MAC signals are mapped onto AF11, some signals are mapped onto different I/O pins, and must be configured in Alternate function mode (for more details, refer to Section 6.3.2: I/O pin alternate function multiplexer and mapping and the corresponding datasheet).

Table 309. Alternate function mapping

AF11
ETH
ETH_MII_CRS
ETH_MII_RX_CLK / ETH_RMII_REF_CLK
ETH_MDIO
ETH_MII_COL
ETH_MII_RX_DV / ETH_RMII_CRS_DV
ETH_MII_RXD2
ETH_MII_RXD3
ETH_PPS_OUT
ETH_MII_TXD3
ETH_MII_RX_ER
ETH_MII_TX_EN / ETH_RMII_TX_EN
ETH_MII_TXD0 / ETH_RMII_TXD0
ETH_MII_TXD1 / ETH_RMII_TXD1
ETH_MDC
ETH_MII_TXD2
ETH_MII_TX_CLK
ETH_MII_RXD0 / ETH_RMII_RXD0
ETH_MII_RXD1 / ETH_RMII_RXD1
ETH_MII_TXD3
ETH_PPS_OUT
ETH_MII_TX_EN / ETH_RMII_TX_EN
ETH_MII_TXD0 / ETH_RMII_TXD0
ETH_MII_TXD1 / ETH_RMII_TXD1
ETH_MII_CRS
ETH_MII_COL
ETH_MII_RXD2
ETH_MII_RXD3
ETH_MII_RX_ER

42.4 Ethernet functional description: SMI, MII and RMII

The Ethernet peripheral consists of a MAC 802.3 (media access control) with a dedicated DMA controller. It supports both default media-independent interface (MII) and reduced media-independent interface (RMII) through one selection bit (refer to SYSCFG_PMC register).

The DMA controller interfaces with the Core and memories through the AHB Master and Slave interfaces. The AHB Master Interface controls data transfers while the AHB Slave interface accesses Control and Status Registers (CSR) space.

The Transmit FIFO (Tx FIFO) buffers data read from system memory by the DMA before transmission by the MAC Core. Similarly, the Receive FIFO (Rx FIFO) stores the Ethernet frames received from the line until they are transferred to system memory by the DMA.

The Ethernet peripheral also includes an SMI to communicate with external PHY. A set of configuration registers permit the user to select the desired mode and features for the MAC and the DMA controller.

Note: The AHB clock frequency must be at least 25 MHz when the Ethernet is used.

Figure 536. ETH block diagram

Figure 536. ETH block diagram. This block diagram illustrates the internal architecture of the Ethernet peripheral. On the left, an 'AHB Slave interface' connects to 'DMA control & status registers' and 'Operation mode register'. Below these, a 'Bus matrix' connects to an 'Ethernet DMA'. The DMA is linked to '2 Kbyte RX FIFO' and '2 Kbyte TX FIFO'. These FIFOs connect to a central 'Media access control MAC 802.3' block, which also contains 'MAC control registers', 'Checksum offload', 'PTP IEEE1588', 'PMT', and 'MMC'. To the right of the MAC, an 'RMII Interface' and 'MII' (indicated by an arrow) connect to a 'Select' block. The 'Select' block connects to an 'External PHY'. The 'External PHY' is also connected to the 'MAC control registers' via 'MDC' and 'MDIO' lines. The diagram is labeled 'ai15620c' in the bottom right corner.
Figure 536. ETH block diagram. This block diagram illustrates the internal architecture of the Ethernet peripheral. On the left, an 'AHB Slave interface' connects to 'DMA control & status registers' and 'Operation mode register'. Below these, a 'Bus matrix' connects to an 'Ethernet DMA'. The DMA is linked to '2 Kbyte RX FIFO' and '2 Kbyte TX FIFO'. These FIFOs connect to a central 'Media access control MAC 802.3' block, which also contains 'MAC control registers', 'Checksum offload', 'PTP IEEE1588', 'PMT', and 'MMC'. To the right of the MAC, an 'RMII Interface' and 'MII' (indicated by an arrow) connect to a 'Select' block. The 'Select' block connects to an 'External PHY'. The 'External PHY' is also connected to the 'MAC control registers' via 'MDC' and 'MDIO' lines. The diagram is labeled 'ai15620c' in the bottom right corner.
  1. 1. For AHB connections refer to Figure 1: System architecture .

42.4.1 Station management interface: SMI

The station management interface (SMI) allows the application to access any PHY registers through a 2-wire clock and data lines. The interface supports accessing up to 32 PHYs.

The application can select one of the 32 PHYs and one of the 32 registers within any PHY and send control data or receive status information. Only one register in one PHY can be addressed at any given time.

Both the MDC clock line and the MDIO data line are implemented as alternate function I/O in the microcontroller:

160 ns each, and the minimum period for MDC must be 400 ns. In idle state the SMI management interface drives the MDC clock signal low.

Figure 537. SMI interface signals

Diagram of SMI interface signals showing an STM32 MCU connected to an External PHY via MDC and MDIO lines. The STM32 MCU contains an 802.3 MAC block. The MDC line is a unidirectional signal from the MAC to the PHY. The MDIO line is a bidirectional signal between the MAC and the PHY. The diagram is labeled ai15621b.
Diagram of SMI interface signals showing an STM32 MCU connected to an External PHY via MDC and MDIO lines. The STM32 MCU contains an 802.3 MAC block. The MDC line is a unidirectional signal from the MAC to the PHY. The MDIO line is a bidirectional signal between the MAC and the PHY. The diagram is labeled ai15621b.

SMI frame format

The frame structure related to a read or write operation is shown in Table 310 , the order of bit transmission must be from left to right.

Table 310. Management frame format

-Management frame fields
Preamble (32 bits)StartOperationPADDRRADDRTAData (16 bits)Idle
Read1... 10110ppppprrrrrZ0dddddddddddddZ
Write1... 10101ppppprrrrr10dddddddddddddZ

The management frame consists of eight fields:

For a write transaction, the MAC controller drives a <10> pattern during the TA field. The PHY device must drive a high-impedance state for the 2 bits of TA.

SMI write operation

When the application sets the MII Write and Busy bits (in Ethernet MAC MII address register (ETH_MACMIIAR) ), the SMI initiates a write operation into the PHY registers by transferring the PHY address, the register address in PHY, and the write data (in Ethernet MAC MII data register (ETH_MACMIIDR) ). The application should not change the MII Address register contents or the MII Data register while the transaction is ongoing. Write operations to the MII Address register or the MII Data Register during this period are ignored (the Busy bit is high), and the transaction is completed without any error. After the Write operation has completed, the SMI indicates this by resetting the Busy bit.

Figure 538 shows the frame format for the write operation.

Timing diagram for SMI write cycle showing MDC and MDIO signals. MDC is a square wave. MDIO starts with 32 '1's (Preamble), followed by Start of frame (01), OP code (01), PHY address (A4-A0), Register address (R4-R0), Turn around (high impedance), and data (D15-D0). A bracket labeled 'Data to PHY' covers the OP code through the data field.

Figure 538. MDIO timing and frame structure - Write cycle

The diagram illustrates the MDIO timing and frame structure for a write cycle. The MDC signal is a continuous square wave. The MDIO signal is divided into several fields:

A bracket labeled "Data to PHY" spans from the start of the OP code to the end of the data field. The identifier "ai15626" is located in the bottom right corner of the diagram.

Timing diagram for SMI write cycle showing MDC and MDIO signals. MDC is a square wave. MDIO starts with 32 '1's (Preamble), followed by Start of frame (01), OP code (01), PHY address (A4-A0), Register address (R4-R0), Turn around (high impedance), and data (D15-D0). A bracket labeled 'Data to PHY' covers the OP code through the data field.

SMI read operation

When the user sets the MII Busy bit in the Ethernet MAC MII address register (ETH_MACMIIAR) with the MII Write bit at 0, the SMI initiates a read operation in the PHY registers by transferring the PHY address and the register address in PHY. The application should not change the MII Address register contents or the MII Data register while the transaction is ongoing. Write operations to the MII Address register or MII Data Register during this period are ignored (the Busy bit is high) and the transaction is completed without any error. After the read operation has completed, the SMI resets the Busy bit and then updates the MII Data register with the data read from the PHY.

Figure 539 shows the frame format for the read operation.

Figure 539. MDIO timing and frame structure - Read cycle

Timing diagram for MDIO read cycle showing MDC and MDIO signals. The MDC signal is a continuous square wave. The MDIO signal starts with a preamble of 32 '1's, followed by the start of frame (0110), operation code (01), PHY address (A4-A0), register address (R4-R0), a turnaround period (X), and data (D15-D0). The diagram is divided into 'Data to PHY' and 'Data from PHY' sections by the turnaround period. The identifier 'ai15627' is in the bottom right corner.
Timing diagram for MDIO read cycle showing MDC and MDIO signals. The MDC signal is a continuous square wave. The MDIO signal starts with a preamble of 32 '1's, followed by the start of frame (0110), operation code (01), PHY address (A4-A0), register address (R4-R0), a turnaround period (X), and data (D15-D0). The diagram is divided into 'Data to PHY' and 'Data from PHY' sections by the turnaround period. The identifier 'ai15627' is in the bottom right corner.

SMI clock selection

The MAC initiates the Management Write/Read operation. The SMI clock is a divided clock whose source is the application clock (AHB clock). The divide factor depends on the clock range setting in the MII Address register.

Table 311 shows how to set the clock ranges.

Table 311. Clock range

SelectionHCLK clockMDC clock
00060-100 MHzAHB clock / 42
001100-150 MHzAHB clock / 62
01020-35 MHzAHB clock / 16
01135-60 MHzAHB clock / 26
100150-216 MHzAHB clock / 102
101, 110, 111Reserved-

42.4.2 Media-independent interface: MII

The media-independent interface (MII) defines the interconnection between the MAC sublayer and the PHY for data transfer at 10 Mbit/s and 100 Mbit/s.

Figure 540. Media independent interface signals

Diagram of the Media Independent Interface (MII) signals between an STM32 MCU and an External PHY. The STM32 MCU contains an 802.3 MAC block. The External PHY is connected to the MAC via the following signals: TX_CLK, TXD[3:0], TX_EN, RX_CLK, RXD[3:0], RX_ER, RX_DV, CRS, COL, MDC, and MDIO. The signals are shown as lines connecting the MAC block to the PHY block. The diagram is labeled ai15622c in the bottom right corner.
Diagram of the Media Independent Interface (MII) signals between an STM32 MCU and an External PHY. The STM32 MCU contains an 802.3 MAC block. The External PHY is connected to the MAC via the following signals: TX_CLK, TXD[3:0], TX_EN, RX_CLK, RXD[3:0], RX_ER, RX_DV, CRS, COL, MDC, and MDIO. The signals are shown as lines connecting the MAC block to the PHY block. The diagram is labeled ai15622c in the bottom right corner.

deasserted and MII_RX_ER is asserted, a specific MII_RXD[3:0] value is used to transfer specific information from the PHY (see Table 313 ).

Table 312. TX interface signal encoding

MII_TX_ENMII_TXD[3:0]Description
00000 through 1111Normal inter-frame
10000 through 1111Normal data transmission

Table 313. RX interface signal encoding

MII_RX_DVMII_RX_ERRMII_RXD[3:0]Description
000000 through 1111Normal inter-frame
010000Normal inter-frame
010001 through 1101Reserved
011110False carrier indication
011111Reserved
100000 through 1111Normal data reception
110000 through 1111Data reception with errors

MII clock sources

To generate both TX_CLK and RX_CLK clock signals, the external PHY must be clocked with an external 25 MHz as shown in Figure 541 . Instead of using an external 25 MHz quartz to provide this clock, the STM32F76xxx and STM32F77xxx microcontrollers can output this signal on its MCO pin. In this case, the PLL multiplier has to be configured so as to get the desired frequency on the MCO pin, from the 25 MHz external quartz.

Figure 541. MII clock sources

Figure 541: MII clock sources diagram

Figure 541 illustrates the MII clock sources for the STM32 MCU. The diagram shows an STM32 MCU connected to an External PHY via an 802.3 MAC. The MAC is connected to the PHY via TX_CLK and RX_CLK lines. The MAC is also connected to the PHY via a 25 MHz clock source. The 25 MHz clock source is derived from the HSE (High Speed External) oscillator or the MCO (Microcontroller Clock Output). The diagram also indicates that the 25 MHz clock source is used for 10/100 Mbit/s operation. The diagram is labeled ai15623b.

Figure 541: MII clock sources diagram

42.4.3 Reduced media-independent interface: RMII

The reduced media-independent interface (RMII) specification reduces the pin count between the microcontroller Ethernet peripheral and the external Ethernet in 10/100 Mbit/s. According to the IEEE 802.3u standard, an MII contains 16 pins for data and control. The RMII specification is dedicated to reduce the pin count to 7 pins (a 62.5% decrease in pin count).

The RMII is instantiated between the MAC and the PHY. This helps translation of the MAC's MII into the RMII. The RMII block has the following characteristics:

Figure 542. Reduced media-independent interface signals

Figure 542: Reduced media-independent interface signals diagram

Figure 542 illustrates the RMII signals between the STM32 MCU and an External PHY. The diagram shows the STM32 MCU connected to the External PHY via an 802.3 MAC. The MAC is connected to the PHY via TXD[1:0], TX_EN, RXD[1:0], CRSDV, MDC, MDIO, and REF_CLK lines. The REF_CLK line is connected to a Clock source. The diagram is labeled ai15624b.

Figure 542: Reduced media-independent interface signals diagram

RMII clock sources

Either clock the PHY from an external 50 MHz clock or use a PHY with an embedded PLL to generate the 50 MHz frequency.

Figure 543. RMII clock sources-

Figure 543. RMII clock sources diagram showing an STM32 MCU connected to an External PHY. The MCU contains a PLL that takes a 25 MHz input. The PHY provides a REF_CLK signal to the MAC. A 50 MHz clock source is indicated for 10/100 Mbit/s operations.

The diagram illustrates the clocking for an RMII interface. On the left, an STM32 MCU block contains a PLL. A 25 MHz external clock is input to this PLL. The PLL output is connected to the 802.3 MAC block within the MCU. On the right, an External PHY block is connected to the MAC via a bidirectional data bus. A REF_CLK signal is shown being sent from the PHY back to the MAC. Below the PHY, a 50 MHz clock source is indicated, with a note 'For 10/100 Mbit/s'. The diagram is labeled MS19930V1.

Figure 543. RMII clock sources diagram showing an STM32 MCU connected to an External PHY. The MCU contains a PLL that takes a 25 MHz input. The PHY provides a REF_CLK signal to the MAC. A 50 MHz clock source is indicated for 10/100 Mbit/s operations.

42.4.4 MII/RMII selection

The mode, MII or RMII, is selected using the configuration bit 23, MII_RMII_SEL , in the SYSCFG_PMC register. The application has to set the MII/RMII mode while the Ethernet controller is under reset or before enabling the clocks.

MII/RMII internal clock scheme

The clock scheme required to support both the MII and RMII, as well as 10 and 100 Mbit/s operations is described in Figure 544.

Figure 544. Clock scheme

Figure 544. Clock scheme diagram showing the internal clocking for MII/RMII. It includes GPIO and AF controllers for MII_TX_CLK, MII_RX_CLK, and RMII_REF_CK. A synchronous divider is used to generate 25 MHz or 2.5 MHz clocks for the MAC's TX and RX blocks. The HCLK must be greater than 25 MHz.

This diagram shows the internal clock distribution for the Ethernet MAC. On the left, three input clock signals are shown: MII_TX_CLK as AF (25 MHz or 2.5 MHz), MII_RX_CLK as AF (25 MHz or 2.5 MHz), and RMII_REF_CK as AF (50 MHz). These are connected to 'GPIO and AF controller' blocks. The outputs of these controllers are connected to multiplexers. A 'Sync. divider' block takes the 50 MHz RMII_REF_CK and divides it by 2 for 100 Mb/s or by 20 for 10 Mb/s. The multiplexers select between the direct GPIO/AF controller outputs (25 MHz or 2.5 MHz) and the divided clock signals. The selected clocks are sent to the MAC block: MACTXCLK to the TX block, MACRXCLK to the RX block, and RMII to the RMII block. The MAC is also connected to an AHB bus, which is driven by HCLK. A note indicates that HCLK must be greater than 25 MHz. The diagram is labeled ai15650.

Figure 544. Clock scheme diagram showing the internal clocking for MII/RMII. It includes GPIO and AF controllers for MII_TX_CLK, MII_RX_CLK, and RMII_REF_CK. A synchronous divider is used to generate 25 MHz or 2.5 MHz clocks for the MAC's TX and RX blocks. The HCLK must be greater than 25 MHz.

1. The MII/RMII selection is controlled through bit 23, MII_RMII_SEL, in the SYSCFG_PMC register.

To save a pin, the two input clock signals, RMII_REF_CK and MII_RX_CLK, are multiplexed on the same GPIO pin.

42.5 Ethernet functional description: MAC 802.3

The IEEE 802.3 International Standard for local area networks (LANs) employs the CSMA/CD (carrier sense multiple access with collision detection) as the access method.

The Ethernet peripheral consists of a MAC 802.3 (media access control) controller with media independent interface (MII) and a dedicated DMA controller.

The MAC block implements the LAN CSMA/CD sublayer for the following families of systems: 10 Mbit/s and 100 Mbit/s of data rates for baseband and broadband systems. Half- and full-duplex operation modes are supported. The collision detection access method is applied only to the half-duplex operation mode. The MAC control frame sublayer is supported.

The MAC sublayer performs the following functions associated with a data link control procedure:

Basically there are two operating modes of the MAC sublayer:

42.5.1 MAC 802.3 frame format

The MAC block implements the MAC sublayer and the optional MAC control sublayer (10/100 Mbit/s) as specified by the IEEE 802.3-2002 standard.

Two frame formats are specified for data communication systems using the CSMA/CD MAC:

Figure 546 and Figure 547 describe the frame structure (untagged and tagged) that includes the following fields:

The address designation is based on the following types:

Figure 545. Address field format

Diagram of the MAC address field format. It shows a 48-bit address field, with the first bit being the LSB (I/G) and the last bit being the MSB. The U/L bit is the second bit from the LSB. The diagram indicates that bit transmission order is right to left. A legend on the right defines the bit values: I/G = 0 for Individual address, I/G = 1 for Group address, U/L = 0 for Globally administered address, and U/L = 1 for Locally administered address. The diagram is labeled ai15628.

The diagram illustrates the structure of a 48-bit MAC address. It is divided into three main parts: a 46-bit address, a U/L (Universal/Local) bit, and an I/G (Individual/Group) bit. The I/G bit is the least significant bit (LSB) and the U/L bit is the second bit from the LSB. The 46-bit address is the remaining part of the 48-bit field. The diagram shows the transmission order from right to left, with the MSB (Most Significant Bit) on the left and the LSB on the right. A legend on the right side of the diagram defines the bit values: I/G = 0 for Individual address, I/G = 1 for Group address, U/L = 0 for Globally administered address, and U/L = 1 for Locally administered address. The diagram is labeled ai15628.

Diagram of the MAC address field format. It shows a 48-bit address field, with the first bit being the LSB (I/G) and the last bit being the MSB. The U/L bit is the second bit from the LSB. The diagram indicates that bit transmission order is right to left. A legend on the right defines the bit values: I/G = 0 for Individual address, I/G = 1 for Group address, U/L = 0 for Globally administered address, and U/L = 1 for Locally administered address. The diagram is labeled ai15628.

hexadecimal). This constant field is used to distinguish tagged and untagged MAC frames.

Regardless of the interpretation of the length/type field, if the length of the data field is less than the minimum required for proper operation of the protocol, a PAD field is added after the data field but prior to the FCS (frame check sequence) field. The length/type field is transmitted and received with the higher-order byte first.

For length/type field values in the range between maxValidLength and minTypeValue (boundaries excluded), the behavior of the MAC sublayer is not specified: they may or may not be passed by the MAC sublayer.

When the data field length is less than the minimum required, the PAD field is added to match the minimum length (42 bytes for tagged frames, 46 bytes for untagged frames).

\[ G(x) = x^{32} + x^{26} + x^{23} + x^{22} + x^{16} + x^{12} + x^{11} + x^{10} + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1 \]

The CRC value of a frame is computed as follows:

Figure 546. MAC frame format

Diagram of a standard MAC frame format showing fields: Preamble (7 bytes), SFD (1 byte), Destination address (6 bytes), Source address (6 bytes), MAC client length/type (2 bytes), MAC client data (46-1500 bytes), PAD (4 bytes), and Frame check sequence (4 bytes). It also shows bit transmission order from MSB to LSB (right to left).

The diagram illustrates the structure of a standard MAC frame. The fields and their sizes are as follows:

7 bytesPreamble
1 byteSFD
6 bytesDestination address
6 bytesSource address
2 bytesMAC client length/type
46-1500 bytesMAC client data
PAD
4 bytesFrame check sequence

Bytes within the frame are transmitted from top to bottom. Below the frame structure, a bit transmission order is shown from MSB (Most Significant Bit) to LSB (Least Significant Bit), indicating a right-to-left transmission direction. The identifier 'ai15629' is present in the bottom right corner.

Diagram of a standard MAC frame format showing fields: Preamble (7 bytes), SFD (1 byte), Destination address (6 bytes), Source address (6 bytes), MAC client length/type (2 bytes), MAC client data (46-1500 bytes), PAD (4 bytes), and Frame check sequence (4 bytes). It also shows bit transmission order from MSB to LSB (right to left).

Figure 547. Tagged MAC frame format

Diagram of a tagged MAC frame format. It includes the standard fields plus a 4-byte QTag Prefix (Length/type = 802.1QTagType and Tag control information). It provides a detailed view of the Tag control information field, showing User priority, CFI, and a 12-bit VLAN identifier (VID). Bit transmission order is also shown.

The diagram illustrates the structure of a tagged MAC frame. The fields and their sizes are as follows:

7 bytesPreamble
1 byteSFD
6 bytesDestination address
6 bytesSource address
QTag Prefix 4 bytesLength/type = 802.1QTagType
Tag control information
2 bytesMAC client length/type
42-1500 bytesMAC client data
Pad
4 bytesFrame check sequence

Bytes within the frame are transmitted from top to bottom. A detailed view of the Tag control information field shows the following bit structure:

MSB100000001LSB
000000000

The Tag control information field is further detailed as:

User priorityCFIVLAN identifier (VID, 12 bits)

Bit transmission order is shown from MSB to LSB, indicating a right-to-left transmission direction. The identifier 'ai15630' is present in the bottom right corner.

Diagram of a tagged MAC frame format. It includes the standard fields plus a 4-byte QTag Prefix (Length/type = 802.1QTagType and Tag control information). It provides a detailed view of the Tag control information field, showing User priority, CFI, and a 12-bit VLAN identifier (VID). Bit transmission order is also shown.

Each byte of the MAC frame, except the FCS field, is transmitted low-order bit first.

An invalid MAC frame is defined by one of the following conditions:

42.5.2 MAC frame transmission

The DMA controls all transactions for the transmit path. Ethernet frames read from the system memory are pushed into the FIFO by the DMA. The frames are then popped out and transferred to the MAC core. When the end-of-frame is transferred, the status of the transmission is taken from the MAC core and transferred back to the DMA. The Transmit FIFO has a depth of 2 Kbyte. FIFO-fill level is indicated to the DMA so that it can initiate a data fetch in required bursts from the system memory, using the AHB interface. The data from the AHB Master interface is pushed into the FIFO.

When the SOF is detected, the MAC accepts the data and begins transmitting to the MII. The time required to transmit the frame data to the MII after the application initiates transmission is variable, depending on delay factors like IFG delay, time to transmit preamble/SFD, and any back-off delays for Half-duplex mode. After the EOF is transferred to the MAC core, the core completes normal transmission and then gives the status of transmission back to the DMA. If a normal collision (in Half-duplex mode) occurs during transmission, the MAC core makes the transmit status valid, then accepts and drops all further data until the next SOF is received. The same frame should be retransmitted from SOF on observing a Retry request (in the Status) from the MAC. The MAC issues an underflow status if the data are not provided continuously during the transmission. During the normal transfer of a frame, if the MAC receives an SOF without getting an EOF for the previous frame, then the SOF is ignored and the new frame is considered as the continuation of the previous frame.

There are two modes of operation for popping data towards the MAC core:

The application can flush the Transmit FIFO of all contents by setting the FTF (ETH_DMAOMR register [20]) bit. This bit is self-clearing and initializes the FIFO pointers to the default state. If the FTF bit is set during a frame transfer to the MAC core, then transfer is stopped as the FIFO is considered to be empty. Hence an underflow event occurs at the MAC transmitter and the corresponding Status word is forwarded to the DMA.

Automatic CRC and pad generation

When the number of bytes received from the application falls below 60 (DA+SA+LT+Data), zeros are appended to the transmitting frame to make the data length exactly 46 bytes to meet the minimum data field requirement of IEEE 802.3. The MAC can be programmed not to append any padding. The cyclic redundancy check (CRC) for the frame check sequence (FCS) field is calculated and appended to the data being transmitted. When the MAC is programmed to not append the CRC value to the end of Ethernet frames, the computed CRC is not transmitted. An exception to this rule is that when the MAC is programmed to append pads for frames (DA+SA+LT+Data) less than 60 bytes, CRC will be appended at the end of the padded frames.

The CRC generator calculates the 32-bit CRC for the FCS field of the Ethernet frame. The encoding is defined by the following polynomial.

\[ G(x) = x^{32} + x^{26} + x^{23} + x^{22} + x^{16} + x^{12} + x^{11} + x^{10} + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1 \]

Transmit protocol

The MAC controls the operation of Ethernet frame transmission. It performs the following functions to meet the IEEE 802.3/802.3z specifications. It:

When a new frame transmission is requested, the MAC sends out the preamble and SFD, followed by the data. The preamble is defined as 7 bytes of 0b10101010 pattern, and the SFD is defined as 1 byte of 0b10101011 pattern. The collision window is defined as 1 slot time (512 bit times for 10/100 Mbit/s Ethernet). The jam pattern generation is applicable only to Half-duplex mode, not to Full-duplex mode.

In MII mode, if a collision occurs at any time from the beginning of the frame to the end of the CRC field, the MAC sends a 32-bit jam pattern of 0x5555 5555 on the MII to inform all other stations that a collision has occurred. If the collision is seen during the preamble transmission phase, the MAC completes the transmission of the preamble and SFD and then sends the jam pattern.

A jabber timer is maintained to cut off the transmission of Ethernet frames if more than 2048 (default) bytes have to be transferred. The MAC uses the deferral mechanism for flow control (back pressure) in Half-duplex mode. When the application requests to stop receiving frames, the MAC sends a JAM pattern of 32 bytes whenever it senses the reception of a frame, provided that transmit flow control is enabled. This results in a collision and the remote station backs off. The application requests flow control by setting the BPA bit (bit 0) in the ETH_MACFCR register. If the application requests a frame to be transmitted, then it is scheduled and transmitted even when back pressure is activated. Note that if back pressure is kept activated for a long time (and more than 16 consecutive collision events occur) then the remote stations abort their transmissions due to excessive collisions. If IEEE 1588 time stamping is enabled for the transmit frame, this block takes a snapshot of the system time when the SFD is put onto the transmit MII bus.

Transmit scheduler

The MAC is responsible for scheduling the frame transmission on the MII. It maintains the interframe gap between two transmitted frames and follows the truncated binary exponential backoff algorithm for Half-duplex mode. The MAC enables transmission after satisfying the IFG and backoff delays. It maintains an idle period of the configured interframe gap (IFG bits in the ETH_MACCR register) between any two transmitted frames. If frames to be transmitted arrive sooner than the configured IFG time, the MII waits for the enable signal from the MAC before starting the transmission on it. The MAC starts its IFG counter as soon as the carrier signal of the MII goes inactive. At the end of the programmed IFG value, the MAC enables transmission in Full-duplex mode. In Half-duplex mode and when IFG is

configured for 96 bit times, the MAC follows the rule of deference specified in Section 4.2.3.2.1 of the IEEE 802.3 specification. The MAC resets its IFG counter if a carrier is detected during the first two-thirds (64-bit times for all IFG values) of the IFG interval. If the carrier is detected during the final one third of the IFG interval, the MAC continues the IFG count and enables the transmitter after the IFG interval. The MAC implements the truncated binary exponential backoff algorithm when it operates in Half-duplex mode.

Transmit flow control

When the Transmit Flow Control Enable bit (TFE bit in ETH_MACFCR) is set, the MAC generates Pause frames and transmits them as necessary, in Full-duplex mode. The Pause frame is appended with the calculated CRC, and is sent. Pause frame generation can be initiated in two ways.

A pause frame is sent either when the application sets the FCB bit in the ETH_MACFCR register or when the receive FIFO is full (packet buffer).

Single-packet transmit operation

The general sequence of events for a transmit operation is as follows:

  1. 1. If the system has data to be transferred, the DMA controller fetches them from the memory through the AHB Master interface and starts forwarding them to the FIFO. It continues to receive the data until the end of frame is transferred.
  2. 2. When the threshold level is crossed or a full packet of data is received into the FIFO, the frame data are popped and driven to the MAC core. The DMA continues to transfer data from the FIFO until a complete packet has been transferred to the MAC. Upon completion of the frame, the DMA controller is notified by the status coming from the MAC.

Transmit operation—Two packets in the buffer

  1. 1. Because the DMA must update the descriptor status before releasing it to the Host, there can be at the most two frames inside a transmit FIFO. The second frame is fetched by the DMA and put into the FIFO only if the OSF (operate on second frame) bit is set. If this bit is not set, the next frame is fetched from the memory only after the MAC has completely processed the frame and the DMA has released the descriptors.
  2. 2. If the OSF bit is set, the DMA starts fetching the second frame immediately after completing the transfer of the first frame to the FIFO. It does not wait for the status to be updated. In the meantime, the second frame is received into the FIFO while the first

frame is being transmitted. As soon as the first frame has been transferred and the status is received from the MAC, it is pushed to the DMA. If the DMA has already completed sending the second packet to the FIFO, the second transmission must wait for the status of the first packet before proceeding to the next frame.

Retransmission during collision

While a frame is being transferred to the MAC, a collision event may occur on the MAC line interface in Half-duplex mode. The MAC would then indicate a retry attempt by giving the status even before the end of frame is received. Then the retransmission is enabled and the frame is popped out again from the FIFO. After more than 96 bytes have been popped towards the MAC core, the FIFO controller frees up that space and makes it available to the DMA to push in more data. This means that the retransmission is not possible after this threshold is crossed or when the MAC core indicates a late collision event.

Transmit FIFO flush operation

The MAC provides a control to the software to flush the Transmit FIFO through the use of Bit 20 in the Operation mode register. The Flush operation is immediate and the Tx FIFO and the corresponding pointers are cleared to the initial state even if the Tx FIFO is in the middle of transferring a frame to the MAC Core. This results in an underflow event in the MAC transmitter, and the frame transmission is aborted. The status of such a frame is marked with both underflow and frame flush events (TDES0 bits 13 and 1). No data are coming to the FIFO from the application (DMA) during the Flush operation. Transfer transmit status words are transferred to the application for the number of frames that is flushed (including partial frames). Frames that are completely flushed have the Frame flush status bit (TDES0 13) set. The Flush operation is completed when the application (DMA) has accepted all of the Status words for the frames that were flushed. The Transmit FIFO Flush control register bit is then cleared. At this point, new frames from the application (DMA) are accepted. All data presented for transmission after a Flush operation are discarded unless they start with an SOF marker.

Transmit status word

At the end of the Ethernet frame transfer to the MAC core and after the core has completed the transmission of the frame, the transmit status is given to the application. The detailed description of the Transmit Status is the same as for bits [23:0] in TDES0. If IEEE 1588 time stamping is enabled, a specific frames' 64-bit time stamp is returned, along with the transmit status.

Transmit checksum offload

Communication protocols such as TCP and UDP implement checksum fields, which helps determine the integrity of data transmitted over a network. Because the most widespread use of Ethernet is to encapsulate TCP and UDP over IP datagrams, the Ethernet controller has a transmit checksum offload feature that supports checksum calculation and insertion in the transmit path, and error detection in the receive path. This section explains the operation of the checksum offload feature for transmitted frames.

Note: The checksum for TCP, UDP or ICMP is calculated over a complete frame, then inserted into its corresponding header field. Due to this requirement, this function is enabled only when the Transmit FIFO is configured for Store-and-forward mode (that is, when the TSF bit

is set in the ETH_ETH_DMAOMR register). If the core is configured for Threshold (cut-through) mode, the Transmit checksum offload is bypassed.

The user must make sure the Transmit FIFO is deep enough to store a complete frame before that frame is transferred to the MAC Core transmitter. If the FIFO depth is less than the input Ethernet frame size, the payload (TCP/UDP/ICMP) checksum insertion function is bypassed and only the frame's IPv4 Header checksum is modified, even in Store-and-forward mode.

The transmit checksum offload supports two types of checksum calculation and insertion. This checksum can be controlled for each frame by setting the CIC bits (bits 23:22 in TDES0, described in TDES0: Transmit descriptor Word0 on page 1802 ).

See IETF specifications RFC 791, RFC 793, RFC 768, RFC 792, RFC 2460 and RFC 4443 for IPv4, TCP, UDP, ICMP, IPv6 and ICMPv6 packet header specifications, respectively.

In IPv4 datagrams, the integrity of the header fields is indicated by the 16-bit header checksum field (the eleventh and twelfth bytes of the IPv4 datagram). The checksum offload detects an IPv4 datagram when the Ethernet frame's Type field has the value 0x0800 and the IP datagram's Version field has the value 0x4. The input frame's checksum field is ignored during calculation and replaced by the calculated value. IPv6 headers do not have a checksum field; thus, the checksum offload does not modify IPv6 header fields. The result of this IP header checksum calculation is indicated by the IP Header Error status bit in the Transmit status (Bit 16). This status bit is set whenever the values of the Ethernet Type field and the IP header's Version field are not consistent, or when the Ethernet frame does not have enough data, as indicated by the IP header Length field. In other words, this bit is set when an IP header error is asserted under the following circumstances:

  1. For IPv4 datagrams:
    • – The received Ethernet type is 0x0800, but the IP header's Version field does not equal 0x4
    • – The IPv4 Header Length field indicates a value less than 0x5 (20 bytes)
    • – The total frame length is less than the value given in the IPv4 Header Length field
  2. For IPv6 datagrams:
    • – The Ethernet type is 0x86DD but the IP header Version field does not equal 0x6
    • – The frame ends before the IPv6 header (40 bytes) or extension header (as given in the corresponding Header Length field in an extension header) has been completely received. Even when the checksum offload detects such an IP header error, it inserts an IPv4 header checksum if the Ethernet Type field indicates an IPv4 payload.

The TCP/UDP/ICMP checksum processes the IPv4 or IPv6 header (including extension headers) and determines whether the encapsulated payload is TCP, UDP or ICMP.

Note that:

  1. a) For non-TCP, -UDP, or -ICMP/ICMPv6 payloads, this checksum is bypassed and nothing further is modified in the frame.
  2. b) Fragmented IP frames (IPv4 or IPv6), IP frames with security features (such as an authentication header or encapsulated security payload), and IPv6 frames with routing headers are bypassed and not processed by the checksum.

The checksum is calculated for the TCP, UDP, or ICMP payload and inserted into its corresponding field in the header. It can work in the following two modes:

Note that: for ICMP-over-IPv4 packets, the checksum field in the ICMP packet must always be 0x0000 in both modes, because pseudo-headers are not defined for such packets. If it does not equal 0x0000, an incorrect checksum may be inserted into the packet.

The result of this operation is indicated by the payload checksum error status bit in the Transmit Status vector (bit 12). The payload checksum error status bit is set when either of the following is detected:

When the packet is longer than the indicated payload length, the bytes are ignored as stuff bytes, and no error is reported. When the first type of error is detected, the TCP, UDP or ICMP header is not modified. For the second error type, still, the calculated checksum is inserted into the corresponding header field.

MII/RMII transmit bit order

Each nibble from the MII is transmitted on the RMII a dibit at a time with the order of dibit transmission shown in Figure 548 . Lower order bits (D1 and D0) are transmitted first followed by higher order bits (D2 and D3).

Figure 548. Transmission bit order

Diagram showing the transmission bit order for a nibble stream. A nibble stream (D0, D1, D2, D3) is converted into a bit stream (D0, D1). The diagram shows the mapping of nibble bits to bit stream bits, with D0 and D1 being the least significant bits (LSB) and D2 and D3 being the most significant bits (MSB).

The diagram illustrates the transmission bit order. On the left, a 'Nibble stream' is shown as a vertical stack of four nibbles: D0 (LSB), D1, D2, and D3 (MSB). An arrow labeled 'MII_TXD[3:0]' points to this stack. On the right, a 'Bit stream' is shown as a vertical stack of two bits: D0 (LSB) and D1 (MSB). Above the bit stream, an arrow labeled 'RMII_TXD[1:0]' points upwards. Dashed lines connect the nibble bits to the bit stream bits: D0 (LSB) to D0 (LSB), D1 to D1 (MSB), D2 to D0 (LSB), and D3 (MSB) to D1 (MSB). The bit stream is labeled 'ai15632' in the bottom right corner.

Diagram showing the transmission bit order for a nibble stream. A nibble stream (D0, D1, D2, D3) is converted into a bit stream (D0, D1). The diagram shows the mapping of nibble bits to bit stream bits, with D0 and D1 being the least significant bits (LSB) and D2 and D3 being the most significant bits (MSB).

MII/RMII transmit timing diagrams

Figure 549. Transmission with no collision

Timing diagram for transmission with no collision. It shows five signals over time: MII_TX_CLK (clock), MII_TX_EN (enable), MII_TXD[3:0] (data), MII_CS (carrier sense), and MII_COL (collision). The data signal shows a sequence of frames: PR (Preamble), EA (Start Frame Delimiter), MB (MAC Address), LE (Length/Type), and data. The diagram indicates no collision occurs during transmission.

The timing diagram shows the signals during a transmission with no collision. The signals are:

The diagram is labeled 'ai15631' in the bottom right corner.

Timing diagram for transmission with no collision. It shows five signals over time: MII_TX_CLK (clock), MII_TX_EN (enable), MII_TXD[3:0] (data), MII_CS (carrier sense), and MII_COL (collision). The data signal shows a sequence of frames: PR (Preamble), EA (Start Frame Delimiter), MB (MAC Address), LE (Length/Type), and data. The diagram indicates no collision occurs during transmission.

Figure 550. Transmission with collision

Timing diagram for Figure 550: Transmission with collision. It shows five signals over time: MII_TX_CLK (a square wave), MII_TX_EN (active-low enable signal), MII_TXD[3:0] (4-bit data bus), MII_CS (carrier sense signal), and MII_COL (collision signal). The data bus shows a sequence of fields: PR (Preamble), EAM (End of Access Method), BLE (Begin Length Encoding), SFD (Start Frame Delimiter), DA (Destination Address), DA (Destination Address), JAM (Jam signal), JAM, JAM, JAM. The collision signal (MII_COL) is asserted during the transmission of the DA fields. The diagram is labeled ai15651.
Timing diagram for Figure 550: Transmission with collision. It shows five signals over time: MII_TX_CLK (a square wave), MII_TX_EN (active-low enable signal), MII_TXD[3:0] (4-bit data bus), MII_CS (carrier sense signal), and MII_COL (collision signal). The data bus shows a sequence of fields: PR (Preamble), EAM (End of Access Method), BLE (Begin Length Encoding), SFD (Start Frame Delimiter), DA (Destination Address), DA (Destination Address), JAM (Jam signal), JAM, JAM, JAM. The collision signal (MII_COL) is asserted during the transmission of the DA fields. The diagram is labeled ai15651.

Figure 551 shows a frame transmission in MII and RMII.

Figure 551. Frame transmission in MMI and RMII modes

Timing diagram for Figure 551: Frame transmission in MMI and RMII modes. It shows six signals: MII_RX_CLK (receive clock), MII_TX_EN (MII transmit enable), MII_TXD[3:0] (MII data bus), RMII_REF_CLK (reference clock), RMII_TX_EN (RMII transmit enable), and RMII_TXD[1:0] (RMII data bus). The diagram illustrates the timing relationship between the MII and RMII interfaces during frame transmission. The diagram is labeled ai15652.
Timing diagram for Figure 551: Frame transmission in MMI and RMII modes. It shows six signals: MII_RX_CLK (receive clock), MII_TX_EN (MII transmit enable), MII_TXD[3:0] (MII data bus), RMII_REF_CLK (reference clock), RMII_TX_EN (RMII transmit enable), and RMII_TXD[1:0] (RMII data bus). The diagram illustrates the timing relationship between the MII and RMII interfaces during frame transmission. The diagram is labeled ai15652.

42.5.3 MAC frame reception

The MAC received frames are pushed into the Rx FIFO. The status (fill level) of this FIFO is indicated to the DMA once it crosses the configured receive threshold (RTC in the ETH_DMAOMR register) so that the DMA can initiate pre-configured burst transfers towards the AHB interface.

In the default Cut-through mode, when 64 bytes (configured with the RTC bits in the ETH_DMAOMR register) or a full packet of data are received into the FIFO, the data are popped out and the DMA is notified of its availability. Once the DMA has initiated the transfer to the AHB interface, the data transfer continues from the FIFO until a complete

packet has been transferred. Upon completion of the EOF frame transfer, the status word is popped out and sent to the DMA controller.

In Rx FIFO Store-and-forward mode (configured by the RSF bit in the ETH_DMAOMR register), a frame is read out only after being written completely into the Receive FIFO. In this mode, all error frames are dropped (if the core is configured to do so) such that only valid frames are read out and forwarded to the application. In Cut-through mode, some error frames are not dropped, because the error status is received at the end of the frame, by which time the start of that frame has already been read out of the FIFO.

A receive operation is initiated when the MAC detects an SFD on the MII. The core strips the preamble and SFD before proceeding to process the frame. The header fields are checked for the filtering and the FCS field used to verify the CRC for the frame. The frame is dropped in the core if it fails the address filter.

Receive protocol

The received frame preamble and SFD are stripped. Once the SFD has been detected, the MAC starts sending the Ethernet frame data to the receive FIFO, beginning with the first byte following the SFD (destination address). If IEEE 1588 time stamping is enabled, a snapshot of the system time is taken when any frame's SFD is detected on the MII. Unless the MAC filters out and drops the frame, this time stamp is passed on to the application.

If the received frame length/type field is less than 0x600 and if the MAC is programmed for the auto CRC/pad stripping option, the MAC sends the data of the frame to RxFIFO up to the count specified in the length/type field, then starts dropping bytes (including the FCS field). If the Length/Type field is greater than or equal to 0x600, the MAC sends all received Ethernet frame data to Rx FIFO, regardless of the value on the programmed auto-CRC strip option. The MAC watchdog timer is enabled by default, that is, frames above 2048 bytes (DA + SA + LT + Data + pad + FCS) are cut off. This feature can be disabled by programming the watchdog disable (WD) bit in the MAC configuration register. However, even if the watchdog timer is disabled, frames greater than 16 KB in size are cut off and a watchdog timeout status is given.

Receive CRC: automatic CRC and pad stripping

The MAC checks for any CRC error in the receiving frame. It calculates the 32-bit CRC for the received frame that includes the Destination address field through the FCS field. The encoding is defined by the following polynomial.

\[ G(x) = x^{32} + x^{26} + x^{23} + x^{22} + x^{16} + x^{12} + x^{11} + x^{10} + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1 \]

Regardless of the auto-pad/CRC strip, the MAC receives the entire frame to compute the CRC check for the received frame.

Receive checksum offload

Both IPv4 and IPv6 frames in the received Ethernet frames are detected and processed for data integrity. The user can enable the receive checksum offload by setting the IPCO bit in the ETH_MACCR register. The MAC receiver identifies IPv4 or IPv6 frames by checking for value 0x0800 or 0x86DD, respectively, in the received Ethernet frame Type field. This identification applies to VLAN-tagged frames as well. The receive checksum offload calculates IPv4 header checksums and checks that they match the received IPv4 header checksums. The IP Header Error bit is set for any mismatch between the indicated payload

type (Ethernet Type field) and the IP header version, or when the received frame does not have enough bytes, as indicated by the IPv4 header's Length field (or when fewer than 20 bytes are available in an IPv4 or IPv6 header). The receive checksum offload also identifies a TCP, UDP or ICMP payload in the received IP datagrams (IPv4 or IPv6) and calculates the checksum of such payloads properly, as defined in the TCP, UDP or ICMP specifications. It includes the TCP/UDP/ICMPv6 pseudo-header bytes for checksum calculation and checks whether the received checksum field matches the calculated value. The result of this operation is given as a Payload Checksum Error bit in the receive status word. This status bit is also set if the length of the TCP, UDP or ICMP payload does not match the expected payload length given in the IP header. As mentioned in TCP/UDP/ICMP checksum on page 1772 , the receive checksum offload bypasses the payload of fragmented IP datagrams, IP datagrams with security features, IPv6 routing headers, and payloads other than TCP, UDP or ICMP. This information (whether the checksum is bypassed or not) is given in the receive status, as described in the RDES0: Receive descriptor Word0 section. In this configuration, the core does not append any payload checksum bytes to the received Ethernet frames.

As mentioned in RDES0: Receive descriptor Word0 on page 1811 , the meaning of certain register bits changes as shown in Table 314 .

Table 314. Frame statuses

Bit 18:
Ethernet frame
Bit 27: Header
checksum error
Bit 28: Payload
checksum error
Frame status
000The frame is an IEEE 802.3 frame (Length field value is less than 0x0600).
100IPv4/IPv6 Type frame in which no checksum error is detected.
101IPv4/IPv6 Type frame in which a payload checksum error (as described for PCE) is detected
110IPv4/IPv6 Type frame in which IP header checksum error (as described for IPCO HCE) is detected.
111IPv4/IPv6 Type frame in which both PCE and IPCO HCE are detected.
001IPv4/IPv6 Type frame in which there is no IP HCE and the payload check is bypassed due to unsupported payload.
011Type frame which is neither IPv4 or IPv6 (checksum offload bypasses the checksum check completely)
010Reserved

Receive frame controller

If the RA bit is reset in the MAC CSR frame filter register, the MAC performs frame filtering based on the destination/source address (the application still needs to perform another level of filtering if it decides not to receive any bad frames like runt, CRC error frames, etc.). On detecting a filter-fail, the frame is dropped and not transferred to the application. When the filtering parameters are changed dynamically, and in case of (DA-SA) filter-fail, the rest of

the frame is dropped and the Rx Status Word is immediately updated (with zero frame length, CRC error and Runt Error bits set), indicating the filter fail. In Ethernet power down mode, all received frames are dropped, and are not forwarded to the application.

Receive flow control

The MAC detects the receiving Pause frame and pauses the frame transmission for the delay specified within the received Pause frame (only in Full-duplex mode). The Pause frame detection function can be enabled or disabled with the RFCE bit in ETH_MACFCR. Once receive flow control has been enabled, the received frame destination address begins to be monitored for any match with the multicast address of the control frame (0x0180 C200 0001). If a match is detected (the destination address of the received frame matches the reserved control frame destination address), the MAC then decides whether or not to transfer the received control frame to the application, based on the level of the PCF bit in ETH_MACFFR.

The MAC also decodes the type, opcode, and Pause Timer fields of the receiving control frame. If the byte count of the status indicates 64 bytes, and if there is no CRC error, the MAC transmitter pauses the transmission of any data frame for the duration of the decoded Pause time value, multiplied by the slot time (64 byte times for both 10/100 Mbit/s modes). Meanwhile, if another Pause frame is detected with a zero Pause time value, the MAC resets the Pause time and manages this new pause request.

If the received control frame matches neither the type field (0x8808), the opcode (0x00001), nor the byte length (64 bytes), or if there is a CRC error, the MAC does not generate a Pause.

In the case of a pause frame with a multicast destination address, the MAC filters the frame based on the address match.

For a pause frame with a unicast destination address, the MAC filtering depends on whether the DA matched the contents of the MAC address 0 register and whether the UPDF bit in ETH_MACFCR is set (detecting a pause frame even with a unicast destination address). The PCF register bits (bits [7:6] in ETH_MACFFR) control filtering for control frames in addition to address filtering.

Receive operation multiframe handling

Since the status is available immediately following the data, the FIFO is capable of storing any number of frames into it, as long as it is not full.

Error handling

If the Rx FIFO is full before it receives the EOF data from the MAC, an overflow is declared and the whole frame is dropped, and the overflow counter in the (ETH_DMAMFBOCR register) is incremented. The status indicates a partial frame due to overflow. The Rx FIFO can filter error and undersized frames, if enabled (using the FEF and FUGF bits in ETH_DMAOMR).

If the Receive FIFO is configured to operate in Store-and-forward mode, all error frames can be filtered and dropped.

In Cut-through mode, if a frame's status and length are available when that frame's SOF is read from the Rx FIFO, then the complete erroneous frame can be dropped. The DMA can flush the error frame being read from the FIFO, by enabling the receive frame flash bit. The data transfer to the application (DMA) is then stopped and the rest of the frame is internally read and dropped. The next frame transfer can then be started, if available.

Receive status word

At the end of the Ethernet frame reception, the MAC outputs the receive status to the application (DMA). The detailed description of the receive status is the same as for bits[31:0] in RDES0, given in RDES0: Receive descriptor Word0 .

Frame length interface

In case of switch applications, data transmission and reception between the application and MAC happen as complete frame transfers. The application layer should be aware of the length of the frames received from the ingress port in order to transfer the frame to the egress port. The MAC core provides the frame length of each received frame inside the status at the end of each frame reception.

Note: A frame length value of 0 is given for partial frames written into the Rx FIFO due to overflow.

MII/RMII receive bit order

Each nibble is transmitted to the MII from the dibit received from the RMII in the nibble transmission order shown in Figure 552 . The lower-order bits (D0 and D1) are received first, followed by the higher-order bits (D2 and D3).

Figure 552. Receive bit order

Diagram illustrating the receive bit order for MII/RMII. A vertical stack of four bits (D0, D1, D2, D3) represents a nibble stream, with D0 at the top (LSB) and D3 at the bottom (MSB). An arrow labeled MII_RXD[3:0] points to this stack. Above the stack, a horizontal pair of bits (D0, D1) represents a di-bit stream, with D0 on the left (LSB) and D1 on the right (MSB). An arrow labeled RMII_RXD[1:0] points to this pair. Dashed lines connect the bits in the nibble stream to the bits in the di-bit stream: D0 to D0, D1 to D1, D2 to D0, and D3 to D1, showing that each nibble is split across two di-bit transmissions.

The diagram shows the mapping of bits from a nibble stream to a di-bit stream. The nibble stream consists of bits D0, D1, D2, and D3, where D0 is the Least Significant Bit (LSB) and D3 is the Most Significant Bit (MSB). The di-bit stream consists of bits D0 and D1, where D0 is the LSB and D1 is the MSB. The mapping is as follows: the first nibble (D0, D1) maps to the first di-bit (D0, D1), and the second nibble (D2, D3) maps to the second di-bit (D0, D1). This is indicated by dashed lines connecting D0 to D0, D1 to D1, D2 to D0, and D3 to D1.

Diagram illustrating the receive bit order for MII/RMII. A vertical stack of four bits (D0, D1, D2, D3) represents a nibble stream, with D0 at the top (LSB) and D3 at the bottom (MSB). An arrow labeled MII_RXD[3:0] points to this stack. Above the stack, a horizontal pair of bits (D0, D1) represents a di-bit stream, with D0 on the left (LSB) and D1 on the right (MSB). An arrow labeled RMII_RXD[1:0] points to this pair. Dashed lines connect the bits in the nibble stream to the bits in the di-bit stream: D0 to D0, D1 to D1, D2 to D0, and D3 to D1, showing that each nibble is split across two di-bit transmissions.

ai15633

Figure 553. Reception with no error

Timing diagram for Figure 553: Reception with no error. It shows four signals: MII_RX_CLK (a continuous square wave), MII_RX_DV (a signal that goes high during the preamble and SFD, then low), MII_RXD[3:0] (data lines showing PREAMBLE, SFD, and FCS), and MII_RX_ERR (a signal that remains low throughout). Vertical dashed lines indicate clock edges. The diagram is labeled ai15634 in the bottom right corner.

ai15634

Timing diagram for Figure 553: Reception with no error. It shows four signals: MII_RX_CLK (a continuous square wave), MII_RX_DV (a signal that goes high during the preamble and SFD, then low), MII_RXD[3:0] (data lines showing PREAMBLE, SFD, and FCS), and MII_RX_ERR (a signal that remains low throughout). Vertical dashed lines indicate clock edges. The diagram is labeled ai15634 in the bottom right corner.

Figure 554. Reception with errors

Timing diagram for Figure 554: Reception with errors. It shows four signals: MII_RX_CLK, MII_RX_DV, MII_RXD[3:0] (showing PREAMBLE, SFD, DA, DA, XX, XX, XX), and MII_RX_ERR. The MII_RX_ERR signal goes high after the second DA field and returns low before the end of the frame. The diagram is labeled ai15635 in the bottom right corner.

ai15635

Timing diagram for Figure 554: Reception with errors. It shows four signals: MII_RX_CLK, MII_RX_DV, MII_RXD[3:0] (showing PREAMBLE, SFD, DA, DA, XX, XX, XX), and MII_RX_ERR. The MII_RX_ERR signal goes high after the second DA field and returns low before the end of the frame. The diagram is labeled ai15635 in the bottom right corner.

Figure 555. Reception with false carrier indication

Timing diagram for Figure 555: Reception with false carrier indication. It shows four signals: MII_RX_CLK, MII_RX_DV (which stays low throughout), MII_RXD[3:0] (showing XX, XX, XX, XX, 0E, XX, XX, XX, XX), and MII_RX_ERR. The MII_RX_ERR signal goes high when the data lines show the 0E value and returns low when they show the final XX value. The diagram is labeled ai15636 in the bottom right corner.

ai15636

Timing diagram for Figure 555: Reception with false carrier indication. It shows four signals: MII_RX_CLK, MII_RX_DV (which stays low throughout), MII_RXD[3:0] (showing XX, XX, XX, XX, 0E, XX, XX, XX, XX), and MII_RX_ERR. The MII_RX_ERR signal goes high when the data lines show the 0E value and returns low when they show the final XX value. The diagram is labeled ai15636 in the bottom right corner.

42.5.4 MAC interrupts

Interrupts can be generated from the MAC core as a result of various events.

The ETH_MACCSR register describes the events that can cause an interrupt from the MAC core. The user can prevent each event from asserting the interrupt by setting the corresponding mask bits in the Interrupt Mask register.

The interrupt register bits only indicate the block from which the event is reported. The user has to read the corresponding status registers and other registers to clear the interrupt. For example, bit 3 of the Interrupt register, set high, indicates that the Magic packet or Wake-on-LAN frame is received in Power-down mode. The user must read the ETH_MACPMTCSR Register to clear this interrupt event.

Figure 556. MAC core interrupt masking scheme

Figure 556. MAC core interrupt masking scheme. The diagram shows two AND gates and one OR gate. The top AND gate has inputs TSTS and TSTIM (active low) and output TSTI. The bottom AND gate has inputs PMTS and PMTIM (active low) and output PMTI. Both TSTI and PMTI are inputs to an OR gate, which outputs the final Interrupt signal. The diagram is labeled ai15637 in the bottom right corner.
Figure 556. MAC core interrupt masking scheme. The diagram shows two AND gates and one OR gate. The top AND gate has inputs TSTS and TSTIM (active low) and output TSTI. The bottom AND gate has inputs PMTS and PMTIM (active low) and output PMTI. Both TSTI and PMTI are inputs to an OR gate, which outputs the final Interrupt signal. The diagram is labeled ai15637 in the bottom right corner.

42.5.5 MAC filtering

Address filtering

Address filtering checks the destination and source addresses on all received frames and the address filtering status is reported accordingly. Address checking is based on different parameters (Frame filter register) chosen by the application. The filtered frame can also be identified: multicast or broadcast frame.

Address filtering uses the station's physical (MAC) address and the Multicast Hash table for address checking purposes.

Unicast destination address filter

The MAC supports up to 4 MAC addresses for unicast perfect filtering. If perfect filtering is selected (HU bit in the Frame filter register is reset), the MAC compares all 48 bits of the received unicast address with the programmed MAC address for any match. Default MacAddr0 is always enabled, other addresses MacAddr1–MacAddr3 are selected with an individual enable bit. Each byte of these other addresses (MacAddr1–MacAddr3) can be masked during comparison with the corresponding received DA byte by setting the corresponding Mask Byte Control bit in the register. This helps group address filtering for the DA. In Hash filtering mode (when HU bit is set), the MAC performs imperfect filtering for unicast addresses using a 64-bit Hash table. For hash filtering, the MAC uses the 6 upper CRC (see note 1 below) bits of the received destination address to index the content of the Hash table. A value of 000000 selects bit 0 in the selected register, and a value of 111111 selects bit 63 in the Hash Table register. If the corresponding bit (indicated by the 6-bit CRC)

is set to 1, the unicast frame is said to have passed the Hash filter; otherwise, the frame has failed the Hash filter.

Note: This CRC is a 32-bit value coded by the following polynomial (for more details refer to Section 42.5.3: MAC frame reception ):

\[ G(x) = x^{32} + x^{26} + x^{23} + x^{22} + x^{16} + x^{12} + x^{11} + x^{10} + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1 \]

Multicast destination address filter

The MAC can be programmed to pass all multicast frames by setting the PAM bit in the Frame filter register. If the PAM bit is reset, the MAC performs the filtering for multicast addresses based on the HM bit in the Frame filter register. In Perfect filtering mode, the multicast address is compared with the programmed MAC destination address registers (1–3). Group address filtering is also supported. In Hash filtering mode, the MAC performs imperfect filtering using a 64-bit Hash table. For hash filtering, the MAC uses the 6 upper CRC (see note 1 below) bits of the received multicast address to index the content of the Hash table. A value of 000000 selects bit 0 in the selected register and a value of 111111 selects bit 63 in the Hash Table register. If the corresponding bit is set to 1, then the multicast frame is said to have passed the Hash filter; otherwise, the frame has failed the Hash filter.

Note: This CRC is a 32-bit value coded by the following polynomial (for more details refer to Section 42.5.3: MAC frame reception ):

\[ G(x) = x^{32} + x^{26} + x^{23} + x^{22} + x^{16} + x^{12} + x^{11} + x^{10} + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1 \]

Hash or perfect address filter

The DA filter can be configured to pass a frame when its DA matches either the Hash filter or the Perfect filter by setting the HPF bit in the Frame filter register and setting the corresponding HU or HM bits. This configuration applies to both unicast and multicast frames. If the HPF bit is reset, only one of the filters (Hash or Perfect) is applied to the received frame.

Broadcast address filter

The MAC does not filter any broadcast frames in the default mode. However, if the MAC is programmed to reject all broadcast frames by setting the BFD bit in the Frame filter register, any broadcast frames are dropped.

Unicast source address filter

The MAC can also perform perfect filtering based on the source address field of the received frames. By default, the MAC compares the SA field with the values programmed in the SA registers. The MAC address registers [1:3] can be configured to contain SA instead of DA for comparison, by setting bit 30 in the corresponding register. Group filtering with SA is also supported. The frames that fail the SA filter are dropped by the MAC if the SAF bit in the Frame filter register is set. Otherwise, the result of the SA filter is given as a status bit in the Receive Status word (see RDES0: Receive descriptor Word0 ).

When the SAF bit is set, the result of the SA and DA filters is AND'ed to decide whether the frame needs to be forwarded. This means that either of the filter fail result will drop the frame. Both filters have to pass the frame for the frame to be forwarded to the application.

Inverse filtering operation

For both destination and source address filtering, there is an option to invert the filter-match result at the final output. These are controlled by the DAIF and SAIF bits in the Frame filter register, respectively. The DAIF bit is applicable for both Unicast and Multicast DA frames. The result of the unicast/multicast destination address filter is inverted in this mode. Similarly, when the SAIF bit is set, the result of the unicast SA filter is inverted. Table 315 and Table 316 summarize destination and source address filtering based on the type of frame received.

Table 315. Destination address filtering

Frame typePMHPFHUDAIFHMPAMDBDA filter operation
Broadcast1XXXXXXPass
0XXXXX0Pass
0XXXXX1Fail
Unicast1XXXXXXPass all frames
0X00XXXPass on perfect/group filter match
0X01XXXFail on perfect/Group filter match
0010XXXPass on hash filter match
0011XXXFail on hash filter match
0110XXXPass on hash or perfect/Group filter match
0111XXXFail on hash or perfect/Group filter match
Multicast1XXXXXXPass all frames
XXXXX1XPass all frames
0XX000XPass on Perfect/Group filter match and drop PAUSE control frames if PCF = 0x
00X010XPass on hash filter match and drop PAUSE control frames if PCF = 0x
01X010XPass on hash or perfect/Group filter match and drop PAUSE control frames if PCF = 0x
0XX100XFail on perfect/Group filter match and drop PAUSE control frames if PCF = 0x
00X110XFail on hash filter match and drop PAUSE control frames if PCF = 0x
01X110XFail on hash or perfect/Group filter match and drop PAUSE control frames if PCF = 0x
01X110XFail on hash or perfect/Group filter match and drop PAUSE control frames if PCF = 0x

Table 316. Source address filtering

Frame typePMSAIFSAFSA filter operation
Unicast1XXPass all frames
000Pass status on perfect/Group filter match but do not drop frames that fail
010Fail status on perfect/group filter match but do not drop frame
001Pass on perfect/group filter match and drop frames that fail
011Fail on perfect/group filter match and drop frames that fail

42.5.6 MAC loopback mode

The MAC supports loopback of transmitted frames onto its receiver. By default, the MAC loopback function is disabled, but this feature can be enabled by programming the Loopback bit in the MAC ETH_MACCR register.

42.5.7 MAC management counters: MMC

The MAC management counters (MMC) maintain a set of registers for gathering statistics on the received and transmitted frames. These include a control register for controlling the behavior of the registers, two 32-bit registers containing generated interrupts (receive and transmit), and two 32-bit registers containing masks for the Interrupt register (receive and transmit). These registers are accessible from the application. Each register is 32 bits wide.

Section 42.8: Ethernet registers describes the various counters and lists the addresses of each of the statistics counters. This address is used for read/write accesses to the desired transmit/receive counter.

The Receive MMC counters are updated for frames that pass address filtering. Dropped frames statistics are not updated unless the dropped frames are runt frames of less than 6 bytes (DA bytes are not received fully).

Good transmitted and received frames

Transmitted frames are considered “good” if transmitted successfully. In other words, a transmitted frame is good if the frame transmission is not aborted due to any of the following errors:

Received frames are considered “good” if none of the following errors exists:

The maximum frame size depends on the frame type, as follows:

42.5.8 Power management: PMT

This section describes the power management (PMT) mechanisms supported by the MAC. PMT supports the reception of network (remote) wakeup frames and Magic Packet frames. PMT generates interrupts for wakeup frames and Magic Packets received by the MAC. The PMT block is enabled with remote wakeup frame enable and Magic Packet enable. These enable bits (WFE and MPE) are in the ETH_MACPMTCSR register and are programmed by the application. When the power down mode is enabled in the PMT, then all received frames are dropped by the MAC and they are not forwarded to the application. The MAC comes out of the power down mode only when either a Magic Packet or a Remote wakeup frame is received and the corresponding detection is enabled.

Remote wakeup frame filter register

There are eight wakeup frame filter registers. To write on each of them, load the wakeup frame filter register value by value. The wanted values of the wakeup frame filter are loaded by sequentially loading eight times the wakeup frame filter register. The read operation is identical to the write operation. To read the eight values, the user has to read eight times the wakeup frame filter register to reach the last register. Each read/write points the wakeup frame filter register to the next filter register.

Figure 557. Wakeup frame filter register

Wakeup frame filter reg0Filter 0 Byte Mask
Wakeup frame filter reg1Filter 1 Byte Mask
Wakeup frame filter reg2Filter 2 Byte Mask
Wakeup frame filter reg3Filter 3 Byte Mask
Wakeup frame filter reg4RSVDFilter 3 CommandRSVDFilter 2 CommandRSVDFilter 1 CommandRSVDFilter 0 Command
Wakeup frame filter reg5Filter 3 OffsetFilter 2 OffsetFilter 1 OffsetFilter 0 Offset
Wakeup frame filter reg6Filter 1 CRC - 16Filter 0 CRC - 16
Wakeup frame filter reg7Filter 3 CRC - 16Filter 2 CRC - 16

ai15647

This register defines which bytes of the frame are examined by filter i (0, 1, 2, and 3) in order to determine whether or not the frame is a wakeup frame. The MSB (thirty-first bit) must be zero. Bit j [30:0] is the Byte Mask. If bit j (byte number) of the Byte Mask is set, then Filter i Offset + j of the incoming frame is processed by the CRC block; otherwise Filter i Offset + j is ignored.

This 4-bit command controls the filter i operation. Bit 3 specifies the address type, defining the pattern's destination address type. When the bit is set, the pattern applies to only multicast frames. When the bit is reset, the pattern applies only to unicast frames. Bit 2 and bit 1 are reserved. Bit 0 is the enable bit for filter i; if bit 0 is not set, filter i is disabled.

This register defines the offset (within the frame) from which the frames are examined by filter i. This 8-bit pattern offset is the offset for the filter i first byte to be examined. The minimum allowed is 12, which refers to the 13th byte of the frame (offset value 0 refers to the first byte of the frame).

This register contains the CRC_16 value calculated from the pattern, as well as the byte mask programmed to the wakeup filter register block.

Remote wakeup frame detection

When the MAC is in sleep mode and the remote wakeup bit is enabled in the ETH_MACPMTCSR register, normal operation is resumed after receiving a remote wakeup frame. The application writes all eight wakeup filter registers, by performing a sequential write to the wakeup frame filter register address. The application enables remote wakeup by writing a 1 to bit 2 in the ETH_MACPMTCSR register. PMT supports four programmable filters that provide different receive frame patterns. If the incoming frame passes the address filtering of Filter Command, and if Filter CRC-16 matches the incoming examined pattern, then the wakeup frame is received. Filter_offset (minimum value 12, which refers to the 13th byte of the frame) determines the offset from which the frame is to be examined. Filter Byte Mask determines which bytes of the frame must be examined. The thirty-first bit of Byte Mask must be set to zero. The wakeup frame is checked only for length error, FCS error, dribble bit error, MII error, collision, and to ensure that it is not a runt frame. Even if the

wakeup frame is more than 512 bytes long, if the frame has a valid CRC value, it is considered valid. Wakeup frame detection is updated in the ETH_MACPMTCSR register for every remote wakeup frame received. If enabled, a PMT interrupt is generated to indicate the reception of a remote wakeup frame.

Magic packet detection

The Magic Packet frame is based on a method that uses Advanced Micro Device's Magic Packet technology to power up the sleeping device on the network. The MAC receives a specific packet of information, called a Magic Packet, addressed to the node on the network. Only Magic Packets that are addressed to the device or a broadcast address are checked to determine whether they meet the wakeup requirements. Magic Packets that pass address filtering (unicast or broadcast) are checked to determine whether they meet the remote Wake-on-LAN data format of 6 bytes of all ones followed by a MAC address appearing 16 times. The application enables Magic Packet wakeup by writing a 1 to bit 1 in the ETH_MACPMTCSR register. The PMT block constantly monitors each frame addressed to the node for a specific Magic Packet pattern. Each received frame is checked for a 0xFFFF FFFF FFFF pattern following the destination and source address field. The PMT block then checks the frame for 16 repetitions of the MAC address without any breaks or interruptions. In case of a break in the 16 repetitions of the address, the 0xFFFF FFFF FFFF pattern is scanned for again in the incoming frame. The 16 repetitions can be anywhere in the frame, but must be preceded by the synchronization stream (0xFFFF FFFF FFFF). The device also accepts a multicast frame, as long as the 16 duplications of the MAC address are detected. If the MAC address of a node is 0x0011 2233 4455, then the MAC scans for the data sequence:

Destination address source address ..... FFFF FFFF FFFF
0011 2233 4455 0011 2233 4455 0011 2233 4455 0011 2233 4455
0011 2233 4455 0011 2233 4455 0011 2233 4455 0011 2233 4455
0011 2233 4455 0011 2233 4455 0011 2233 4455 0011 2233 4455
0011 2233 4455 0011 2233 4455 0011 2233 4455 0011 2233 4455
...CRC

Magic Packet detection is updated in the ETH_MACPMTCSR register for received Magic Packet. If enabled, a PMT interrupt is generated to indicate the reception of a Magic Packet.

System consideration during power-down

The Ethernet PMT block is able to detect frames while the system is in the Stop mode, provided that the EXTI line 19 is enabled.

The MAC receiver state machine should remain enabled during the power-down mode. This means that the RE bit has to remain set in the ETH_MACCR register because it is involved in magic packet/ wake-on-LAN frame detection. The transmit state machine should however be turned off during the power-down mode by clearing the TE bit in the ETH_MACCR register. Moreover, the Ethernet DMA should be disabled during the power-down mode, because it is not necessary to copy the magic packet/wake-on-LAN frame into the SRAM. To disable the Ethernet DMA, clear the ST bit and the SR bit (for the transmit DMA and the receive DMA, respectively) in the ETH_DMAOMR register.

The recommended power-down and wakeup sequences are as follows:

  1. 1. Disable the transmit DMA and wait for any previous frame transmissions to complete. These transmissions can be detected when the transmit interrupt ETH_DMASR register[0] is received.
  2. 2. Disable the MAC transmitter and MAC receiver by clearing the RE and TE bits in the ETH_MACCR configuration register.
  3. 3. Wait for the receive DMA to have emptied all the frames in the Rx FIFO.
  4. 4. Disable the receive DMA.
  5. 5. Configure and enable the EXTI line 19 to generate either an event or an interrupt.
  6. 6. If you configure the EXTI line 19 to generate an interrupt, you also have to correctly configure the ETH_WKUP_IRQ Handler function, which should clear the pending bit of the EXTI line 19.
  7. 7. Enable Magic packet/Wake-on-LAN frame detection by setting the MFE/ WFE bit in the ETH_MACPMTCSR register.
  8. 8. Enable the MAC power-down mode, by setting the PD bit in the ETH_MACPMTCSR register.
  9. 9. Enable the MAC Receiver by setting the RE bit in the ETH_MACCR register.
  10. 10. Enter the system's Stop mode (for more details refer to Section 10.3.5: Stop mode ):
  11. 11. On receiving a valid wakeup frame, the Ethernet peripheral exits the power-down mode.
  12. 12. Read the ETH_MACPMTCSR to clear the power management event flag, enable the MAC transmitter state machine, and the receive and transmit DMA.
  13. 13. Configure the system clock: enable the HSE and set the clocks.

42.5.9 Precision time protocol (IEEE1588 PTP)

The IEEE 1588 standard defines a protocol that allows precise clock synchronization in measurement and control systems implemented with technologies such as network communication, local computing and distributed objects. The protocol applies to systems that communicate by local area networks supporting multicast messaging, including (but not limited to) Ethernet. This protocol is used to synchronize heterogeneous systems that include clocks of varying inherent precision, resolution and stability. The protocol supports system-wide synchronization accuracy in the submicrosecond range with minimum network and local clock computing resources. The message-based protocol, known as the precision time protocol (PTP), is transported over UDP/IP. The system or network is classified into Master and Slave nodes for distributing the timing/clock information. The protocol's technique for synchronizing a slave node to a master node by exchanging PTP messages is described in Figure 558 .

Figure 558. Networked time synchronization

Diagram illustrating networked time synchronization between a Master clock time and a Slave clock time. The diagram shows four messages exchanged: Sync message (t1 to t2), Follow_up message (t2m to t2), Delay_Req message (t3m to t3), and Delay_Resp message (t4 to t4). The slave clock time is shown as a dashed box containing the values t1, t2, t3, and t4. The time axis is indicated by a downward arrow.

The diagram illustrates the sequence of events for networked time synchronization. It features two vertical lines representing the 'Master clock time' and 'Slave clock time'.

On the slave's side, a dashed box labeled 'Data at slave clock' contains the captured times \( t_1, t_2, t_3, t_4 \) . A vertical arrow labeled 'time' points downwards, indicating the progression of time.

Diagram illustrating networked time synchronization between a Master clock time and a Slave clock time. The diagram shows four messages exchanged: Sync message (t1 to t2), Follow_up message (t2m to t2), Delay_Req message (t3m to t3), and Delay_Resp message (t4 to t4). The slave clock time is shown as a dashed box containing the values t1, t2, t3, and t4. The time axis is indicated by a downward arrow.
  1. 1. The master broadcasts PTP Sync messages to all its nodes. The Sync message contains the master's reference time information. The time at which this message leaves the master's system is \( t_1 \) . For Ethernet ports, this time has to be captured at the MII.
  2. 2. A slave receives the Sync message and also captures the exact time, \( t_2 \) , using its timing reference.
  3. 3. The master then sends the slave a Follow_up message, which contains the \( t_1 \) information for later use.
  4. 4. The slave sends the master a Delay_Req message, noting the exact time, \( t_3 \) , at which this frame leaves the MII.
  5. 5. The master receives this message and captures the exact time, \( t_4 \) , at which it enters its system.
  6. 6. The master sends the \( t_4 \) information to the slave in the Delay_Resp message.
  7. 7. The slave uses the four values of \( t_1 \) , \( t_2 \) , \( t_3 \) , and \( t_4 \) to synchronize its local timing reference to the master's timing reference.

Most of the protocol implementation occurs in the software, above the UDP layer. As described above, however, hardware support is required to capture the exact time when specific PTP packets enter or leave the Ethernet port at the MII. This timing information has to be captured and returned to the software for a proper, high-accuracy implementation of PTP.

Reference timing source

To get a snapshot of the time, the core requires a reference time in 64-bit format (split into two 32-bit channels, with the upper 32 bits providing time in seconds, and the lower 32 bits indicating time in nanoseconds) as defined in the IEEE 1588 specification.

The PTP reference clock input is used to internally generate the reference time (also called the System Time) and to capture time stamps. The frequency of this reference clock must be greater than or equal to the resolution of time stamp counter. The synchronization accuracy target between the master node and the slaves is around 100 ns.

The generation, update and modification of the System Time are described in the System Time correction methods .

The accuracy depends on the PTP reference clock input period, the characteristics of the oscillator (drift) and the frequency of the synchronization procedure.

Due to the synchronization from the Tx and Rx clock input domain to the PTP reference clock domain, the uncertainty on the time stamp latched value is 1 reference clock period. If we add the uncertainty due to resolution, we will add half the period for time stamping.

Transmission of frames with the PTP feature

When a frame's SFD is output on the MII, a time stamp is captured. Frames for which time stamp capture is required are controllable on a per-frame basis. In other words, each transmitted frame can be marked to indicate whether a time stamp must be captured or not for that frame. The transmitted frames are not processed to identify PTP frames. Frame control is exercised through the control bits in the transmit descriptor. Captured time stamps are returned to the application in the same way as the status is provided for frames. The time stamp is sent back along with the Transmit status of the frame, inside the corresponding transmit descriptor, thus connecting the time stamp automatically to the specific PTP frame. The 64-bit time stamp information is written back to the TDES2 and TDES3 fields, with TDES2 holding the time stamp's 32 least significant bits.

Reception of frames with the PTP feature

When the IEEE 1588 time stamping feature is enabled, the Ethernet MAC captures the time stamp of all frames received on the MII. The MAC provides the time stamp as soon as the frame reception is complete. Captured time stamps are returned to the application in the same way as the frame status is provided. The time stamp is sent back along with the Receive status of the frame, inside the corresponding receive descriptor. The 64-bit time stamp information is written back to the RDES2 and RDES3 fields, with RDES2 holding the time stamp's 32 least significant bits.

System Time correction methods

The 64-bit PTP time is updated using the PTP input reference clock, HCLK. This PTP time is used as a source to take snapshots (time stamps) of the Ethernet frames being transmitted or received at the MII. The System Time counter can be initialized or corrected using either the Coarse or the Fine correction method.

In the Coarse correction method, the initial value or the offset value is written to the Time stamp update register (refer to Section 42.8.3: IEEE 1588 time stamp registers on page 1846 ). For initialization, the System Time counter is written with the value in the Time stamp update registers, whereas for system time correction, the offset value (Time stamp update register) is added to or subtracted from the system time.

In the Fine correction method, the slave clock (reference clock) frequency drift with respect to the master clock (as defined in IEEE 1588) is corrected over a period of time, unlike in the Coarse correction method where it is corrected in a single clock cycle. The longer correction time helps maintain linear time and does not introduce drastic changes (or a large jitter) in the reference time between PTP Sync message intervals. In this method, an accumulator

sums up the contents of the Addend register as shown in Figure 559 . The arithmetic carry that the accumulator generates is used as a pulse to increment the system time counter. The accumulator and the addend are 32-bit registers. Here, the accumulator acts as a high-precision frequency multiplier or divider. Figure 559 shows this algorithm.

Figure 559. System time update using the Fine correction method

Figure 559: System time update using the Fine correction method. The diagram shows a flowchart of the system time update logic. It starts with an 'Addend register' and an 'Addend update' input. The 'Addend register' and the 'Addend update' are inputs to an adder (+). The output of the adder is stored in the 'Accumulator register'. The 'Accumulator register' output is also an input to another adder (+). The other input to this second adder is a 'Constant value'. The output of the second adder is stored in the 'Subsecond register'. The 'Subsecond register' output is also an input to a third adder (+). The other input to this third adder is the 'Increment Subsecond register' output. The output of the third adder is stored in the 'Second register'. The 'Second register' output is the final output of the system time update logic. The diagram is labeled 'ai15670' in the bottom right corner.
graph TD
    Addend[Addend register] --> Add1[+]
    Update[Addend update] --> Add1
    Add1 --> Accumulator[Accumulator register]
    Accumulator --> Add2[+]
    Constant[Constant value] --> Add2
    Add2 --> Subsecond[Subsecond register]
    Subsecond --> Add3[+]
    IncSub[Increment Subsecond register] --> Add3
    Add3 --> Second[Second register]
    Second --> Out[ ]
    style Out fill:none,stroke:none
  
Figure 559: System time update using the Fine correction method. The diagram shows a flowchart of the system time update logic. It starts with an 'Addend register' and an 'Addend update' input. The 'Addend register' and the 'Addend update' are inputs to an adder (+). The output of the adder is stored in the 'Accumulator register'. The 'Accumulator register' output is also an input to another adder (+). The other input to this second adder is a 'Constant value'. The output of the second adder is stored in the 'Subsecond register'. The 'Subsecond register' output is also an input to a third adder (+). The other input to this third adder is the 'Increment Subsecond register' output. The output of the third adder is stored in the 'Second register'. The 'Second register' output is the final output of the system time update logic. The diagram is labeled 'ai15670' in the bottom right corner.

The system time update logic requires a 50 MHz clock frequency to achieve 20 ns accuracy. The frequency division is the ratio of the reference clock frequency to the required clock frequency. Hence, if the reference clock (HCLK) is, let us say, 66 MHz, the ratio is calculated as \( 66 \text{ MHz} / 50 \text{ MHz} = 1.32 \) . Hence, the default addend value to be set in the register is \( 2^{32} / 1.32 \) , which is equal to 0xC1F0 7C1F.

If the reference clock drifts lower, to 65 MHz for example, the ratio is \( 65 / 50 \) or 1.3 and the value to set in the addend register is \( 2^{32} / 1.30 \) equal to 0xC4EC 4EC4. If the clock drifts higher, to 67 MHz for example, the addend register must be set to 0xBF0 B7672. When the clock drift is zero, the default addend value of 0xC1F0 7C1F ( \( 2^{32} / 1.32 \) ) should be programmed.

In Figure 559 , the constant value used to increment the subsecond register is 0d43. This makes an accuracy of 20 ns in the system time (in other words, it is incremented by 20 ns steps).

The software has to calculate the drift in frequency based on the Sync messages, and to update the Addend register accordingly. Initially, the slave clock is set with FreqCompensationValue0 in the Addend register. This value is as follows:

\[ \text{FreqCompensationValue0} = 2^{32} / \text{FreqDivisionRatio} \]

If MasterToSlaveDelay is initially assumed to be the same for consecutive Sync messages, the algorithm described below must be applied. After a few Sync cycles, frequency lock occurs. The slave clock can then determine a precise MasterToSlaveDelay value and re-synchronize with the master using the new value.

The algorithm is as follows:

In theory, this algorithm achieves lock in one Sync cycle; however, it may take several cycles, due to changing network propagation delays and operating conditions.

This algorithm is self-correcting: if for any reason the slave clock is initially set to a value from the master that is incorrect, the algorithm corrects it at the cost of more Sync cycles.

Programming steps for system time generation initialization

The time stamping feature can be enabled by setting bit 0 in the Time stamp control register (ETH__PTPTSCR). However, it is essential to initialize the time stamp counter after this bit is set to start time stamp operation. The proper sequence is the following:

  1. 1. Mask the Time stamp trigger interrupt by setting bit 9 in the MACIMR register.
  2. 2. Program Time stamp register bit 0 to enable time stamping.
  3. 3. Program the Subsecond increment register based on the PTP clock frequency.
  4. 4. If you are using the Fine correction method, program the Time stamp addend register and set Time stamp control register bit 5 (addend register update).
  5. 5. Poll the Time stamp control register until bit 5 is cleared.
  6. 6. To select the Fine correction method (if required), program Time stamp control register bit 1.
  7. 7. Program the Time stamp high update and Time stamp low update registers with the appropriate time value.
  8. 8. Set Time stamp control register bit 2 (Time stamp init).
  9. 9. The Time stamp counter starts operation as soon as it is initialized with the value written in the Time stamp update register.
  10. 10. Enable the MAC receiver and transmitter for proper time stamping.

Note: If time stamp operation is disabled by clearing bit 0 in the ETH_PTPTSCR register, the above steps must be repeated to restart the time stamp operation.

Programming steps for system time update in the Coarse correction method

To synchronize or update the system time in one process (coarse correction method), perform the following steps:

  1. 1. Write the offset (positive or negative) in the Time stamp update high and low registers.
  2. 2. Set bit 3 (TSSTU) in the Time stamp control register.
  3. 3. The value in the Time stamp update registers is added to or subtracted from the system time when the TSSTU bit is cleared.

Programming steps for system time update in the Fine correction method

To synchronize or update the system time to reduce system-time jitter (fine correction method), perform the following steps:

  1. 1. With the help of the algorithm explained in System Time correction methods , calculate the rate by which you want to speed up or slow down the system time increments.
  2. 2. Update the time stamp.
  3. 3. Wait the time you want the new value of the Addend register to be active. You can do this by activating the Time stamp trigger interrupt after the system time reaches the target value.
  4. 4. Program the required target time in the Target time high and low registers. Unmask the Time stamp interrupt by clearing bit 9 in the ETH_MACIMR register.
  5. 5. Set Time stamp control register bit 4 (TSARU).
  6. 6. When this trigger causes an interrupt, read the ETH_MACSR register.
  7. 7. Reprogram the Time stamp addend register with the old value and set ETH_TPTSCR bit 5 again.

PTP trigger internal connection with TIM2

The MAC provides a trigger interrupt when the system time becomes greater than the target time. Using an interrupt introduces a known latency plus an uncertainty in the command execution time.

In order to avoid this uncertainty, a PTP trigger output signal is set high when the system time is greater than the target time. It is internally connected to the TIM2 input trigger. With this signal, the input capture feature, the output compare feature and the waveforms of the timer can be used, triggered by the synchronized PTP system time. No uncertainty is introduced since the clock of the timer (PCLK1: TIM2 APB1 clock) and PTP reference clock (HCLK) are synchronous.

This PTP trigger signal is connected to the TIM2 ITR1 input selectable by software. The connection is enabled through bits 11 and 10 in the TIM2 option register (TIM2_OR).

Figure 560 shows the connection.

Figure 560. PTP trigger output to TIM2 ITR1 connection

Diagram showing the internal connection between the Ethernet MAC and the TIM2 input trigger (ITR1). The Ethernet MAC outputs a PTP trigger signal to the TIM2 ITR1 input.
graph LR; A[Ethernet MAC] -- "PTP trigger" --> B[TIM2]; B -- "ITR1" --> A;

The diagram illustrates the internal connection between the Ethernet MAC and the TIM2 input trigger (ITR1). The Ethernet MAC is shown on the left, and the TIM2 is shown on the right. A signal labeled "PTP trigger" is shown entering the TIM2 from the Ethernet MAC. A signal labeled "ITR1" is shown entering the Ethernet MAC from the TIM2. The diagram is enclosed in a box with the identifier "ai15671" in the bottom right corner.

Diagram showing the internal connection between the Ethernet MAC and the TIM2 input trigger (ITR1). The Ethernet MAC outputs a PTP trigger signal to the TIM2 ITR1 input.

PTP pulse-per-second output signal

This PTP pulse output is used to check the synchronization between all nodes in the network. To be able to test the difference between the local slave clock and the master reference clock, both clocks were given a pulse-per-second (PPS) output signal that may be connected to an oscilloscope if necessary. The deviation between the two signals can therefore be measured. The pulse width of the PPS output is 125 ms.

The PPS output is enabled through bits 11 and 10 in the TIM2 option register (TIM2_OR).

The default frequency of the PPS output is 1 Hz. PPSFREQ[3:0] (in ETH_PTPPPSCR) can be used to set the frequency of the PPS output to \( 2^{\text{PPSFREQ}} \) Hz.

When set to 1 Hz, the PPS pulse width is 125 ms with binary rollover (TSSSR=0, bit 9 in ETH_PTPTSCR) and 100 ms with digital rollover (TSSSR=1). When set to 2 Hz and higher, the duty cycle of the PPS output is 50% with binary rollover.

With digital rollover (TSSSR=1), it is recommended not to use the PPS output with a frequency other than 1 Hz as it would have irregular waveforms (though its average frequency would always be correct during any one-second window).

Figure 561. PPS output

Diagram of PPS output from Ethernet MAC

The diagram shows a rectangular box labeled 'Ethernet MAC'. An arrow labeled 'PPS output' points from the right side of the box to the right. In the bottom right corner of the box, the text 'ai15672' is present.

Diagram of PPS output from Ethernet MAC

42.6 Ethernet functional description: DMA controller operation

The DMA has independent transmit and receive engines, and a CSR space. The transmit engine transfers data from system memory into the Tx FIFO while the receive engine transfers data from the Rx FIFO into system memory. The controller utilizes descriptors to efficiently move data from source to destination with minimum CPU intervention. The DMA is designed for packet-oriented data transfers such as frames in Ethernet. The controller can be programmed to interrupt the CPU in cases such as frame transmit and receive transfer completion, and other normal/error conditions. The DMA and the STM32F76xxx and STM32F77xxx communicate through two data structures:

Control and status registers are described in detail in Section 42.8: Ethernet registers . Descriptors are described in detail in Normal Tx DMA descriptors .

The DMA transfers the received data frames to the receive buffer in the STM32F76xxx and STM32F77xxx memory, and transmits data frames from the transmit buffer in the STM32F76xxx and STM32F77xxx memory. Descriptors that reside in the STM32F76xxx and STM32F77xxx memory act as pointers to these buffers. There are two descriptor lists: one for reception, and one for transmission. The base address of each list is written into DMA Registers 3 and 4, respectively. A descriptor list is forward-linked (either implicitly or explicitly). The last descriptor may point back to the first entry to create a ring structure. Explicit chaining of descriptors is accomplished by configuring the second address chained in both the receive and transmit descriptors (RDES1[14] and TDES0[20]). The descriptor lists reside in the Host's physical memory space. Each descriptor can point to a maximum of

two buffers. This enables the use of two physically addressed buffers, instead of two contiguous buffers in memory. A data buffer resides in the Host's physical memory space, and consists of an entire frame or part of a frame, but cannot exceed a single frame. Buffers contain only data. The buffer status is maintained in the descriptor. Data chaining refers to frames that span multiple data buffers. However, a single descriptor cannot span multiple frames. The DMA skips to the next frame buffer when the end of frame is detected. Data chaining can be enabled or disabled. The descriptor ring and chain structure is shown in Figure 562.

Figure 562. Descriptor ring and chain structure

Figure 562. Descriptor ring and chain structure. The diagram illustrates two structures for DMA descriptors: Ring structure and Chain structure. In the Ring structure, multiple descriptors (Descriptor 0, Descriptor 1, Descriptor 2, ..., Descriptor n) are arranged vertically. Each descriptor points to two buffers (Buffer 1 and Buffer 2). A feedback arrow from the bottom of the ring points back to the top. In the Chain structure, multiple descriptors (Descriptor 0, Descriptor 1, Descriptor 2) are arranged vertically. Each descriptor points to one buffer (Buffer 1). A feedback arrow from the bottom of the chain points to the 'Next descriptor'.

The diagram shows two DMA descriptor structures. On the left, the 'Ring structure' shows a vertical stack of descriptors: Descriptor 0, Descriptor 1, Descriptor 2, a vertical ellipsis, and Descriptor n. Each descriptor has two arrows pointing to 'Buffer 1' and 'Buffer 2'. A long arrow on the left side of the descriptors points from the bottom (Descriptor n) back to the top (Descriptor 0). On the right, the 'Chain structure' shows a vertical stack of descriptors: Descriptor 0, Descriptor 1, and Descriptor 2. Each descriptor has one arrow pointing to 'Buffer 1'. A long arrow on the left side of the descriptors points from the bottom (Descriptor 2) to the text 'Next descriptor'. In the bottom right corner of the diagram area, the text 'ai15638' is present.

Figure 562. Descriptor ring and chain structure. The diagram illustrates two structures for DMA descriptors: Ring structure and Chain structure. In the Ring structure, multiple descriptors (Descriptor 0, Descriptor 1, Descriptor 2, ..., Descriptor n) are arranged vertically. Each descriptor points to two buffers (Buffer 1 and Buffer 2). A feedback arrow from the bottom of the ring points back to the top. In the Chain structure, multiple descriptors (Descriptor 0, Descriptor 1, Descriptor 2) are arranged vertically. Each descriptor points to one buffer (Buffer 1). A feedback arrow from the bottom of the chain points to the 'Next descriptor'.

42.6.1 Initialization of a transfer using DMA

Initialization for the MAC is as follows:

  1. 1. Write to ETH_DMABMR to set STM32F76xxx and STM32F77xxx bus access parameters.
  2. 2. Write to the ETH_DMAIER register to mask unnecessary interrupt causes.
  3. 3. The software driver creates the transmit and receive descriptor lists. Then it writes to both the ETH_DMARDLAR and ETH_DMATDLAR registers, providing the DMA with the start address of each list.
  4. 4. Write to MAC Registers 1, 2, and 3 to choose the desired filtering options.
  5. 5. Write to the MAC ETH_MACCR register to configure and enable the transmit and receive operating modes. The PS and DM bits are set based on the auto-negotiation result (read from the PHY).
  6. 6. Write to the ETH_DMAOMR register to set bits 13 and 1 and start transmission and reception.
  7. 7. The transmit and receive engines enter the running state and attempt to acquire descriptors from the respective descriptor lists. The receive and transmit engines then begin processing receive and transmit operations. The transmit and receive processes are independent of each other and can be started or stopped separately.

42.6.2 Host bus burst access

The DMA attempts to execute fixed-length burst transfers on the AHB master interface if configured to do so (FB bit in ETH_DMABMR). The maximum burst length is indicated and

limited by the PBL field (ETH_DMABMR [13:8]). The receive and transmit descriptors are always accessed in the maximum possible burst size (limited by PBL) for the 16 bytes to be read.

The Transmit DMA initiates a data transfer only when there is sufficient space in the Transmit FIFO to accommodate the configured burst or the number of bytes until the end of frame (when it is less than the configured burst length). The DMA indicates the start address and the number of transfers required to the AHB Master Interface. When the AHB Interface is configured for fixed-length burst, then it transfers data using the best combination of INCR4, INCR8, INCR16 and SINGLE transactions. Otherwise (no fixed-length burst), it transfers data using INCR (undefined length) and SINGLE transactions.

The Receive DMA initiates a data transfer only when sufficient data for the configured burst is available in Receive FIFO or when the end of frame (when it is less than the configured burst length) is detected in the Receive FIFO. The DMA indicates the start address and the number of transfers required to the AHB master interface. When the AHB interface is configured for fixed-length burst, then it transfers data using the best combination of INCR4, INCR8, INCR16 and SINGLE transactions. If the end of frame is reached before the fixed-burst ends on the AHB interface, then dummy transfers are performed in order to complete the fixed-length burst. Otherwise (FB bit in ETH_DMABMR is reset), it transfers data using INCR (undefined length) and SINGLE transactions.

When the AHB interface is configured for address-aligned beats, both DMA engines ensure that the first burst transfer the AHB initiates is less than or equal to the size of the configured PBL. Thus, all subsequent beats start at an address that is aligned to the configured PBL. The DMA can only align the address for beats up to size 16 (for PBL > 16), because the AHB interface does not support more than INCR16.

42.6.3 Host data buffer alignment

The transmit and receive data buffers do not have any restrictions on start address alignment. In our system with 32-bit memory, the start address for the buffers can be aligned to any of the four bytes. However, the DMA always initiates transfers with address aligned to the bus width with dummy data for the byte lanes not required. This typically happens during the transfer of the beginning or end of an Ethernet frame.

42.6.4 Buffer size calculations

The DMA does not update the size fields in the transmit and receive descriptors. The DMA updates only the status fields (xDES0) of the descriptors. The driver has to calculate the sizes. The transmit DMA transfers the exact number of bytes (indicated by buffer size field in

TDES1) towards the MAC core. If a descriptor is marked as first (FS bit in TDES0 is set), then the DMA marks the first transfer from the buffer as the start of frame. If a descriptor is marked as last (LS bit in TDES0), then the DMA marks the last transfer from that data buffer as the end of frame. The receive DMA transfers data to a buffer until the buffer is full or the end of frame is received. If a descriptor is not marked as last (LS bit in RDES0), then the buffer(s) that correspond to the descriptor are full and the amount of valid data in a buffer is accurately indicated by the buffer size field minus the data buffer pointer offset when the descriptor's FS bit is set. The offset is zero when the data buffer pointer is aligned to the databus width. If a descriptor is marked as last, then the buffer may not be full (as indicated by the buffer size in RDES1). To compute the amount of valid data in this final buffer, the driver must read the frame length (FL bits in RDES0[29:16]) and subtract the sum of the buffer sizes of the preceding buffers in this frame. The receive DMA always transfers the start of next frame with a new descriptor.

Note: Even when the start address of a receive buffer is not aligned to the system databus width the system should allocate a receive buffer of a size aligned to the system bus width. For example, if the system allocates a 1024 byte (1 KB) receive buffer starting from address 0x1000, the software can program the buffer start address in the receive descriptor to have a 0x1002 offset. The receive DMA writes the frame to this buffer with dummy data in the first two locations (0x1000 and 0x1001). The actual frame is written from location 0x1002. Thus, the actual useful space in this buffer is 1022 bytes, even though the buffer size is programmed as 1024 bytes, due to the start address offset.

42.6.5 DMA arbiter

The arbiter inside the DMA takes care of the arbitration between transmit and receive channel accesses to the AHB master interface. Two types of arbitrations are possible: round-robin, and fixed-priority. When round-robin arbitration is selected (DA bit in ETH_DMABMR is reset), the arbiter allocates the databus in the ratio set by the PM bits in ETH_DMABMR, when both transmit and receive DMAs request access simultaneously. When the DA bit is set, the receive DMA always gets priority over the transmit DMA for data access.

42.6.6 Error response to DMA

For any data transfer initiated by a DMA channel, if the slave replies with an error response, that DMA stops all operations and updates the error bits and the fatal bus error bit in the Status register (ETH_DMASR register). That DMA controller can resume operation only after soft- or hard-resetting the peripheral and re-initializing the DMA.

42.6.7 Tx DMA configuration

TxDMA operation: default (non-OSF) mode

The transmit DMA engine in default mode proceeds as follows:

  1. 1. The user sets up the transmit descriptor (TDES0-TDES3) and sets the OWN bit (TDES0[31]) after setting up the corresponding data buffer(s) with Ethernet frame data.
  2. 2. Once the ST bit (ETH_DMAOMR register[13]) is set, the DMA enters the Run state.
  3. 3. While in the Run state, the DMA polls the transmit descriptor list for frames requiring transmission. After polling starts, it continues in either sequential descriptor ring order or chained order. If the DMA detects a descriptor flagged as owned by the CPU, or if an error condition occurs, transmission is suspended and both the Transmit Buffer

Unavailable (ETH_DMASR register[2]) and Normal Interrupt Summary (ETH_DMASR register[16]) bits are set. The transmit engine proceeds to Step 9.

  1. 4. If the acquired descriptor is flagged as owned by DMA (TDES0[31] is set), the DMA decodes the transmit data buffer address from the acquired descriptor.
  2. 5. The DMA fetches the transmit data from the STM32F76xxx and STM32F77xxx memory and transfers the data.
  3. 6. If an Ethernet frame is stored over data buffers in multiple descriptors, the DMA closes the intermediate descriptor and fetches the next descriptor. Steps 3, 4, and 5 are repeated until the end of Ethernet frame data is transferred.
  4. 7. When frame transmission is complete, if IEEE 1588 time stamping was enabled for the frame (as indicated in the transmit status) the time stamp value is written to the transmit descriptor (TDES2 and TDES3) that contains the end-of-frame buffer. The status information is then written to this transmit descriptor (TDES0). Because the OWN bit is cleared during this step, the CPU now owns this descriptor. If time stamping was not enabled for this frame, the DMA does not alter the contents of TDES2 and TDES3.
  5. 8. Transmit Interrupt (ETH_DMASR register [0]) is set after completing the transmission of a frame that has Interrupt on Completion (TDES1[31]) set in its last descriptor. The DMA engine then returns to Step 3.
  6. 9. In the Suspend state, the DMA tries to re-acquire the descriptor (and thereby returns to Step 3) when it receives a transmit poll demand, and the Underflow Interrupt Status bit is cleared.

Figure 563 shows the TxDMA transmission flow in default mode.

Figure 563. TxDMA operation in default mode

Flowchart of TxDMA operation in default mode. The process starts with 'Start TxDMA' and 'Stop TxDMA' inputs. It enters a loop: '(Re-)fetch next descriptor' -> '(AHB) error?' (Yes leads to Stop TxDMA, No leads to 'Own bit set?'). 'Own bit set?' (Yes leads to 'Transfer data from buffer(s)', No leads to 'TxDMA suspended' -> 'Poll demand' -> '(Re-)fetch next descriptor'). 'Transfer data from buffer(s)' -> '(AHB) error?' (Yes leads to Stop TxDMA, No leads to 'Frame xfer complete?'). 'Frame xfer complete?' (Yes leads to 'Wait for Tx status', No leads to 'Close intermediate descriptor' -> '(Re-)fetch next descriptor'). 'Wait for Tx status' -> 'Time stamp present?' (Yes leads to 'Write time stamp to TDES2 and TDES3', No leads to 'Write status word to TDES0'). 'Write time stamp to TDES2 and TDES3' -> '(AHB) error?' (Yes leads to Stop TxDMA, No leads to 'Write status word to TDES0'). 'Write status word to TDES0' -> '(AHB) error?' (Yes leads to Stop TxDMA, No leads to '(Re-)fetch next descriptor').
graph TD
    Start[Start TxDMA] -- Start --> Stop[Stop TxDMA]
    Stop --> Fetch[(Re-)fetch next descriptor]
    Fetch --> AHB1{(AHB) error?}
    AHB1 -- Yes --> Stop
    AHB1 -- No --> Own{Own bit set?}
    Own -- No --> Suspended[TxDMA suspended]
    Suspended -- Poll demand --> Fetch
    Own -- Yes --> Transfer[Transfer data from buffer(s)]
    Transfer --> AHB2{(AHB) error?}
    AHB2 -- Yes --> Stop
    AHB2 -- No --> Complete{Frame xfer complete?}
    Complete -- No --> Close[Close intermediate descriptor]
    Close --> Fetch
    Complete -- Yes --> Wait[Wait for Tx status]
    Wait --> Stamp{Time stamp present?}
    Stamp -- Yes --> WriteStamp[Write time stamp to TDES2 and TDES3]
    Stamp -- No --> WriteStatus[Write status word to TDES0]
    WriteStamp --> AHB3{(AHB) error?}
    AHB3 -- Yes --> Stop
    AHB3 -- No --> WriteStatus
    WriteStatus --> AHB4{(AHB) error?}
    AHB4 -- Yes --> Stop
    AHB4 -- No --> Fetch
  
Flowchart of TxDMA operation in default mode. The process starts with 'Start TxDMA' and 'Stop TxDMA' inputs. It enters a loop: '(Re-)fetch next descriptor' -> '(AHB) error?' (Yes leads to Stop TxDMA, No leads to 'Own bit set?'). 'Own bit set?' (Yes leads to 'Transfer data from buffer(s)', No leads to 'TxDMA suspended' -> 'Poll demand' -> '(Re-)fetch next descriptor'). 'Transfer data from buffer(s)' -> '(AHB) error?' (Yes leads to Stop TxDMA, No leads to 'Frame xfer complete?'). 'Frame xfer complete?' (Yes leads to 'Wait for Tx status', No leads to 'Close intermediate descriptor' -> '(Re-)fetch next descriptor'). 'Wait for Tx status' -> 'Time stamp present?' (Yes leads to 'Write time stamp to TDES2 and TDES3', No leads to 'Write status word to TDES0'). 'Write time stamp to TDES2 and TDES3' -> '(AHB) error?' (Yes leads to Stop TxDMA, No leads to 'Write status word to TDES0'). 'Write status word to TDES0' -> '(AHB) error?' (Yes leads to Stop TxDMA, No leads to '(Re-)fetch next descriptor').

ai15639

TxDMA operation: OSF mode

While in the Run state, the transmit process can simultaneously acquire two frames without closing the Status descriptor of the first (if the OSF bit is set in ETH_DMAOMR register[2]). As the transmit process finishes transferring the first frame, it immediately polls the transmit descriptor list for the second frame. If the second frame is valid, the transmit process transfers this frame before writing the first frame's status information. In OSF mode, the Run-state transmit DMA operates according to the following sequence:

  1. 1. The DMA operates as described in steps 1–6 of the TxDMA (default mode).
  2. 2. Without closing the previous frame's last descriptor, the DMA fetches the next descriptor.
  3. 3. If the DMA owns the acquired descriptor, the DMA decodes the transmit buffer address in this descriptor. If the DMA does not own the descriptor, the DMA goes into Suspend mode and skips to Step 7.
  4. 4. The DMA fetches the Transmit frame from the STM32F76xxx and STM32F77xxx memory and transfers the frame until the end of frame data are transferred, closing the intermediate descriptors if this frame is split across multiple descriptors.
  5. 5. The DMA waits for the transmission status and time stamp of the previous frame. When the status is available, the DMA writes the time stamp to TDES2 and TDES3, if such time stamp was captured (as indicated by a status bit). The DMA then writes the status, with a cleared OWN bit, to the corresponding TDES0, thus closing the descriptor. If time stamping was not enabled for the previous frame, the DMA does not alter the contents of TDES2 and TDES3.
  6. 6. If enabled, the Transmit interrupt is set, the DMA fetches the next descriptor, then proceeds to Step 3 (when Status is normal). If the previous transmission status shows an underflow error, the DMA goes into Suspend mode (Step 7).
  7. 7. In Suspend mode, if a pending status and time stamp are received by the DMA, it writes the time stamp (if enabled for the current frame) to TDES2 and TDES3, then writes the status to the corresponding TDES0. It then sets relevant interrupts and returns to Suspend mode.
  8. 8. The DMA can exit Suspend mode and enter the Run state (go to Step 1 or Step 2 depending on pending status) only after receiving a Transmit Poll demand (ETH_DMATPDR register).

Figure 564 shows the basic flowchart in OSF mode.

Figure 564. TxDMA operation in OSF mode

Flowchart of TxDMA operation in OSF mode. The process starts with 'Start TxDMA' and 'Stop TxDMA' inputs to '(Re-)fetch next descriptor'. The main loop involves checking for (AHB) errors, the 'Own' bit, and frame completion. If the 'Own' bit is set, data is transferred from buffer(s). If the frame transfer is complete, it checks if it's a 'Second frame?'. If yes, it waits for the previous frame's Tx status; if no, it proceeds to 'Close intermediate descriptor'. Both paths lead to checking if a 'Time stamp present?'. If yes, it writes the time stamp to TDES2 & TDES3 for the previous frame. Finally, it writes the status word to the previous frame's TDES0 and checks for (AHB) errors. If suspended, it waits for the previous frame status available and then writes the status word to the previous frame's TDES0. A 'Poll demand' signal is also shown.
graph TD
    Start[Start TxDMA] --> Fetch[(Re-)fetch next descriptor]
    Stop[Stop TxDMA] --> Fetch
    Fetch --> AHB_err1{(AHB) error?}
    AHB_err1 -- Yes --> Stop
    AHB_err1 -- No --> Own{Own bit set?}
    Own -- No --> Suspended[TxDMA suspended]
    Own -- Yes --> Transfer[Transfer data from buffer(s)]
    Transfer --> AHB_err2{(AHB) error?}
    AHB_err2 -- Yes --> Stop
    AHB_err2 -- No --> Complete{Frame xfer complete?}
    Complete -- No --> Close[Close intermediate descriptor]
    Complete -- Yes --> Second{Second frame?}
    Second -- Yes --> Wait[Wait for previous frame's Tx status]
    Second -- No --> Close
    Close --> TS1{Time stamp present?}
    TS1 -- Yes --> TS1_W[Write time stamp to TDES2 & TDES3 for previous frame]
    TS1 -- No --> Status1[Write status word to prev. frame's TDES0]
    TS1_W --> AHB_err3{(AHB) error?}
    AHB_err3 -- Yes --> Stop
    AHB_err3 -- No --> Status1
    Status1 --> AHB_err4{(AHB) error?}
    AHB_err4 -- Yes --> Stop
    AHB_err4 -- No --> Fetch
    Suspended --> Poll[Poll demand]
    Poll --> Fetch
    Suspended --> PrevStatus[Previous frame status available]
    PrevStatus --> TS2{Time stamp present?}
    TS2 -- Yes --> TS2_W[Write time stamp to TDES2 & TDES3 for previous frame]
    TS2 -- No --> Status2[Write status word to prev. frame's TDES0]
    TS2_W --> AHB_err5{(AHB) error?}
    AHB_err5 -- Yes --> Stop
    AHB_err5 -- No --> Status2
    Status2 --> AHB_err6{(AHB) error?}
    AHB_err6 -- Yes --> Stop
    AHB_err6 -- No --> Fetch
  
Flowchart of TxDMA operation in OSF mode. The process starts with 'Start TxDMA' and 'Stop TxDMA' inputs to '(Re-)fetch next descriptor'. The main loop involves checking for (AHB) errors, the 'Own' bit, and frame completion. If the 'Own' bit is set, data is transferred from buffer(s). If the frame transfer is complete, it checks if it's a 'Second frame?'. If yes, it waits for the previous frame's Tx status; if no, it proceeds to 'Close intermediate descriptor'. Both paths lead to checking if a 'Time stamp present?'. If yes, it writes the time stamp to TDES2 & TDES3 for the previous frame. Finally, it writes the status word to the previous frame's TDES0 and checks for (AHB) errors. If suspended, it waits for the previous frame status available and then writes the status word to the previous frame's TDES0. A 'Poll demand' signal is also shown.

Transmit frame processing

The transmit DMA expects that the data buffers contain complete Ethernet frames, excluding preamble, pad bytes, and FCS fields. The DA, SA, and Type/Len fields contain valid data. If the transmit descriptor indicates that the MAC core must disable CRC or pad insertion, the buffer must have complete Ethernet frames (excluding preamble), including the CRC bytes. Frames can be data-chained and span over several buffers. Frames have to be delimited by the first descriptor (TDES0[28]) and the last descriptor (TDES0[29]). As the transmission starts, TDES0[28] has to be set in the first descriptor. When this occurs, the frame data are transferred from the memory buffer to the Transmit FIFO. Concurrently, if the last descriptor (TDES0[29]) of the current frame is cleared, the transmit process attempts to acquire the next descriptor. The transmit process expects TDES0[28] to be cleared in this descriptor. If TDES0[29] is cleared, it indicates an intermediary buffer. If TDES0[29] is set, it indicates the last buffer of the frame. After the last buffer of the frame has been transmitted,

the DMA writes back the final status information to the transmit descriptor 0 (TDES0) word of the descriptor that has the last segment set in transmit descriptor 0 (TDES0[29]). At this time, if Interrupt on Completion (TDES0[30]) is set, Transmit Interrupt (in ETH_DMASR register [0]) is set, the next descriptor is fetched, and the process repeats. Actual frame transmission begins after the Transmit FIFO has reached either a programmable transmit threshold (ETH_DMAOMR register[16:14]), or a full frame is contained in the FIFO. There is also an option for the Store and forward mode (ETH_DMAOMR register[21]). Descriptors are released (OWN bit TDES0[31] is cleared) when the DMA finishes transferring the frame.

Transmit polling suspended

Transmit polling can be suspended by either of the following conditions:

Normal Tx DMA descriptors

The normal transmit descriptor structure consists of four 32-bit words as shown in Figure 565 . The bit descriptions of TDES0, TDES1, TDES2 and TDES3 are given below.

Note that enhanced descriptors must be used if time stamping is activated (ETH_PTPTSCR bit 0, TSE=1) or if IPv4 checksum offload is activated (ETH_MACCR bit 10, IPCO=1).

Figure 565. Normal transmit descriptor

310
TDES 0O
W
N
Ctrl
[30:26]
T
T
S
E
Res.
24
Ctrl
[23:20]
Reserved
[19:18]
T
T
S
S
Status [16:0]
TDES 1Reserved
[31:29]
Buffer 2 byte count
[28:16]
Reserved
[15:13]
Buffer 1 byte count
[12:0]
TDES 2Buffer 1 address [31:0] / Time stamp low [31:0]
TDES 3Buffer 2 address [31:0] or Next descriptor address [31:0] / Time stamp high [31:0]

ai15642b

The application software has to program the control bits [30:26]+[23:20] plus the OWN bit [31] during descriptor initialization. When the DMA updates the descriptor (or writes it back), it resets all the control bits plus the OWN bit, and reports only the status bits.

31302928272625242322212019181716
OWNICLSFSDCDPTTSERes.CICTERTCHRes.Res.TTSSIHE
rwrwrwrwrwrwrwrwrwrwrwrwrw

1514131211109876543210
ESJTFFIPELCANCLCOECVFCCEDUFDB
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 OWN : Own bit

When set, this bit indicates that the descriptor is owned by the DMA. When this bit is reset, it indicates that the descriptor is owned by the CPU. The DMA clears this bit either when it completes the frame transmission or when the buffers allocated in the descriptor are read completely. The ownership bit of the frame's first descriptor must be set after all subsequent descriptors belonging to the same frame have been set.

Bit 30 IC : Interrupt on completion

When set, this bit sets the Transmit Interrupt (ETH_DMASR[0]) after the present frame has been transmitted.

Bit 29 LS : Last segment

When set, this bit indicates that the buffer contains the last segment of the frame.

Bit 28 FS : First segment

When set, this bit indicates that the buffer contains the first segment of a frame.

Bit 27 DC : Disable CRC

When this bit is set, the MAC does not append a cyclic redundancy check (CRC) to the end of the transmitted frame. This is valid only when the first segment (TDES0[28]) is set.

Bit 26 DP : Disable pad

When set, the MAC does not automatically add padding to a frame shorter than 64 bytes. When this bit is reset, the DMA automatically adds padding and CRC to a frame shorter than 64 bytes, and the CRC field is added despite the state of the DC (TDES0[27]) bit. This is valid only when the first segment (TDES0[28]) is set.

Bit 25 TTSE : Transmit time stamp enable

When TTSE is set and when TSE is set (ETH_PTPTSCR bit 0), IEEE1588 hardware time stamping is activated for the transmit frame described by the descriptor. This field is only valid when the First segment control bit (TDES0[28]) is set.

Bit 24 Reserved, must be kept at reset value.

Bits 23:22 CIC : Checksum insertion control

These bits control the checksum calculation and insertion. Bit encoding is as shown below:

00: Checksum Insertion disabled

01: Only IP header checksum calculation and insertion are enabled

10: IP header checksum and payload checksum calculation and insertion are enabled, but pseudo-header checksum is not calculated in hardware

11: IP Header checksum and payload checksum calculation and insertion are enabled, and pseudo-header checksum is calculated in hardware.

Bit 21 TER : Transmit end of ring

When set, this bit indicates that the descriptor list reached its final descriptor. The DMA returns to the base address of the list, creating a descriptor ring.

Bit 20 TCH : Second address chained

When set, this bit indicates that the second address in the descriptor is the next descriptor address rather than the second buffer address. When TDES0[20] is set, TBS2 (TDES1[28:16]) is a "don't care" value. TDES0[21] takes precedence over TDES0[20].

Bits 19:18 Reserved, must be kept at reset value.

Bit 17 TTSS : Transmit time stamp status

This field is used as a status bit to indicate that a time stamp was captured for the described transmit frame. When this bit is set, TDES2 and TDES3 have a time stamp value captured for the transmit frame. This field is only valid when the descriptor's Last segment control bit (TDES0[29]) is set.

Note that when enhanced descriptors are enabled (EDFE=1 in ETH_DMABMR), TTSS=1 indicates that TDES6 and TDES7 have the time stamp value.

Bit 16 IHE : IP header error

When set, this bit indicates that the MAC transmitter detected an error in the IP datagram header. The transmitter checks the header length in the IPv4 packet against the number of header bytes received from the application and indicates an error status if there is a mismatch. For IPv6 frames, a header error is reported if the main header length is not 40 bytes. Furthermore, the Ethernet length/type field value for an IPv4 or IPv6 frame must match the IP header version received with the packet. For IPv4 frames, an error status is also indicated if the Header Length field has a value less than 0x5.

Bit 15 ES : Error summary

Indicates the logical OR of the following bits:

Bit 14 JT : Jabber timeout

When set, this bit indicates the MAC transmitter has experienced a jabber timeout. This bit is only set when the MAC configuration register's JD bit is not set.

Bit 13 FF : Frame flushed

When set, this bit indicates that the DMA/MTL flushed the frame due to a software Flush command given by the CPU.

Bit 12 IPE : IP payload error

When set, this bit indicates that MAC transmitter detected an error in the TCP, UDP, or ICMP IP datagram payload. The transmitter checks the payload length received in the IPv4 or IPv6 header against the actual number of TCP, UDP or ICMP packet bytes received from the application and issues an error status in case of a mismatch.

Bit 11 LCA : Loss of carrier

When set, this bit indicates that a loss of carrier occurred during frame transmission (that is, the MII_CRS signal was inactive for one or more transmit clock periods during frame transmission). This is valid only for the frames transmitted without collision when the MAC operates in Half-duplex mode.

Bit 10 NC : No carrier

When set, this bit indicates that the Carrier Sense signal from the PHY was not asserted during transmission.

Bit 9 LCO : Late collision

When set, this bit indicates that frame transmission was aborted due to a collision occurring after the collision window (64 byte times, including preamble, in MII mode). This bit is not valid if the Underflow Error bit is set.

Bit 8 EC : Excessive collision

When set, this bit indicates that the transmission was aborted after 16 successive collisions while attempting to transmit the current frame. If the RD (Disable retry) bit in the MAC Configuration register is set, this bit is set after the first collision, and the transmission of the frame is aborted.

Bit 7 VF : VLAN frame

When set, this bit indicates that the transmitted frame was a VLAN-type frame.

Bits 6:3 CC : Collision count

This 4-bit counter value indicates the number of collisions occurring before the frame was transmitted. The count is not valid when the Excessive collisions bit (TDES0[8]) is set.

Bit 2 ED : Excessive deferral

When set, this bit indicates that the transmission has ended because of excessive deferral of over 24 288 bit times if the Deferral check (DC) bit in the MAC Control register is set high.

Bit 1 UF : Underflow error

When set, this bit indicates that the MAC aborted the frame because data arrived late from the RAM memory. Underflow error indicates that the DMA encountered an empty transmit buffer while transmitting the frame. The transmission process enters the Suspended state and sets both Transmit underflow (ETH_DMASR[5]) and Transmit interrupt (ETH_DMASR[0]).

Bit 0 DB : Deferred bit

When set, this bit indicates that the MAC defers before transmission because of the presence of the carrier. This bit is valid only in Half-duplex mode.

31302928272625242322212019181716
Res.Res.Res.TBS2
rwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
Res.Res.Res.TBS1
rwrwrwrwrwrwrwrwrwrwrwrwrw

31:29 Reserved, must be kept at reset value.

28:16 TBS2 : Transmit buffer 2 size

These bits indicate the second data buffer size in bytes. This field is not valid if TDES0[20] is set.

15:13 Reserved, must be kept at reset value.

12:0 TBS1 : Transmit buffer 1 size

These bits indicate the first data buffer byte size, in bytes. If this field is 0, the DMA ignores this buffer and uses Buffer 2 or the next descriptor, depending on the value of TCH (TDES0[20]).

TDES2 contains the address pointer to the first buffer of the descriptor or it contains time stamp data.

31302928272625242322212019181716
TBAP1/TBAP/TTSL
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
TBAP1/TBAP/TTSL
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 TBAP1 : Transmit buffer 1 address pointer / Transmit frame time stamp low

These bits have two different functions: they indicate to the DMA the location of data in memory, and after all data are transferred, the DMA can then use these bits to pass back time stamp data.

TBAP : When the software makes this descriptor available to the DMA (at the moment that the OWN bit is set to 1 in TDES0), these bits indicate the physical address of Buffer 1. There is no limitation on the buffer address alignment. See Host data buffer alignment on page 1795 for further details on buffer address alignment.

TTSL : Before it clears the OWN bit in TDES0, the DMA updates this field with the 32 least significant bits of the time stamp captured for the corresponding transmit frame (overwriting the value for TBAP1). This field has the time stamp only if time stamping is activated for this frame (see TTSE, TDES0 bit 25) and if the Last segment control bit (LS) in the descriptor is set.

TDES3 contains the address pointer either to the second buffer of the descriptor or the next descriptor, or it contains time stamp data.

31302928272625242322212019181716
TBAP2/TBAP2/TTSH
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
TBAP2/TBAP2/TTSH
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 TBAP2 : Transmit buffer 2 address pointer (Next descriptor address) / Transmit frame time stamp high

These bits have two different functions: they indicate to the DMA the location of data in memory, and after all data are transferred, the DMA can then use these bits to pass back time stamp data.

TBAP2 : When the software makes this descriptor available to the DMA (at the moment when the OWN bit is set to 1 in TDES0), these bits indicate the physical address of Buffer 2 when a descriptor ring structure is used. If the Second address chained (TDES1 [20]) bit is set, this address contains the pointer to the physical memory where the next descriptor is present. The buffer address pointer must be aligned to the bus width only when TDES1 [20] is set. (LSBs are ignored internally.)

TTSH : Before it clears the OWN bit in TDES0, the DMA updates this field with the 32 most significant bits of the time stamp captured for the corresponding transmit frame (overwriting the value for TBAP2). This field has the time stamp only if activated for this frame (see TDES0 bit 25, TTSE) and if the Last segment control bit (LS) in the descriptor is set.

Enhanced Tx DMA descriptors

Enhanced descriptors (enabled with EDFE=1, ETHDMABMR bit 7), must be used if time stamping is activated (TSE=1, ETH_PTPSCR bit 0) or if IPv4 checksum offload is activated (IPCO=1, ETH_MACCR bit 10).

Enhanced descriptors comprise eight 32-bit words, twice the size of normal descriptors. TDES0, TDES1, TDES2 and TDES3 have the same definitions as for normal transmit descriptors (refer to Normal Tx DMA descriptors ). TDES6 and TDES7 hold the time stamp. TDES4, TDES5, TDES6 and TDES7 are defined below.

When the Enhanced descriptor mode is selected, the software needs to allocate 32-bytes (8 DWORDS) of memory for every descriptor. When time stamping or IPv4 checksum offload are not being used, the enhanced descriptor format may be disabled and the software can use normal descriptors with the default size of 16 bytes.

Figure 566. Enhanced transmit descriptor

Diagram of Enhanced transmit descriptor structure showing 8 words (TDES 0 to TDES 7) with their respective fields and bit ranges.
310
TDES 0OWNCtrl [30:26]TSERes. 24Ctrl [23:20]Reserved [19:18]TSSStatus [16:0]
TDES 1Reserved [31:29]Buffer 2 byte count [28:16]Reserved [15:13]Buffer 1 byte count [12:0]
TDES 2Buffer 1 address [31:0]
TDES 3Buffer 2 address [31:0] or Next descriptor address [31:0]
TDES 4Reserved
TDES 5Reserved
TDES 6Time stamp low [31:0]
TDES 7Time stamp high [31:0]

ai17105b

Diagram of Enhanced transmit descriptor structure showing 8 words (TDES 0 to TDES 7) with their respective fields and bit ranges.
31302928272625242322212019181716
TTSL
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
TTSL
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 TTSL : Transmit frame time stamp low

This field is updated by DMA with the 32 least significant bits of the time stamp captured for the corresponding transmit frame. This field has the time stamp only if the Last segment control bit (LS) in the descriptor is set.

31302928272625242322212019181716
TTSH
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
TTSH
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 TTSH : Transmit frame time stamp high

This field is updated by DMA with the 32 most significant bits of the time stamp captured for the corresponding transmit frame. This field has the time stamp only if the Last segment control bit (LS) in the descriptor is set.

42.6.8 Rx DMA configuration

The Receive DMA engine's reception sequence is illustrated in Figure 567 and described below:

  1. 1. The CPU sets up Receive descriptors (RDES0-RDES3) and sets the OWN bit (RDES0[31]).
  2. 2. Once the SR (ETH_DMAOMR register[1]) bit is set, the DMA enters the Run state. While in the Run state, the DMA polls the receive descriptor list, attempting to acquire free descriptors. If the fetched descriptor is not free (is owned by the CPU), the DMA enters the Suspend state and jumps to Step 9.
  3. 3. The DMA decodes the receive data buffer address from the acquired descriptors.
  4. 4. Incoming frames are processed and placed in the acquired descriptor's data buffers.
  5. 5. When the buffer is full or the frame transfer is complete, the Receive engine fetches the next descriptor.
  6. 6. If the current frame transfer is complete, the DMA proceeds to step 7. If the DMA does not own the next fetched descriptor and the frame transfer is not complete (EOF is not yet transferred), the DMA sets the Descriptor error bit in RDES0 (unless flushing is disabled). The DMA closes the current descriptor (clears the OWN bit) and marks it as intermediate by clearing the Last segment (LS) bit in the RDES1 value (marks it as last descriptor if flushing is not disabled), then proceeds to step 8. If the DMA owns the next descriptor but the current frame transfer is not complete, the DMA closes the current descriptor as intermediate and returns to step 4.
  7. 7. If IEEE 1588 time stamping is enabled, the DMA writes the time stamp (if available) to the current descriptor's RDES2 and RDES3. It then takes the received frame's status and writes the status word to the current descriptor's RDES0, with the OWN bit cleared and the Last segment bit set.
  8. 8. The Receive engine checks the latest descriptor's OWN bit. If the CPU owns the descriptor (OWN bit is at 0) the Receive buffer unavailable bit (in ETH_DMASR register[7]) is set and the DMA Receive engine enters the Suspended state (step 9). If the DMA owns the descriptor, the engine returns to step 4 and awaits the next frame.
  9. 9. Before the Receive engine enters the Suspend state, partial frames are flushed from the Receive FIFO (you can control flushing using bit 24 in the ETH_DMAOMR register).
  10. 10. The Receive DMA exits the Suspend state when a Receive Poll demand is given or the start of next frame is available from the Receive FIFO. The engine proceeds to step 2 and re-fetches the next descriptor.

The DMA does not acknowledge accepting the status until it has completed the time stamp write-back and is ready to perform status write-back to the descriptor. If software has enabled time stamping through CSR, when a valid time stamp value is not available for the frame (for example, because the receive FIFO was full before the time stamp could be written to it), the DMA writes all ones to RDES2 and RDES3. Otherwise (that is, if time stamping is not enabled), RDES2 and RDES3 remain unchanged.

Figure 567. Receive DMA operation

Flowchart of Receive DMA operation showing the sequence from Start RxDMA to Stop RxDMA, including descriptor fetching, data writing, and error handling.
graph TD; Start[Start RxDMA] --> StopRxDMA[Stop RxDMA]; StopRxDMA --> FetchDesc[(Re-)Fetch next descriptor]; FetchDesc --> AHBError1{(AHB error?)}; AHBError1 -- Yes --> StopRxDMA; AHBError1 -- No --> OwnBitSet1{Own bit set?}; OwnBitSet1 -- Yes --> FrameDataAvail{Frame data available?}; OwnBitSet1 -- No --> FrameTransferComplete1{Frame transfer complete?}; FrameTransferComplete1 -- Yes --> RxDMASuspended[RxDMA suspended]; FrameTransferComplete1 -- No --> FlushDisabled1{Flush disabled?}; FlushDisabled1 -- Yes --> RxDMASuspended; FlushDisabled1 -- No --> FlushRemaining[Flush the remaining frame]; FlushRemaining --> RxDMASuspended; FrameDataAvail -- No --> WaitFrameData[Wait for frame data]; WaitFrameData --> WriteData[Write data to buffer(s)]; WriteData --> AHBError2{(AHB error?)}; AHBError2 -- Yes --> StopRxDMA; AHBError2 -- No --> FetchNextDesc[Fetch next descriptor]; FetchNextDesc --> AHBError3{(AHB error?)}; AHBError3 -- Yes --> StopRxDMA; AHBError3 -- No --> FrameTransferComplete2{Frame transfer complete?}; FrameTransferComplete2 -- Yes --> TimeStampPresent{Time stamp present?}; TimeStampPresent -- Yes --> WriteTimeStamp[Write time stamp to RDES2 & RDES3]; TimeStampPresent -- No --> CloseRDES0Last[Close RDES0 as last descriptor]; WriteTimeStamp --> AHBError4{(AHB error?)}; AHBError4 -- Yes --> StopRxDMA; AHBError4 -- No --> CloseRDES0Last; FrameTransferComplete2 -- No --> OwnBitSet2{Own bit set for next desc?}; OwnBitSet2 -- Yes --> CloseRDES0Int[Close RDES0 as intermediate descriptor]; OwnBitSet2 -- No --> FlushDisabled2{Flush disabled?}; FlushDisabled2 -- Yes --> CloseRDES0Int; FlushDisabled2 -- No --> SetError[Set descriptor error]; CloseRDES0Int --> CloseRDES0Last; CloseRDES0Last --> AHBError5{(AHB error?)}; AHBError5 -- Yes --> StopRxDMA; AHBError5 -- No --> FetchDesc; RxDMASuspended --> PollDemand[Poll demand/ new frame available]; PollDemand --> FetchDesc;
Flowchart of Receive DMA operation showing the sequence from Start RxDMA to Stop RxDMA, including descriptor fetching, data writing, and error handling.

ai15643

Receive descriptor acquisition

The receive engine always attempts to acquire an extra descriptor in anticipation of an incoming frame. Descriptor acquisition is attempted if any of the following conditions is/are satisfied:

Receive frame processing

The MAC transfers the received frames to the STM32F76xxx and STM32F77xxx memory only when the frame passes the address filter and the frame size is greater than or equal to the configurable threshold bytes set for the Receive FIFO, or when the complete frame is written to the FIFO in Store-and-forward mode. If the frame fails the address filtering, it is dropped in the MAC block itself (unless Receive All ETH_MACFFR [31] bit is set). Frames that are shorter than 64 bytes, because of collision or premature termination, can be purged from the Receive FIFO. After 64 (configurable threshold) bytes have been received, the DMA block begins transferring the frame data to the receive buffer pointed to by the current descriptor. The DMA sets the first descriptor (RDES0[9]) after the DMA AHB Interface becomes ready to receive a data transfer (if DMA is not fetching transmit data from the memory), to delimit the frame. The descriptors are released when the OWN (RDES0[31]) bit is reset to 0, either as the data buffer fills up or as the last segment of the frame is transferred to the receive buffer. If the frame is contained in a single descriptor, both the last descriptor (RDES0[8]) and first descriptor (RDES0[9]) bits are set. The DMA fetches the next descriptor, sets the last descriptor (RDES0[8]) bit, and releases the RDES0 status bits in the previous frame descriptor. Then the DMA sets the receive interrupt bit (ETH_DMASR register [6]). The same process repeats unless the DMA encounters a descriptor flagged as being owned by the CPU. If this occurs, the receive process sets the receive buffer unavailable bit (ETH_DMASR register[7]) and then enters the Suspend state. The position in the receive list is retained.

Receive process suspended

If a new receive frame arrives while the receive process is in Suspend state, the DMA re-fetches the current descriptor in the STM32F76xxx and STM32F77xxx memory. If the descriptor is now owned by the DMA, the receive process re-enters the Run state and starts frame reception. If the descriptor is still owned by the host, by default, the DMA discards the current frame at the top of the Rx FIFO and increments the missed frame counter. If more than one frame is stored in the Rx FIFO, the process repeats. The discarding or flushing of the frame at the top of the Rx FIFO can be avoided by setting the DMA Operation mode register bit 24 (DFRF). In such conditions, the receive process sets the receive buffer unavailable status bit and returns to the Suspend state.

Normal Rx DMA descriptors

The normal receive descriptor structure consists of four 32-bit words (16 bytes). These are shown in Figure 568 . The bit descriptions of RDES0, RDES1, RDES2 and RDES3 are given below.

Note that enhanced descriptors must be used if time stamping is activated (TSE=1, ETH_PTPTSCR bit 0) or if IPv4 checksum offload is activated (IPCO=1, ETH_MACCR bit 10).

Figure 568. Normal Rx DMA descriptor structure

Diagram of Normal Rx DMA descriptor structure showing four 32-bit words (RDES 0 to RDES 3). RDES 0 contains OWN and Status [30:0]. RDES 1 contains CTRL, Reserved [30:29], Buffer 2 byte count [28:16], CTRL [15:14], Res., and Buffer 1 byte count [12:0]. RDES 2 contains Buffer 1 address [31:0]. RDES 3 contains Buffer 2 address [31:0] or Next descriptor address [31:0].
RDES 0O
W
N
Status [30:0]
CT
RL
Reserved [30:29]Buffer 2 byte count [28:16]CTRL [15:14]Res.Buffer 1 byte count [12:0]
RDES 2Buffer 1 address [31:0]
RDES 3Buffer 2 address [31:0] or Next descriptor address [31:0]

ai15644

Diagram of Normal Rx DMA descriptor structure showing four 32-bit words (RDES 0 to RDES 3). RDES 0 contains OWN and Status [30:0]. RDES 1 contains CTRL, Reserved [30:29], Buffer 2 byte count [28:16], CTRL [15:14], Res., and Buffer 1 byte count [12:0]. RDES 2 contains Buffer 1 address [31:0]. RDES 3 contains Buffer 2 address [31:0] or Next descriptor address [31:0].

RDES0 contains the received frame status, the frame length and the descriptor ownership information.

31302928272625242322212019181716
OWNAFMFL
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
ESDESAFLEOEVLANFSLSIPHCE/TSVLCOFTRWTREDECEPCE/ESA
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 OWN: Own bit

When set, this bit indicates that the descriptor is owned by the DMA of the MAC Subsystem. When this bit is reset, it indicates that the descriptor is owned by the Host. The DMA clears this bit either when it completes the frame reception or when the buffers that are associated with this descriptor are full.

Bit 30 AFM: Destination address filter fail

When set, this bit indicates a frame that failed the DA filter in the MAC Core.

Bits 29:16 FL: Frame length

These bits indicate the byte length of the received frame that was transferred to host memory (including CRC). This field is valid only when last descriptor (RDES0[8]) is set and descriptor error (RDES0[14]) is reset.

This field is valid when last descriptor (RDES0[8]) is set. When the last descriptor and error summary bits are not set, this field indicates the accumulated number of bytes that have been transferred for the current frame.

Bit 15 ES: Error summary

Indicates the logical OR of the following bits:

RDES0[1]: CRC error

RDES0[3]: Receive error

RDES0[4]: Watchdog timeout

RDES0[6]: Late collision

RDES0[7]: Giant frame (This is not applicable when RDES0[7] indicates an IPv4 header checksum error.)

RDES0[11]: Overflow error

RDES0[14]: Descriptor error.

This field is valid only when the last descriptor (RDES0[8]) is set.

Bit 14 DE: Descriptor error

When set, this bit indicates a frame truncation caused by a frame that does not fit within the current descriptor buffers, and that the DMA does not own the next descriptor. The frame is truncated.

This field is valid only when the last descriptor (RDES0[8]) is set.

Bit 13 SAF: Source address filter fail

When set, this bit indicates that the SA field of frame failed the SA filter in the MAC Core.

Bit 12 LE: Length error

When set, this bit indicates that the actual length of the received frame does not match the value in the Length/ Type field. This bit is valid only when the Frame type (RDES0[5]) bit is reset.

Bit 11 OE: Overflow error

When set, this bit indicates that the received frame was damaged due to buffer overflow.

Bit 10 VLAN: VLAN tag

When set, this bit indicates that the frame pointed to by this descriptor is a VLAN frame tagged by the MAC core.

Bit 9 FS: First descriptor

When set, this bit indicates that this descriptor contains the first buffer of the frame. If the size of the first buffer is 0, the second buffer contains the beginning of the frame. If the size of the second buffer is also 0, the next descriptor contains the beginning of the frame.

Bit 8 LS: Last descriptor

When set, this bit indicates that the buffers pointed to by this descriptor are the last buffers of the frame.

Bit 7 IPHCE/TSV: IPv header checksum error / time stamp valid

If IPHCE is set, it indicates an error in the IPv4 or IPv6 header. This error can be due to inconsistent Ethernet Type field and IP header Version field values, a header checksum mismatch in IPv4, or an Ethernet frame lacking the expected number of IP header bytes. This bit can take on special meaning as specified in Table 317 .

If enhanced descriptor format is enabled (EDFE=1, bit 7 of ETH_DMABMR), this bit takes on the TSV function (otherwise it is IPHCE). When TSV is set, it indicates that a snapshot of the timestamp is written in descriptor words 6 (RDES6) and 7 (RDES7). TSV is valid only when the Last descriptor bit (RDES0[8]) is set.

Bit 6 LCO: Late collision

When set, this bit indicates that a late collision has occurred while receiving the frame in Half-duplex mode.

Bit 5 FT: Frame type

When set, this bit indicates that the Receive frame is an Ethernet-type frame (the LT field is greater than or equal to 0x0600). When this bit is reset, it indicates that the received frame is an IEEE802.3 frame. This bit is not valid for Runt frames less than 14 bytes. When the normal descriptor format is used (ETH_DMABMR EDFE=0), FT can take on special meaning as specified in Table 317 .

Bit 4 RWT: Receive watchdog timeout

When set, this bit indicates that the Receive watchdog timer has expired while receiving the current frame and the current frame is truncated after the watchdog timeout.

Bit 3 RE: Receive error

When set, this bit indicates that the RX_ERR signal is asserted while RX_DV is asserted during frame reception.

Bit 2 DE: Dribble bit error

When set, this bit indicates that the received frame has a non-integer multiple of bytes (odd nibbles). This bit is valid only in MII mode.

Bit 1 CE: CRC error

When set, this bit indicates that a cyclic redundancy check (CRC) error occurred on the received frame. This field is valid only when the last descriptor (RDES0[8]) is set.

Bit 0 PCE/ESA: Payload checksum error / extended status available

When set, it indicates that the TCP, UDP or ICMP checksum the core calculated does not match the received encapsulated TCP, UDP or ICMP segment's Checksum field. This bit is also set when the received number of payload bytes does not match the value indicated in the Length field of the encapsulated IPv4 or IPv6 datagram in the received Ethernet frame. This bit can take on special meaning as specified in Table 317 .

If the enhanced descriptor format is enabled (EDFE=1, bit 7 in ETH_DMABMR), this bit takes on the ESA function (otherwise it is PCE). When ESA is set, it indicates that the extended status is available in descriptor word 4 (RDES4). ESA is valid only when the last descriptor bit (RDES0[8]) is set.

Bits 5, 7, and 0 reflect the conditions discussed in Table 317 .

Table 317. Receive descriptor 0 - encoding for bits 7, 5 and 0 (normal descriptor format only, EDFE=0)
Bit 5: frame typeBit 7: IPC checksum errorBit 0: payload checksum errorFrame status
000IEEE 802.3 Type frame (Length field value is less than 0x0600.)
100IPv4/IPv6 Type frame, no checksum error detected
101IPv4/IPv6 Type frame with a payload checksum error (as described for PCE) detected
110IPv4/IPv6 Type frame with an IP header checksum error (as described for IPC CE) detected
111IPv4/IPv6 Type frame with both IP header and payload checksum errors detected
001IPv4/IPv6 Type frame with no IP header checksum error and the payload check bypassed, due to an unsupported payload
011A Type frame that is neither IPv4 or IPv6 (the checksum offload engine bypasses checksum completely.)
010Reserved
31302928272625242322212019181716
DICRes.Res.RBS2
rwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
RERRCHRes.RBS
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 DIC : Disable interrupt on completion

When set, this bit prevents setting the Status register's RS bit (CSR5[6]) for the received frame ending in the buffer indicated by this descriptor. This, in turn, disables the assertion of the interrupt to Host due to RS for that frame.

Bits 30:29 Reserved, must be kept at reset value.

Bits 28:16 RBS2 : Receive buffer 2 size

These bits indicate the second data buffer size, in bytes. The buffer size must be a multiple of 4, 8, or 16, depending on the bus widths (32, 64 or 128, respectively), even if the value of RDES3 (buffer2 address pointer) is not aligned to bus width. If the buffer size is not an appropriate multiple of 4, 8 or 16, the resulting behavior is undefined. This field is not valid if RDES1 [14] is set.

Bit 15 RER : Receive end of ring

When set, this bit indicates that the descriptor list reached its final descriptor. The DMA returns to the base address of the list, creating a descriptor ring.

Bit 14 RCH : Second address chained

When set, this bit indicates that the second address in the descriptor is the next descriptor address rather than the second buffer address. When this bit is set, RBS2 (RDES1[28:16]) is a “don’t care” value. RDES1[15] takes precedence over RDES1[14].

Bit 13 Reserved, must be kept at reset value.

Bits 12:0 RBS1 : Receive buffer 1 size

Indicates the first data buffer size in bytes. The buffer size must be a multiple of 4, 8 or 16, depending upon the bus widths (32, 64 or 128), even if the value of RDES2 (buffer1 address pointer) is not aligned. When the buffer size is not a multiple of 4, 8 or 16, the resulting behavior is undefined. If this field is 0, the DMA ignores this buffer and uses Buffer 2 or next descriptor depending on the value of RCH (bit 14).

RDES2 contains the address pointer to the first data buffer in the descriptor, or it contains time stamp data.

31302928272625242322212019181716
RBP1 / RTSL
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
RBP1 / RTSL
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 RBAP1 / RTSL : Receive buffer 1 address pointer / Receive frame time stamp low

These bits take on two different functions: the application uses them to indicate to the DMA where to store the data in memory, and then after transferring all the data the DMA may use these bits to pass back time stamp data.

RBAP1 : When the software makes this descriptor available to the DMA (at the moment that the OWN bit is set to 1 in RDES0), these bits indicate the physical address of Buffer 1. There are no limitations on the buffer address alignment except for the following condition: the DMA uses the configured value for its address generation when the RDES2 value is used to store the start of frame. Note that the DMA performs a write operation with the RDES2[3/2/1:0] bits as 0 during the transfer of the start of frame but the frame data is shifted as per the actual Buffer address pointer. The DMA ignores RDES2[3/2/1:0] (corresponding to bus width of 128/64/32) if the address pointer is to a buffer where the middle or last part of the frame is stored.

RTSL : Before it clears the OWN bit in RDES0, the DMA updates this field with the 32 least significant bits of the time stamp captured for the corresponding receive frame (overwriting the value for RBAP1). This field has the time stamp only if time stamping is activated for this frame and if the Last segment control bit (LS) in the descriptor is set.

RDES3 contains the address pointer either to the second data buffer in the descriptor or to the next descriptor, or it contains time stamp data.

31302928272625242322212019181716
RBP2 / RTSH
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
RBP2 / RTSH
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 RBAP2 / RTSH : Receive buffer 2 address pointer (next descriptor address) / Receive frame time stamp high

These bits take on two different functions: the application uses them to indicate to the DMA the location of where to store the data in memory, and then after transferring all the data the DMA may use these bits to pass back time stamp data.

RBAP1 : When the software makes this descriptor available to the DMA (at the moment that the OWN bit is set to 1 in RDES0), these bits indicate the physical address of buffer 2 when a descriptor ring structure is used. If the second address chained (RDES1 [24]) bit is set, this address contains the pointer to the physical memory where the next descriptor is present. If RDES1 [24] is set, the buffer (next descriptor) address pointer must be bus width-aligned (RDES3[3, 2, or 1:0] = 0, corresponding to a bus width of 128, 64 or 32. LSBs are ignored internally.) However, when RDES1 [24] is reset, there are no limitations on the RDES3 value, except for the following condition: the DMA uses the configured value for its buffer address generation when the RDES3 value is used to store the start of frame. The DMA ignores RDES3[3, 2, or 1:0] (corresponding to a bus width of 128, 64 or 32) if the address pointer is to a buffer where the middle or last part of the frame is stored.

RTSH : Before it clears the OWN bit in RDES0, the DMA updates this field with the 32 most significant bits of the time stamp captured for the corresponding receive frame (overwriting the value for RBAP2). This field has the time stamp only if time stamping is activated and if the Last segment control bit (LS) in the descriptor is set.

Enhanced Rx DMA descriptors format with IEEE1588 time stamp

Enhanced descriptors (enabled with EDFE=1, ETHDMABMR bit 7), must be used if time stamping is activated (TSE=1, ETH_PTPSCR bit 0) or if IPv4 checksum offload is activated (IPCO=1, ETH_MACCR bit 10).

Enhanced descriptors comprise eight 32-bit words, twice the size of normal descriptors. RDES0, RDES1, RDES2 and RDES3 have the same definitions as for normal receive descriptors (refer to Normal Rx DMA descriptors ). RDES4 contains extended status while RDES6 and RDES7 hold the time stamp. RDES4, RDES5, RDES6 and RDES7 are defined below.

When the Enhanced descriptor mode is selected, the software needs to allocate 32 bytes (8 DWORDS) of memory for every descriptor. When time stamping or IPv4 checksum offload are not being used, the enhanced descriptor format may be disabled and the software can use normal descriptors with the default size of 16 bytes.

Figure 569. Enhanced receive descriptor field format with IEEE1588 time stamp enabled

Diagram of Enhanced receive descriptor field format with IEEE1588 time stamp enabled. It shows 8 receive descriptors (RDES 0 to 7). RDES 0 contains OWN and Status [30:0]. RDES 1 contains CT, Reserved [30:29], Buffer 2 byte count [28:16], CTRL [15:14], Res., and Buffer 1 byte count [12:0]. RDES 2 contains Buffer 1 address [31:0]. RDES 3 contains Buffer 2 address [31:0] or Next descriptor address [31:0]. RDES 4 contains Extended Status [31:0]. RDES 5 contains Reserved. RDES 6 contains Time stamp low [31:0]. RDES 7 contains Time stamp high [31:0].
310
RDES 0OWNStatus [30:0]
RDES 1CT
RL
Reserved [30:29]Buffer 2 byte count [28:16]CTRL [15:14]Res.Buffer 1 byte count [12:0]
RDES 2Buffer 1 address [31:0]
RDES 3Buffer 2 address [31:0] or Next descriptor address [31:0]
RDES 4Extended Status [31:0]
RDES 5Reserved
RDES 6Time stamp low [31:0]
RDES 7Time stamp high [31:0]

ai17104

Diagram of Enhanced receive descriptor field format with IEEE1588 time stamp enabled. It shows 8 receive descriptors (RDES 0 to 7). RDES 0 contains OWN and Status [30:0]. RDES 1 contains CT, Reserved [30:29], Buffer 2 byte count [28:16], CTRL [15:14], Res., and Buffer 1 byte count [12:0]. RDES 2 contains Buffer 1 address [31:0]. RDES 3 contains Buffer 2 address [31:0] or Next descriptor address [31:0]. RDES 4 contains Extended Status [31:0]. RDES 5 contains Reserved. RDES 6 contains Time stamp low [31:0]. RDES 7 contains Time stamp high [31:0].

The extended status, shown below, is valid only when there is status related to IPv4 checksum or time stamp available as indicated by bit 0 in RDES0.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.PVPFTPMTIPv6PRIPv4PRIPCBIPPEIPHEIPPT
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:14 Reserved, must be kept at reset value.

Bit 13 PV : PTP version

When set, indicates that the received PTP message uses the IEEE 1588 version 2 format. When cleared, it uses version 1 format. This is valid only if the message type is non-zero.

Bit 12 PFT : PTP frame type

When set, this bit indicates that the PTP message is sent directly over Ethernet. When this bit is cleared and the message type is non-zero, it indicates that the PTP message is sent over UDP-IPv4 or UDP-IPv6. The information on IPv4 or IPv6 can be obtained from bits 6 and 7.

Bits 11:8 PMT : PTP message type

These bits are encoded to give the type of the message received.

Bit 7 IPV6PR : IPv6 packet received

When set, this bit indicates that the received packet is an IPv6 packet.

Bit 6 IPV4PR : IPv4 packet received

When set, this bit indicates that the received packet is an IPv4 packet.

Bit 5 IPCB : IP checksum bypassed

When set, this bit indicates that the checksum offload engine is bypassed.

Bit 4 IPPE : IP payload error

When set, this bit indicates that the 16-bit IP payload checksum (that is, the TCP, UDP, or ICMP checksum) that the core calculated does not match the corresponding checksum field in the received segment. It is also set when the TCP, UDP, or ICMP segment length does not match the payload length value in the IP Header field.

Bit 3 IPHE : IP header error

When set, this bit indicates either that the 16-bit IPv4 header checksum calculated by the core does not match the received checksum bytes, or that the IP datagram version is not consistent with the Ethernet Type value.

Bits 2:0 IPPT : IP payload type

if IPv4 checksum offload is activated (IPCO=1, ETH_MACCR bit 10), these bits indicate the type of payload encapsulated in the IP datagram. These bits are '00' if there is an IP header error or fragmented IP.

Reserved.

The table below describes the fields that have different meaning for RDES6 when the receive descriptor is closed and time stamping is enabled.

31302928272625242322212019181716
RTSL
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
RTSL
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 RTSL : Receive frame time stamp low

The DMA updates this field with the 32 least significant bits of the time stamp captured for the corresponding receive frame. The DMA updates this field only for the last descriptor of the receive frame indicated by last descriptor status bit (RDES0[8]). When this field and the RTSH field in RDES7 show all ones, the time stamp must be treated as corrupt.

The table below describes the fields that have a different meaning for RDES7 when the receive descriptor is closed and time stamping is enabled.

31302928272625242322212019181716
RTSH
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
RTSH
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 RTSH : Receive frame time stamp high

The DMA updates this field with the 32 most significant bits of the time stamp captured for the corresponding receive frame. The DMA updates this field only for the last descriptor of the receive frame indicated by last descriptor status bit (RDES0[8]).

When this field and RDES7's RTSL field show all ones, the time stamp must be treated as corrupt.

42.6.9 DMA interrupts

Interrupts can be generated as a result of various events. The ETH_DMASR register contains all the bits that might cause an interrupt. The ETH_DMAIER register contains an enable bit for each of the events that can cause an interrupt.

There are two groups of interrupts, Normal and Abnormal, as described in the ETH_DMASR register. Interrupts are cleared by writing a 1 to the corresponding bit position. When all the enabled interrupts within a group are cleared, the corresponding summary bit is cleared. If the MAC core is the cause for assertion of the interrupt, then any of the TSTS or PMTS bits in the ETH_DMASR register is set high.

Interrupts are not queued and if the interrupt event occurs before the driver has responded to it, no additional interrupts are generated. For example, the Receive Interrupt bit (ETH_DMASR register [6]) indicates that one or more frames were transferred to the STM32F76xxx and STM32F77xxx buffer. The driver must scan all descriptors, from the last recorded position to the first one owned by the DMA.

An interrupt is generated only once for simultaneous, multiple events. The driver must scan the ETH_DMASR register for the cause of the interrupt. The interrupt is not generated again unless a new interrupting event occurs, after the driver has cleared the appropriate bit in the

ETH_DMASR register. For example, the controller generates a Receive interrupt (ETH_DMASR register[6]) and the driver begins reading the ETH_DMASR register. Next, receive buffer unavailable (ETH_DMASR register[7]) occurs. The driver clears the Receive interrupt. Even then, a new interrupt is generated, due to the active or pending Receive buffer unavailable interrupt.

Figure 570. Interrupt scheme

Figure 570. Interrupt scheme diagram showing the logic for generating Ethernet interrupts from various status and interrupt enable bits.

The diagram illustrates the interrupt scheme for the Ethernet MAC. It consists of two main logic paths that feed into a final OR gate to generate the 'Interrupt' signal.

Top Path (Normal Interrupts):

Bottom Path (Wake-up Interrupts):

Figure 570. Interrupt scheme diagram showing the logic for generating Ethernet interrupts from various status and interrupt enable bits.

ai15646

42.7 Ethernet interrupts

The Ethernet controller has two interrupt vectors: one dedicated to normal Ethernet operations and the other, used only for the Ethernet wakeup event (with wakeup frame or Magic Packet detection) when it is mapped on EXTI line 19.

The first Ethernet vector is reserved for interrupts generated by the MAC and the DMA as listed in the MAC interrupts and DMA interrupts sections.

The second vector is reserved for interrupts generated by the PMT on wakeup events. The mapping of a wakeup event on EXTI line 19 causes the STM32F76xxx and STM32F77xxx to exit the low-power mode, and generates an interrupt.

When an Ethernet wakeup event mapped on EXTI Line 19 occurs and the MAC PMT interrupt is enabled and the EXTI Line 19 interrupt, with detection on rising edge, is also enabled, both interrupts are generated.

A watchdog timer (see ETH_DMASWTR register) is given for flexible control of the RS bit (ETH_DMASR register). When this watchdog timer is programmed with a non-zero value, it

gets activated as soon as the RxDMA completes a transfer of a received frame to system memory without asserting the Receive Status because it is not enabled in the corresponding Receive descriptor (RDES1[31]). When this timer runs out as per the programmed value, the RS bit is set and the interrupt is asserted if the corresponding RIE is enabled in the ETH_DMAIER register. This timer is disabled before it runs out, when a frame is transferred to memory and the RS is set because it is enabled for that descriptor.

Note: Reading the PMT control and status register automatically clears the Wakeup Frame Received and Magic Packet Received PMT interrupt flags. However, since the registers for these flags are in the CLK_RX domain, there may be a significant delay before this update is visible by the firmware. The delay is especially long when the RX clock is slow (in 10 Mbit mode) and when the AHB bus is high-frequency. Since interrupt requests from the PMT to the CPU are based on the same registers in the CLK_RX domain, the CPU may spuriously call the interrupt routine a second time even after reading PMT_CSR. Thus, it may be necessary that the firmware polls the Wakeup Frame Received and Magic Packet Received bits and exits the interrupt service routine only when they are found to be at '0'.

42.8 Ethernet registers

The peripheral registers can be accessed by bytes (8-bit), half-words (16-bit) or words (32-bit).

42.8.1 MAC register description

Ethernet MAC configuration register (ETH_MACCR)

Address offset: 0x0000

Reset value: 0x0000 8000

The MAC configuration register is the operation mode register of the MAC. It establishes receive and transmit operating modes.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.CSTFRes.WDJDRes.Res.IFG[2:0]CSD
rwrwrwrwrwrwrw
1514131211109876543210
Res.FESRODLMDMIPCORDRes.APCSBL[1:0]DCTERERes.Res.
rwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:26 Reserved, must be kept at reset value.

Bit 25 CSTF : CRC stripping for Type frames

When set, the last 4 bytes (FCS) of all frames of Ether type (type field greater than 0x0600) will be stripped and dropped before forwarding the frame to the application.

Bit 24 Reserved, must be kept at reset value.

Bit 23 WD : Watchdog disable

When this bit is set, the MAC disables the watchdog timer on the receiver, and can receive frames of up to 16 384 bytes.

When this bit is reset, the MAC allows no more than 2 048 bytes of the frame being received and cuts off any bytes received after that.

Bit 22 JD : Jabber disable

When this bit is set, the MAC disables the jabber timer on the transmitter, and can transfer frames of up to 16 384 bytes.

When this bit is reset, the MAC cuts off the transmitter if the application sends out more than 2 048 bytes of data during transmission.

Bits 21:20 Reserved, must be kept at reset value.

Bits 19:17 IFG[2:0] : Interframe gap

These bits control the minimum interframe gap between frames during transmission.

000: 96 bit times

001: 88 bit times

010: 80 bit times

...

111: 40 bit times

Note: In Half-duplex mode, the minimum IFG can be configured for 64 bit times (IFG[2:0] = 100) only. Lower values are not considered.

Bit 16 CSD : Carrier sense disable

When set high, this bit makes the MAC transmitter ignore the MII CRS signal during frame transmission in Half-duplex mode. No error is generated due to Loss of Carrier or No Carrier during such transmission.

When this bit is low, the MAC transmitter generates such errors due to Carrier Sense and even aborts the transmissions.

Bit 15 Reserved, must be kept at reset value.

Bit 14 FES : Fast Ethernet speed

Indicates the speed in Fast Ethernet (MII) mode:

0: 10 Mbit/s

1: 100 Mbit/s

Bit 13 ROD : Receive own disable

When this bit is set, the MAC disables the reception of frames in Half-duplex mode.

When this bit is reset, the MAC receives all packets that are given by the PHY while transmitting.

This bit is not applicable if the MAC is operating in Full-duplex mode.

Bit 12 LM : Loopback mode

When this bit is set, the MAC operates in loopback mode at the MII. The MII receive clock input (RX_CLK) is required for the loopback to work properly, as the transmit clock is not looped-back internally.

Bit 11 DM : Duplex mode

When this bit is set, the MAC operates in a Full-duplex mode where it can transmit and receive simultaneously.

Bit 10 IPCO : IPv4 checksum offload

When set, this bit enables IPv4 checksum checking for received frame payloads' TCP/UDP/ICMP headers. When this bit is reset, the checksum offload function in the receiver is disabled and the corresponding PCE and IP HCE status bits (see Table 314 ) are always cleared.

Bit 9 RD: Retry disable

When this bit is set, the MAC attempts only 1 transmission. When a collision occurs on the MII, the MAC ignores the current frame transmission and reports a Frame Abort with excessive collision error in the transmit frame status.

When this bit is reset, the MAC attempts retries based on the settings of BL.

Note: This bit is applicable only in the Half-duplex mode.

Bit 8 Reserved, must be kept at reset value. Bit 7 APCs: Automatic pad/CRC stripping

When this bit is set, the MAC strips the Pad/FCS field on incoming frames only if the length's field value is less than or equal to 1 500 bytes. All received frames with length field greater than or equal to 1 501 bytes are passed on to the application without stripping the Pad/FCS field.

When this bit is reset, the MAC passes all incoming frames unmodified.

Bits 6:5 BL[1:0]: Back-off limit

The Back-off limit determines the random integer number ( \( r \) ) of slot time delays (4 096 bit times for 1000 Mbit/s and 512 bit times for 10/100 Mbit/s) the MAC waits before rescheduling a transmission attempt during retries after a collision.

Note: This bit is applicable only to Half-duplex mode.

00: \( k = \min(n, 10) \)

01: \( k = \min(n, 8) \)

10: \( k = \min(n, 4) \)

11: \( k = \min(n, 1) \) ,

where \( n \) = retransmission attempt. The random integer \( r \) takes the value in the range \( 0 \leq r \leq 2^k \)

Bit 4 DC: Deferral check

When this bit is set, the deferral check function is enabled in the MAC. The MAC issues a Frame Abort status, along with the excessive deferral error bit set in the transmit frame status when the transmit state machine is deferred for more than 24 288 bit times in 10/100-Mbit/s mode. Deferral begins when the transmitter is ready to transmit, but is prevented because of an active CRS (carrier sense) signal on the MII. Defer time is not cumulative. If the transmitter defers for 10 000 bit times, then transmits, collides, backs off, and then has to defer again after completion of back-off, the deferral timer resets to 0 and restarts.

When this bit is reset, the deferral check function is disabled and the MAC defers until the CRS signal goes inactive. This bit is applicable only in Half-duplex mode.

Bit 3 TE: Transmitter enable

When this bit is set, the transmit state machine of the MAC is enabled for transmission on the MII. When this bit is reset, the MAC transmit state machine is disabled after the completion of the transmission of the current frame, and does not transmit any further frames.

Bit 2 RE: Receiver enable

When this bit is set, the receiver state machine of the MAC is enabled for receiving frames from the MII. When this bit is reset, the MAC receive state machine is disabled after the completion of the reception of the current frame, and will not receive any further frames from the MII.

Bits 1:0 Reserved, must be kept at reset value.

Ethernet MAC frame filter register (ETH_MACFFR)

Address offset: 0x0004

Reset value: 0x0000 0000

The MAC frame filter register contains the filter controls for receiving frames. Some of the controls from this register go to the address check block of the MAC, which performs the first level of address filtering. The second level of filtering is performed on the incoming frame, based on other controls such as pass bad frames and pass control frames.

31302928272625242322212019181716
RARes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
rw

1514131211109876543210
Res.Res.Res.Res.Res.HPFSAFSAIFPCF[1:0]BFDPAMDAIFHMHUPM
rwrwrwrwrwrwrwrwrwrw

Bit 31 RA: Receive all

When this bit is set, the MAC receiver passes all received frames on to the application, irrespective of whether they have passed the address filter. The result of the SA/DA filtering is updated (pass or fail) in the corresponding bits in the receive status word. When this bit is reset, the MAC receiver passes on to the application only those frames that have passed the SA/DA address filter.

Bits 30:11 Reserved, must be kept at reset value.

Bit 10 HPF: Hash or perfect filter

When this bit is set and if the HM or HU bit is set, the address filter passes frames that match either the perfect filtering or the hash filtering.

When this bit is cleared and if the HU or HM bit is set, only frames that match the Hash filter are passed.

Bit 9 SAF: Source address filter

The MAC core compares the SA field of the received frames with the values programmed in the enabled SA registers. If the comparison matches, then the SAMatch bit in the RxStatus word is set high. When this bit is set high and the SA filter fails, the MAC drops the frame. When this bit is reset, the MAC core forwards the received frame to the application. It also forwards the updated SA Match bit in RxStatus depending on the SA address comparison.

Bit 8 SAIF: Source address inverse filtering

When this bit is set, the address check block operates in inverse filtering mode for the SA address comparison. The frames whose SA matches the SA registers are marked as failing the SA address filter.

When this bit is reset, frames whose SA does not match the SA registers are marked as failing the SA address filter.

Bits 7:6 PCF[1:0]: Pass control frames

These bits control the forwarding of all control frames (including unicast and multicast PAUSE frames). Note that the processing of PAUSE control frames depends only on RFCE in Flow Control Register[2].

00: MAC prevents all control frames from reaching the application

01: MAC forwards all control frames to application except Pause control frames

10: MAC forwards all control frames to application even if they fail the address filter

11: MAC forwards control frames that pass the address filter.

These bits control the forwarding of all control frames (including unicast and multicast PAUSE frames). Note that the processing of PAUSE control frames depends only on RFCE in Flow Control Register[2].

00 or 01: MAC prevents all control frames from reaching the application

10: MAC forwards all control frames to application even if they fail the address filter

11: MAC forwards control frames that pass the address filter.

Bit 5 BFD: Broadcast frames disable

When this bit is set, the address filters filter all incoming broadcast frames.

When this bit is reset, the address filters pass all received broadcast frames.

Bit 4 PAM: Pass all multicast

When set, this bit indicates that all received frames with a multicast destination address (first bit in the destination address field is '1') are passed.

When reset, filtering of multicast frame depends on the HM bit.

Bit 3 DAIF: Destination address inverse filtering

When this bit is set, the address check block operates in inverse filtering mode for the DA address comparison for both unicast and multicast frames.

When reset, normal filtering of frames is performed.

Bit 2 HM: Hash multicast

When set, MAC performs destination address filtering of received multicast frames according to the hash table.

When reset, the MAC performs a perfect destination address filtering for multicast frames, that is, it compares the DA field with the values programmed in DA registers.

Bit 1 HU: Hash unicast

When set, MAC performs destination address filtering of unicast frames according to the hash table.

When reset, the MAC performs a perfect destination address filtering for unicast frames, that is, it compares the DA field with the values programmed in DA registers.

Bit 0 PM: Promiscuous mode

When this bit is set, the address filters pass all incoming frames regardless of their destination or source address. The SA/DA filter fails status bits in the receive status word are always cleared when PM is set.

Ethernet MAC hash table high register (ETH_MACHTHR)

Address offset: 0x0008

Reset value: 0x0000 0000

The 64-bit Hash table is used for group address filtering. For hash filtering, the contents of the destination address in the incoming frame are passed through the CRC logic, and the upper 6 bits in the CRC register are used to index the contents of the Hash table. This CRC

is a 32-bit value coded by the following polynomial (for more details refer to Section 42.5.3: MAC frame reception ):

\[ G(x) = x^{32} + x^{26} + x^{23} + x^{22} + x^{16} + x^{12} + x^{11} + x^{10} + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1 \]

The most significant bit determines the register to be used (hash table high/hash table low), and the other 5 bits determine which bit within the register. A hash value of 0b0 0000 selects bit 0 in the selected register, and a value of 0b1 1111 selects bit 31 in the selected register.

For example, if the DA of the incoming frame is received as 0x1F52 419C B6AF (0x1F is the first byte received on the MII interface), then the internally calculated 6-bit Hash value is 0x2C and the HTH register bit[12] is checked for filtering. If the DA of the incoming frame is received as 0xA00A 9800 0045, then the calculated 6-bit Hash value is 0x07 and the HTL register bit[7] is checked for filtering.

If the corresponding bit value in the register is 1, the frame is accepted. Otherwise, it is rejected. If the PAM (pass all multicast) bit is set in the ETH_MACFFR register, then all multicast frames are accepted regardless of the multicast hash values.

The Hash table high register contains the higher 32 bits of the multicast Hash table.

31302928272625242322212019181716
HTH[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
HTH[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 HTH[31:0] : Hash table high

This field contains the upper 32 bits of Hash table.

Ethernet MAC hash table low register (ETH_MACHTLR)

Address offset: 0x000C

Reset value: 0x0000 0000

The Hash table low register contains the lower 32 bits of the multi-cast Hash table.

31302928272625242322212019181716
HTL[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
HTL[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 HTL[31:0] : Hash table low

This field contains the lower 32 bits of the Hash table.

Ethernet MAC MII address register (ETH_MACMIAR)

Address offset: 0x0010

Reset value: 0x0000 0000

The MII address register controls the management cycles to the external PHY through the management interface.

31302928272625242322212019181716
ResResResResResResResResResResResResResResResRes
1514131211109876543210
PA[4:0]MR[4:0]Res.CR[2:0]MWMB
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrc_w1

Bits 31:16 Reserved, must be kept at reset value.

Bits 15:11 PA[4:0] : PHY address

This field tells which of the 32 possible PHY devices are being accessed.

Bits 10:6 MR[4:0] : MII register

These bits select the desired MII register in the selected PHY device.

Bit 5 Reserved, must be kept at reset value.

Bits 4:2 CR[2:0] : Clock range

The CR clock range selection determines the HCLK frequency and is used to decide the frequency of the MDC clock:

Selection HCLK MDC Clock

000 60-100 MHz HCLK/42

001 100-150 MHz HCLK/62

010 20-35 MHz HCLK/16

011 35-60 MHz HCLK/26

100 150-216 MHz HCLK/102

101, 110, 111 Reserved

Bit 1 MW : MII write

When set, this bit tells the PHY that this will be a Write operation using the MII Data register. If this bit is not set, this will be a Read operation, placing the data in the MII Data register.

Bit 0 MB : MII busy

This bit should read a logic 0 before writing to ETH_MACMIIAR and ETH_MACMIIIDR. This bit must also be reset to 0 during a Write to ETH_MACMIIAR. During a PHY register access, this bit is set to 0b1 by the application to indicate that a read or write access is in progress. ETH_MACMIIIDR (MII Data) should be kept valid until this bit is cleared by the MAC during a PHY Write operation. The ETH_MACMIIIDR is invalid until this bit is cleared by the MAC during a PHY Read operation. The ETH_MACMIIAR (MII Address) should not be written to until this bit is cleared.

Ethernet MAC MII data register (ETH_MACMIIIDR)

Address offset: 0x0014

Reset value: 0x0000 0000

The MAC MII Data register stores write data to be written to the PHY register located at the address specified in ETH_MACMIIAR. ETH_MACMIIIDR also stores read data from the PHY register located at the address specified by ETH_MACMIIAR.

31302928272625242322212019181716
ResResResResResResResResResResResResResResResRes
1514131211109876543210
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
MD[15:0]

Bits 31:16 Reserved, must be kept at reset value.

Bits 15:0 MD[15:0] : MII data

This contains the 16-bit data value read from the PHY after a Management Read operation, or the 16-bit data value to be written to the PHY before a Management Write operation.

Ethernet MAC flow control register (ETH_MACFCR)

Address offset: 0x0018

Reset value: 0x0000 0000

The Flow control register controls the generation and reception of the control (Pause Command) frames by the MAC. A write to a register with the Busy bit set to '1' causes the MAC to generate a pause control frame. The fields of the control frame are selected as specified in the 802.3x specification, and the Pause Time value from this register is used in the Pause Time field of the control frame. The Busy bit remains set until the control frame is transferred onto the cable. The Host must make sure that the Busy bit is cleared before writing to the register.

31302928272625242322212019181716
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.ZQPDRes.PLT[1:0]UPFDRFCETFCEFCB/BPA
rwrwrwrwrwrwrc_w1/rw
PT[15:0]

Bits 31:16 PT[15:0] : Pause time

This field holds the value to be used in the Pause Time field in the transmit control frame. If the Pause Time bits is configured to be double-synchronized to the MII clock domain, then consecutive write operations to this register should be performed only after at least 4 clock cycles in the destination clock domain.

Bits 15:8 Reserved, must be kept at reset value.

Bit 7 ZQPD : Zero-quanta pause disable

When set, this bit disables the automatic generation of Zero-quanta pause control frames on the deassertion of the flow-control signal from the FIFO layer.

When this bit is reset, normal operation with automatic Zero-quanta pause control frame generation is enabled.

Bit 6 Reserved, must be kept at reset value.

Bits 5:4 PLT: Pause low threshold

This field configures the threshold of the Pause timer at which the Pause frame is automatically retransmitted. The threshold values should always be less than the Pause Time configured in bits[31:16]. For example, if PT = 100H (256 slot-times), and PLT = 01, then a second PAUSE frame is automatically transmitted if initiated at 228 (256 – 28) slot-times after the first PAUSE frame is transmitted.

Selection Threshold

00 Pause time minus 4 slot times

01 Pause time minus 28 slot times

10 Pause time minus 144 slot times

11 Pause time minus 256 slot times

Slot time is defined as time taken to transmit 512 bits (64 bytes) on the MII interface.

Bit 3 UPFD: Unicast pause frame detect

When this bit is set, the MAC detects the Pause frames with the station's unicast address specified in the ETH_MACA0HR and ETH_MACA0LR registers, in addition to detecting Pause frames with the unique multicast address.

When this bit is reset, the MAC detects only a Pause frame with the unique multicast address specified in the 802.3x standard.

Bit 2 RFCE: Receive flow control enable

When this bit is set, the MAC decodes the received Pause frame and disables its transmitter for a specified (Pause Time) time.

When this bit is reset, the decode function of the Pause frame is disabled.

Bit 1 TFCE: Transmit flow control enable

In Full-duplex mode, when this bit is set, the MAC enables the flow control operation to transmit Pause frames. When this bit is reset, the flow control operation in the MAC is disabled, and the MAC does not transmit any Pause frames.

In Half-duplex mode, when this bit is set, the MAC enables the back-pressure operation. When this bit is reset, the back pressure feature is disabled.

Bit 0 FCB/BPA: Flow control busy/back pressure activate

This bit initiates a Pause Control frame in Full-duplex mode and activates the back pressure function in Half-duplex mode if TFCE bit is set.

In Full-duplex mode, this bit should be read as 0 before writing to the Flow control register. To initiate a Pause control frame, the Application must set this bit to 1. During a transfer of the Control frame, this bit continues to be set to signify that a frame transmission is in progress. After completion of the Pause control frame transmission, the MAC resets this bit to 0. The Flow control register should not be written to until this bit is cleared.

In Half-duplex mode, when this bit is set (and TFCE is set), back pressure is asserted by the MAC core. During back pressure, when the MAC receives a new frame, the transmitter starts sending a JAM pattern resulting in a collision. When the MAC is configured to Full-duplex mode, the BPA is automatically disabled.

Ethernet MAC VLAN tag register (ETH_MACVLANTR)

Address offset: 0x001C

Reset value: 0x0000 0000

The VLAN tag register contains the IEEE 802.1Q VLAN Tag to identify the VLAN frames. The MAC compares the 13 th and 14 th bytes of the receiving frame (Length/Type) with 0x8100, and the following 2 bytes are compared with the VLAN tag; if a match occurs, the received VLAN bit in the receive frame status is set. The legal length of the frame is increased from 1518 bytes to 1522 bytes.

31302928272625242322212019181716
ResResResResResResResResResResResResResResResVLANTC
rw
1514131211109876543210
VLANTI[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:17 Reserved, must be kept at reset value.

Bit 16 VLANTC : 12-bit VLAN tag comparison

When this bit is set, a 12-bit VLAN identifier, rather than the complete 16-bit VLAN tag, is used for comparison and filtering. Bits[11:0] of the VLAN tag are compared with the corresponding field in the received VLAN-tagged frame.

When this bit is reset, all 16 bits of the received VLAN frame's fifteenth and sixteenth bytes are used for comparison.

Bits 15:0 VLANTI[15:0] : VLAN tag identifier (for receive frames)

This contains the 802.1Q VLAN tag to identify VLAN frames, and is compared to the fifteenth and sixteenth bytes of the frames being received for VLAN frames. Bits[15:13] are the user priority, Bit[12] is the canonical format indicator (CFI) and bits[11:0] are the VLAN tag's VLAN identifier (VID) field. When the VLANTC bit is set, only the VID (bits[11:0]) is used for comparison.

If VLANTI (VLANTI[11:0] if VLANTC is set) is all zeros, the MAC does not check the fifteenth and sixteenth bytes for VLAN tag comparison, and declares all frames with a Type field value of 0x8100 as VLAN frames.

Ethernet MAC remote wakeup frame filter register (ETH_MACRWUFR)

Address offset: 0x0028

Reset value: 0x0000 0000

This is the address through which the remote wakeup frame filter registers are written/read by the application. The Wakeup frame filter register is actually a pointer to eight (not transparent) such wakeup frame filter registers. Eight sequential write operations to this address with the offset (0x0028) will write all wakeup frame filter registers. Eight sequential read operations from this address with the offset (0x0028) will read all wakeup frame filter registers. This register contains the higher 16 bits of the 7 th MAC address. Refer to Remote wakeup frame filter register section for additional information.

Figure 571. Ethernet MAC remote wakeup frame filter register (ETH_MACRWUFR)

Wakeup frame filter reg0Filter 0 Byte Mask
Wakeup frame filter reg1Filter 1 Byte Mask
Wakeup frame filter reg2Filter 2 Byte Mask
Wakeup frame filter reg3Filter 3 Byte Mask
Wakeup frame filter reg4RSVDFilter 3 CommandRSVDFilter 2 CommandRSVDFilter 1 CommandRSVDFilter 0 Command
Wakeup frame filter reg5Filter 3 OffsetFilter 2 OffsetFilter 1 OffsetFilter 0 Offset
Wakeup frame filter reg6Filter 1 CRC - 16Filter 0 CRC - 16
Wakeup frame filter reg7Filter 3 CRC - 16Filter 2 CRC - 16

ai15648

Ethernet MAC PMT control and status register (ETH_MACPMTCSR)

Address offset: 0x002C

Reset value: 0x0000 0000

The ETH_MACPMTCSR programs the request wakeup events and monitors the wakeup events.

31302928272625242322212019181716
WFFRPRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
rs
1514131211109876543210
Res.Res.Res.Res.Res.Res.GURes.Res.WFRMPRRes.Res.WFEMPEPD
rwrc_rrc_rrwrwrs

Bit 31 WFFRPR : Wakeup frame filter register pointer reset

When set, it resets the Remote wakeup frame filter register pointer to 0b000. It is automatically cleared after 1 clock cycle.

Bits 30:10 Reserved, must be kept at reset value.

Bit 9 GU : Global unicast

When set, it enables any unicast packet filtered by the MAC (DAF) address recognition to be a wakeup frame.

Bits 8:7 Reserved, must be kept at reset value.

Bit 6 WFR : Wakeup frame received

When set, this bit indicates the power management event was generated due to reception of a wakeup frame. This bit is cleared by a read into this register.

Bit 5 MPR : Magic packet received

When set, this bit indicates the power management event was generated by the reception of a Magic Packet. This bit is cleared by a read into this register.

Bits 4:3 Reserved, must be kept at reset value.

Bit 2 WFE : Wakeup frame enable

When set, this bit enables the generation of a power management event due to wakeup frame reception.

Bit 1 MPE : Magic Packet enable

When set, this bit enables the generation of a power management event due to Magic Packet reception.

Bit 0 PD : Power down

When this bit is set, all received frames will be dropped. This bit is cleared automatically when a magic packet or wakeup frame is received, and Power-down mode is disabled. Frames received after this bit is cleared are forwarded to the application. This bit must only be set when either the Magic Packet Enable or Wakeup Frame Enable bit is set high.

Ethernet MAC debug register (ETH_MACDBGGR)

Address offset: 0x0034

Reset value: 0x0000 0000

This debug register gives the status of all the main modules of the transmit and receive data paths and the FIFOs. An all-zero status indicates that the MAC core is in Idle state (and FIFOs are empty) and no activity is going on in the data paths.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.TFFTFNERes.TFWATFRS[1:0]MTPMTFCS[1:0]MMTEA
rrrrrrrrr

1514131211109876543210
Res.Res.Res.Res.Res.Res.RFFL[1:0]Res.RFRCS[1:0]RFWRARes.MSFRWCS[1:0]MMRPEA
rrrrrrrr

Bits 31:26 Reserved, must be kept at reset value.

Bit 25 TFF : Tx FIFO full

When high, it indicates that the Tx FIFO is full and hence no more frames will be accepted for transmission.

Bit 24 TFNE : Tx FIFO not empty

When high, it indicates that the TxFIFO is not empty and has some data left for transmission.

Bit 23 Reserved, must be kept at reset value.

Bit 22 TFWA : Tx FIFO write active

When high, it indicates that the TxFIFO write controller is active and transferring data to the TxFIFO.

Bits 21:20 TFRS[1:0] : Tx FIFO read status

This indicates the state of the TxFIFO read controller:

00: Idle state

01: Read state (transferring data to the MAC transmitter)

10: Waiting for TxStatus from MAC transmitter

11: Writing the received TxStatus or flushing the TxFIFO

Bit 19 MTP : MAC transmitter in pause

When high, it indicates that the MAC transmitter is in Pause condition (in full-duplex mode only) and hence will not schedule any frame for transmission

Bits 18:17 MTFCS[1:0] : MAC transmit frame controller status

This indicates the state of the MAC transmit frame controller:

00: Idle

01: Waiting for Status of previous frame or IFG/backoff period to be over

10: Generating and transmitting a Pause control frame (in full duplex mode)

11: Transferring input frame for transmission

Bit 16 MMTEA : MAC MII transmit engine active

When high, it indicates that the MAC MII transmit engine is actively transmitting data and that it is not in the Idle state.

Bits 15:10 Reserved, must be kept at reset value.

Bits 9:8 RFFL : Rx FIFO fill level

This gives the status of the Rx FIFO fill-level:

00: RxFIFO empty

01: RxFIFO fill-level below flow-control de-activate threshold

10: RxFIFO fill-level above flow-control activate threshold

11: RxFIFO full

Bit 7 Reserved, must be kept at reset value.

Bits 6:5 RFRCS[1:0] : Rx FIFO read controller status

It gives the state of the Rx FIFO read controller:

00: IDLE state

01: Reading frame data

10: Reading frame status (or time-stamp)

11: Flushing the frame data and status

Bit 4 RFWRA : Rx FIFO write controller active

When high, it indicates that the Rx FIFO write controller is active and transferring a received frame to the FIFO.

Bit 3 Reserved, must be kept at reset value.

Bits 2:1 MSFRWCS[1:0] : MAC small FIFO read / write controllers status

When high, these bits indicate the respective active state of the small FIFO read and write controllers of the MAC receive frame controller module.

Bit 0 MMRPEA : MAC MII receive protocol engine active

When high, it indicates that the MAC MII receive protocol engine is actively receiving data and is not in the Idle state.

Ethernet MAC interrupt status register (ETH_MACSR)

Address offset: 0x0038

Reset value: 0x0000 0000

The ETH_MACSR register contents identify the events in the MAC that can generate an interrupt.

1514131211109876543210
Res.Res.Res.Res.Res.Res.TSTSRes.Res.MMCTSMMCRSMMCSPMTSRes.Res.Res.
rc_rrrrr

Bits 15:10 Reserved, must be kept at reset value.

Bit 9 TSTS : Time stamp trigger status

This bit is set high when the system time value equals or exceeds the value specified in the Target time high and low registers. This bit is cleared by reading the ETH_PTPTSSR register.

Bits 8:7 Reserved, must be kept at reset value.

Bit 6 MMCTS : MMC transmit status

This bit is set high whenever an interrupt is generated in the ETH_MMCTIR Register. This bit is cleared when all the bits in this interrupt register (ETH_MMCTIR) are cleared.

Bit 5 MMCRS : MMC receive status

This bit is set high whenever an interrupt is generated in the ETH_MMCRIR register. This bit is cleared when all the bits in this interrupt register (ETH_MMCRIR) are cleared.

Bit 4 MMCS : MMC status

This bit is set high whenever any of bits 6:5 is set high. It is cleared only when both bits are low.

Bit 3 PMTS : PMT status

This bit is set whenever a Magic packet or Wake-on-LAN frame is received in Power-down mode (See bits 5 and 6 in the ETH_MACPMTCSR register Ethernet MAC PMT control and status register (ETH_MACPMTCSR) ). This bit is cleared when both bits[6:5], of this last register, are cleared due to a read operation to the ETH_MACPMTCSR register.

Bits 2:0 Reserved, must be kept at reset value.

Ethernet MAC interrupt mask register (ETH_MACIMR)

Address offset: 0x003C

Reset value: 0x0000 0000

The ETH_MACIMR register bits make it possible to mask the interrupt signal due to the corresponding event in the ETH_MACSR register.

1514131211109876543210
Res.Res.Res.Res.Res.Res.TSTIMRes.Res.Res.Res.Res.PMTIMRes.Res.Res.
rwrw

Bits 15:10 Reserved, must be kept at reset value.

Bit 9 TSTIM : Time stamp trigger interrupt mask

When set, this bit disables the time stamp interrupt generation.

Bits 8:4 Reserved, must be kept at reset value.

Bit 3 PMTIM : PMT interrupt mask

When set, this bit disables the assertion of the interrupt signal due to the setting of the PMT Status bit in ETH_MACSR.

Bits 2:0 Reserved, must be kept at reset value.

Ethernet MAC address 0 high register (ETH_MACA0HR)

Address offset: 0x0040

Reset value: 0x8000 FFFF

The MAC address 0 high register holds the upper 16 bits of the 6-byte first MAC address of the station. Note that the first DA byte that is received on the MII interface corresponds to the LS Byte (bits [7:0]) of the MAC address low register. For example, if 0x1122 3344 5566 is received (0x11 is the first byte) on the MII as the destination address, then the MAC address 0 register [47:0] is compared with 0x6655 4433 2211.

31302928272625242322212019181716
MORes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
rw
1514131211109876543210
MACA0H[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 MO : Always 1.

Bits 30:16 Reserved, must be kept at reset value.

Bits 15:0 MACA0H[15:0] : MAC address0 high [47:32]

This field contains the upper 16 bits (47:32) of the 6-byte MAC address0. This is used by the MAC for filtering for received frames and for inserting the MAC address in the transmit flow control (Pause) frames.

Ethernet MAC address 0 low register (ETH_MACA0LR)

Address offset: 0x0044

Reset value: 0xFFFF FFFF

The MAC address 0 low register holds the lower 32 bits of the 6-byte first MAC address of the station.

31302928272625242322212019181716
MACA0L[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
MACA0L[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 MACA0L[31:0] : MAC address0 low [31:0]

This field contains the lower 32 bits of the 6-byte MAC address0. This is used by the MAC for filtering for received frames and for inserting the MAC address in the transmit flow control (Pause) frames.

Ethernet MAC address 1 high register (ETH_MACA1HR)

Address offset: 0x0048

Reset value: 0x0000 FFFF

The MAC address 1 high register holds the upper 16 bits of the 6-byte second MAC address of the station.

31302928272625242322212019181716
AESAMBC[5:0]Res.Res.Res.Res.Res.Res.Res.Res.
rwrwrwrwrwrwrwrw
1514131211109876543210
MACA1H[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 AE : Address enable

When this bit is set, the address filters use the MAC address1 for perfect filtering. When this bit is cleared, the address filters ignore the address for filtering.

Bit 30 SA : Source address

When this bit is set, the MAC address1[47:0] is used for comparison with the SA fields of the received frame.

When this bit is cleared, the MAC address1[47:0] is used for comparison with the DA fields of the received frame.

Bits 29:24 MBC[5:0] : Mask byte control

These bits are mask control bits for comparison of each of the MAC address1 bytes. When they are set high, the MAC core does not compare the corresponding byte of received DA/SA with the contents of the MAC address1 registers. Each bit controls the masking of the bytes as follows:

Bits 23:16 Reserved, must be kept at reset value.

Bits 15:0 MACA1H[15:0] : MAC address1 high [47:32]

This field contains the upper 16 bits (47:32) of the 6-byte second MAC address.

Ethernet MAC address1 low register (ETH_MACA1LR)

Address offset: 0x004C

Reset value: 0xFFFF FFFF

The MAC address 1 low register holds the lower 32 bits of the 6-byte second MAC address of the station.

31302928272625242322212019181716
MACA1L[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
MACA1L[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 MACA1L[31:0] : MAC address1 low [31:0]

This field contains the lower 32 bits of the 6-byte MAC address1. The content of this field is undefined until loaded by the application after the initialization process.

Ethernet MAC address 2 high register (ETH_MACA2HR)

Address offset: 0x0050

Reset value: 0x0000 FFFF

The MAC address 2 high register holds the upper 16 bits of the 6-byte second MAC address of the station.

31302928272625242322212019181716
AESAMBC[5:0]ResResResResResResResRes
rwrwrwrwrwrwrwrw
1514131211109876543210
MACA2H[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 AE: Address enable

When this bit is set, the address filters use the MAC address2 for perfect filtering. When reset, the address filters ignore the address for filtering.

Bit 30 SA: Source address

When this bit is set, the MAC address 2 [47:0] is used for comparison with the SA fields of the received frame.

When this bit is reset, the MAC address 2 [47:0] is used for comparison with the DA fields of the received frame.

Bits 29:24 MBC[5:0]: Mask byte control

These bits are mask control bits for comparison of each of the MAC address2 bytes. When set high, the MAC core does not compare the corresponding byte of received DA/SA with the contents of the MAC address 2 registers. Each bit controls the masking of the bytes as follows:

Bits 23:16 Reserved, must be kept at reset value.

Bits 15:0 MACA2H[15:0]: MAC address2 high [47:32]

This field contains the upper 16 bits (47:32) of the 6-byte MAC address2.

Ethernet MAC address 2 low register (ETH_MACA2LR)

Address offset: 0x0054

Reset value: 0xFFFF FFFF

The MAC address 2 low register holds the lower 32 bits of the 6-byte second MAC address of the station.

31302928272625242322212019181716
MACA2L[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
MACA2L[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 MACA2L[31:0]: MAC address2 low [31:0]

This field contains the lower 32 bits of the 6-byte second MAC address2. The content of this field is undefined until loaded by the application after the initialization process.

Ethernet MAC address 3 high register (ETH_MACA3HR)

Address offset: 0x0058

Reset value: 0x0000 FFFF

The MAC address 3 high register holds the upper 16 bits of the 6-byte second MAC address of the station.

31302928272625242322212019181716
AESAMBC[5:0]Res.Res.Res.Res.Res.Res.Res.Res.
rwrwrwrwrwrwrwrw
1514131211109876543210
MACA3H[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 AE: Address enable

When this bit is set, the address filters use the MAC address3 for perfect filtering. When this bit is cleared, the address filters ignore the address for filtering.

Bit 30 SA: Source address

When this bit is set, the MAC address 3 [47:0] is used for comparison with the SA fields of the received frame.

When this bit is cleared, the MAC address 3[47:0] is used for comparison with the DA fields of the received frame.

Bits 29:24 MBC[5:0]: Mask byte control

These bits are mask control bits for comparison of each of the MAC address3 bytes. When these bits are set high, the MAC core does not compare the corresponding byte of received DA/SA with the contents of the MAC address 3 registers. Each bit controls the masking of the bytes as follows:

Bits 23:16 Reserved, must be kept at reset value.

Bits 15:0 MACA3H[15:0]: MAC address3 high [47:32]

This field contains the upper 16 bits (47:32) of the 6-byte MAC address3.

Ethernet MAC address 3 low register (ETH_MACA3LR)

Address offset: 0x005C

Reset value: 0xFFFF FFFF

The MAC address 3 low register holds the lower 32 bits of the 6-byte second MAC address of the station.

31302928272625242322212019181716
MACA3L[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
MACA3L[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 MACA3L[31:0] : MAC address3 low [31:0]

This field contains the lower 32 bits of the 6-byte second MAC address3. The content of this field is undefined until loaded by the application after the initialization process.

42.8.2 MMC register description

Ethernet MMC control register (ETH_MMCCR)

Address offset: 0x0100

Reset value: 0x0000 0000

The Ethernet MMC Control register establishes the operating mode of the management counters.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.MCFHPMCPMCFRORCSRCR
rwrwrwrwrwrw

Bits 31:6 Reserved, must be kept at reset value.

MCFHP: MMC counter Full-Half preset

When MCFHP is low and bit4 is set, all MMC counters get preset to almost-half value. All frame-counters get preset to 0x7FFF_FFF0 (half - 16)

When MCFHP is high and bit4 is set, all MMC counters get preset to almost-full value. All frame-counters get preset to 0xFFFF_FFF0 (full - 16)

MCP: MMC counter preset

When set, all counters will be initialized or preset to almost full or almost half as per Bit 4 above. This bit will be cleared automatically after 1 clock cycle. This bit along with bit5 is useful for debugging and testing the assertion of interrupts due to MMC counter becoming half-full or full.

Bit 3 MCF: MMC counter freeze

When set, this bit freezes all the MMC counters to their current value. (None of the MMC counters are updated due to any transmitted or received frame until this bit is cleared to 0. If any MMC counter is read with the Reset on Read bit set, then that counter is also cleared in this mode.)

Bit 2 ROR: Reset on read

When this bit is set, the MMC counters is reset to zero after read (self-clearing after reset). The counters are cleared when the least significant byte lane (bits [7:0]) is read.

Bit 1 CSR: Counter stop rollover

When this bit is set, the counter does not roll over to zero after it reaches the maximum value.

Bit 0 CR: Counter reset

When it is set, all counters are reset. This bit is cleared automatically after 1 clock cycle.

Ethernet MMC receive interrupt register (ETH_MMCRIR)

Address offset: 0x0104

Reset value: 0x0000 0000

The Ethernet MMC receive interrupt register maintains the interrupts generated when receive statistic counters reach half their maximum values. (MSB of the counter is set.) It is

a 32-bit wide register. An interrupt bit is cleared when the respective MMC counter that caused the interrupt is read. The least significant byte lane (bits [7:0]) of the respective counter must be read in order to clear the interrupt bit.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.RGUFSRes.
rc_r
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.RFAESRFCESRes.Res.Res.Res.Res.
rc_rrc_r

Bits 31:18 Reserved, must be kept at reset value.

Bit 17 RGUFS : Received Good Unicast Frames Status

This bit is set when the received, good unicast frames, counter reaches half the maximum value.

Bits 16:7 Reserved, must be kept at reset value.

Bit 6 RFAES : Received frames alignment error status

This bit is set when the received frames, with alignment error, counter reaches half the maximum value.

Bit 5 RFCES : Received frames CRC error status

This bit is set when the received frames, with CRC error, counter reaches half the maximum value.

Bits 4:0 Reserved, must be kept at reset value.

Ethernet MMC transmit interrupt register (ETH_MMCTIR)

Address offset: 0x0108

Reset value: 0x0000 0000

The Ethernet MMC transmit Interrupt register maintains the interrupts generated when transmit statistic counters reach half their maximum values. (MSB of the counter is set.) It is a 32-bit wide register. An interrupt bit is cleared when the respective MMC counter that caused the interrupt is read. The least significant byte lane (bits [7:0]) of the respective counter must be read in order to clear the interrupt bit.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.TGFSRes.Res.Res.Res.Res.
rc_r
1514131211109876543210
TGFMSCSTGFSCSRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
rc_rrc_r

Bits 31:22 Reserved, must be kept at reset value.

Bit 21 TGFS : Transmitted good frames status

This bit is set when the transmitted, good frames, counter reaches half the maximum value.

Bits 20:16 Reserved, must be kept at reset value.

Bit 15 TGFMSCS : Transmitted good frames more single collision status

This bit is set when the transmitted, good frames after more than a single collision, counter reaches half the maximum value.

Bit 14 TGFSCS : Transmitted good frames single collision status

This bit is set when the transmitted, good frames after a single collision, counter reaches half the maximum value.

Bits 13:0 Reserved, must be kept at reset value.

Ethernet MMC receive interrupt mask register (ETH_MMCRIMR)

Address offset: 0x010C

Reset value: 0x0000 0000

The Ethernet MMC receive interrupt mask register maintains the masks for interrupts generated when the receive statistic counters reach half their maximum value. (MSB of the counter is set.) It is a 32-bit wide register.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.RGUFMRes.
rw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.RFAEMRFCEMRes.Res.Res.Res.Res.
rwrw

Bits 31:18 Reserved, must be kept at reset value.

Bit 17 RGUFM : Received good unicast frames mask

Setting this bit masks the interrupt when the received, good unicast frames, counter reaches half the maximum value.

Bits 16:7 Reserved, must be kept at reset value.

Bit 6 RFAEM : Received frames alignment error mask

Setting this bit masks the interrupt when the received frames, with alignment error, counter reaches half the maximum value.

Bit 5 RFCEM : Received frame CRC error mask

Setting this bit masks the interrupt when the received frames, with CRC error, counter reaches half the maximum value.

Bits 4:0 Reserved, must be kept at reset value.

Ethernet MMC transmit interrupt mask register (ETH_MMCTIMR)

Address offset: 0x0110

Reset value: 0x0000 0000

The Ethernet MMC transmit interrupt mask register maintains the masks for interrupts generated when the transmit statistic counters reach half their maximum value. (MSB of the counter is set.) It is a 32-bit wide register.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.TGFMRes.Res.Res.Res.Res.
rw
1514131211109876543210
TGFMSMTGFSCMRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
rwrw

Bits 31:22 Reserved, must be kept at reset value.

Bit 21 TGFM : Transmitted good frames mask

Setting this bit masks the interrupt when the transmitted, good frames, counter reaches half the maximum value.

Bits 20:16 Reserved, must be kept at reset value.

Bit 15 TGFMSM : Transmitted good frames more single collision mask

Setting this bit masks the interrupt when the transmitted good frames after more than a single collision counter reaches half the maximum value.

Bit 14 TGFSCM : Transmitted good frames single collision mask

Setting this bit masks the interrupt when the transmitted good frames after a single collision counter reaches half the maximum value.

Bits 13:0 Reserved, must be kept at reset value.

Ethernet MMC transmitted good frames after a single collision counter register (ETH_MMCTGFSCCR)

Address offset: 0x014C

Reset value: 0x0000 0000

This register contains the number of successfully transmitted frames after a single collision in Half-duplex mode.

31302928272625242322212019181716
TGFSCC[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
TGFSCC[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 TGFSCC[31:0] : Transmitted good frames single collision counter

Transmitted good frames after a single collision counter.

Ethernet MMC transmitted good frames after more than a single collision counter register (ETH_MMCTGFMSCR)

Address offset: 0x0150

Reset value: 0x0000 0000

This register contains the number of successfully transmitted frames after more than a single collision in Half-duplex mode.

31302928272625242322212019181716
TGFMSCC[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
TGFMSCC[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 TGFMSCC[31:0] : Transmitted good frames more single collision counter
Transmitted good frames after more than a single collision counter

Ethernet MMC transmitted good frames counter register (ETH_MMCTGFCR)

Address offset: 0x0168

Reset value: 0x0000 0000

This register contains the number of good frames transmitted.

31302928272625242322212019181716
TGFC[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
TGFC[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 TGFC[31:0] : Transmitted good frames counter

Ethernet MMC received frames with CRC error counter register (ETH_MMCRFCECR)

Address offset: 0x0194

Reset value: 0x0000 0000

This register contains the number of frames received with CRC error.

31302928272625242322212019181716
RFCEC[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
RFCEC[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 RFCEC[31:0] : Received frames CRC error counter
Received frames with CRC error counter

Ethernet MMC received frames with alignment error counter register (ETH_MMCRFAECR)

Address offset: 0x0198

Reset value: 0x0000 0000

This register contains the number of frames received with alignment (dribble) error.

31302928272625242322212019181716
RFAEC[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
RFAEC[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 RFAEC[31:0] : Received frames alignment error counter
Received frames with alignment error counter

MMC received good unicast frames counter register (ETH_MMCRGUFCR)

Address offset: 0x01C4

Reset value: 0x0000 0000

This register contains the number of good unicast frames received.

31302928272625242322212019181716
RGUFC[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
RGUFC[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 RGUFC[31:0] : Received good unicast frames counter

42.8.3 IEEE 1588 time stamp registers

This section describes the registers required to support precision network clock synchronization functions under the IEEE 1588 standard.

Ethernet PTP time stamp control register (ETH_PTPTSCR)

Address offset: 0x0700

Reset value: 0x0000 2000

This register controls the time stamp generation and update logic.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.TSPFF
MAE
TSCNT[1:0]
rwrwrw
1514131211109876543210
TSSMR
ME
TSSEMETSSIPV
4FE
TSSIPV
6FE
TSSPT
POEFE
TSPTP
PSV2E
TSSSRTSSAR
FE
Res.Res.TTSARUTSITETSSTUTSSTITSFCUTSE
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:19 Reserved, must be kept at reset value.

Bit 18 TSPFFMAE : Time stamp PTP frame filtering MAC address enable

When set, this bit uses the MAC address (except for MAC address 0) to filter the PTP frames when PTP is sent directly over Ethernet.

Bits 17:16 TSCNT[1:0] : Time stamp clock node type

The following are the available types of clock node:

00: Ordinary clock

01: Boundary clock

10: End-to-end transparent clock

11: Peer-to-peer transparent clock

Bit 15 TSSMRME : Time stamp snapshot for message relevant to master enable

When this bit is set, the snapshot is taken for messages relevant to the master node only.

When this bit is cleared the snapshot is taken for messages relevant to the slave node only.

This is valid only for the ordinary clock and boundary clock nodes.

Bit 14 TSSEME : Time stamp snapshot for event message enable

When this bit is set, the time stamp snapshot is taken for event messages only (SYNC,

Delay_Req, Pdelay_Req or Pdelay_Resp). When this bit is cleared the snapshot is taken for all other messages except for Announce, Management and Signaling.

Bit 13 TSSIPV4FE : Time stamp snapshot for IPv4 frames enable

When this bit is set, the time stamp snapshot is taken for IPv4 frames.

Bit 12 TSSIPV6FE : Time stamp snapshot for IPv6 frames enable

When this bit is set, the time stamp snapshot is taken for IPv6 frames.

Bit 11 TSSPTPOEFE : Time stamp snapshot for PTP over ethernet frames enable

When this bit is set, the time stamp snapshot is taken for frames which have PTP messages in Ethernet frames (PTP over Ethernet) also. By default snapshots are taken for UDP-IP Ethernet PTP packets.

Bit 10 TSPTPPSV2E : Time stamp PTP packet snooping for version2 format enable

When this bit is set, the PTP packets are snooped using the version 2 format. When the bit is cleared, the PTP packets are snooped using the version 1 format.

Note: IEEE 1588 Version 1 and Version 2 formats as indicated in IEEE standard 1588-2008 (Revision of IEEE STD. 1588-2002).

Bit 9 TSSSR : Time stamp subsecond rollover: digital or binary rollover control

When this bit is set, the Time stamp low register rolls over when the subsecond counter reaches the value 0x3B9A C9FF (999 999 999 in decimal), and increments the Time Stamp (high) seconds.

When this bit is cleared, the rollover value of the subsecond register reaches 0x7FFF FFFF. The subsecond increment has to be programmed correctly depending on the PTP's reference clock frequency and this bit value.

Bit 8 TSSARFE : Time stamp snapshot for all received frames enable

When this bit is set, the time stamp snapshot is enabled for all frames received by the core.

Bits 7:6 Reserved, must be kept at reset value.

Bit 5 TTSARU : Time stamp addend register update

When this bit is set, the Time stamp addend register's contents are updated to the PTP block for fine correction. This bit is cleared when the update is complete. This register bit must be read as zero before you can set it.

Bit 4 TSITE : Time stamp interrupt trigger enable

When this bit is set, a time stamp interrupt is generated when the system time becomes greater than the value written in the Target time register. When the Time stamp trigger interrupt is generated, this bit is cleared.

Bit 3 TSSTU : Time stamp system time update

When this bit is set, the system time is updated (added to or subtracted from) with the value specified in the Time stamp high update and Time stamp low update registers. Both the TSSTU and TSSTI bits must be read as zero before you can set this bit. Once the update is completed in hardware, this bit is cleared.

Bit 2 TSSTI : Time stamp system time initialize

When this bit is set, the system time is initialized (overwritten) with the value specified in the Time stamp high update and Time stamp low update registers. This bit must be read as zero before you can set it. When initialization is complete, this bit is cleared.

Bit 1 TSFCU : Time stamp fine or coarse update

When set, this bit indicates that the system time stamp is to be updated using the Fine Update method. When cleared, it indicates the system time stamp is to be updated using the Coarse method.

Bit 0 TSE : Time stamp enable

When this bit is set, time stamping is enabled for transmit and receive frames. When this bit is cleared, the time stamp function is suspended and time stamps are not added for transmit and receive frames. Because the maintained system time is suspended, you must always initialize the time stamp feature (system time) after setting this bit high.

The table below indicates the messages for which a snapshot is taken depending on the clock, enable master and enable snapshot for event message register settings.

Table 318. Time stamp snapshot dependency on registers bits

TSCNT
(bits 17:16)
TSSMRME
(bit 15) (1)
TSSEME
(bit 14)
Messages for which snapshots are taken
00 or 01X (2)0SYNC, Follow_Up, Delay_Req, Delay_Resp
00 or 0111Delay_Req
00 or 0101SYNC
10N/A0SYNC, Follow_Up, Delay_Req, Delay_Resp
10N/A1SYNC, Follow_Up
11N/A0SYNC, Follow_Up, Delay_Req, Delay_Resp, Pdelay_Req, Pdelay_Resp
11N/A1SYNC, Pdelay_Req, Pdelay_Resp

1. N/A = not applicable.

2. X = don't care.

Ethernet PTP subsecond increment register (ETH_PTPSSIR)

Address offset: 0x0704

Reset value: 0x0000 0000

This register contains the 8-bit value by which the subsecond register is incremented. In Coarse update mode (TSFCU bit in ETH_PTPSCR), the value in this register is added to

the system time every clock cycle of HCLK. In Fine update mode, the value in this register is added to the system time whenever the accumulator gets an overflow.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.STSSI[7:0]
rwrwrwrwrwrwrwrw

Bits 31:8 Reserved, must be kept at reset value.

Bits 7:0 STSSI[7:0] : System time subsecond increment

The value programmed in this register is added to the contents of the subsecond value of the system time in every update.

For example, to achieve 20 ns accuracy, the value is: \( 20 / 0.467 = \sim 43 \) (or 0x2A).

Ethernet PTP time stamp high register (ETH_PTPTSHR)

Address offset: 0x0708

Reset value: 0x0000 0000

This register contains the most significant (higher) 32 time bits. This read-only register contains the seconds system time value. The Time stamp high register, along with Time stamp low register, indicates the current value of the system time maintained by the MAC. Though it is updated on a continuous basis.

31302928272625242322212019181716
STS[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
STS[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 STS[31:0] : System time second

The value in this field indicates the current value in seconds of the System Time maintained by the core.

Ethernet PTP time stamp low register (ETH_PTPTSLR)

Address offset: 0x070C

Reset value: 0x0000 0000

This register contains the least significant (lower) 32 time bits. This read-only register contains the subsecond system time value.

31302928272625242322212019181716
STPNSSTSS[30:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
STSS[15:0]
rrrrrrrrrrrrrrrr

Bit 31 STPNS : System time positive or negative sign

This bit indicates a positive or negative time value. When set, the bit indicates that time representation is negative. When cleared, it indicates that time representation is positive. Because the system time should always be positive, this bit is normally zero.

Bits 30:0 STSS[30:0] : System time subseconds

The value in this field has the subsecond time representation, with 0.46 ns accuracy.

Ethernet PTP time stamp high update register (ETH_PTPTSHUR)

Address offset: 0x0710

Reset value: 0x0000 0000

This register contains the most significant (higher) 32 bits of the time to be written to, added to, or subtracted from the System Time value. The Time stamp high update register, along with the Time stamp update low register, initializes or updates the system time maintained by the MAC. You have to write both of these registers before setting the TSSTI or TSSTU bits in the Time stamp control register.

31302928272625242322212019181716
TSUS[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
TSUS[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 TSUS[31:0] : Time stamp update second

The value in this field indicates the time, in seconds, to be initialized or added to the system time.

Ethernet PTP time stamp low update register (ETH_PTPTSLUR)

Address offset: 0x0714

Reset value: 0x0000 0000

This register contains the least significant (lower) 32 bits of the time to be written to, added to, or subtracted from the System Time value.

31302928272625242322212019181716
TSUPNSTSUSS[30:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
TSUSS[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 TSUPNS : Time stamp update positive or negative sign

This bit indicates positive or negative time value. When set, the bit indicates that time representation is negative. When cleared, it indicates that time representation is positive. When TSSTI is set (system time initialization) this bit should be zero. If this bit is set when TSSTU is set, the value in the Time stamp update registers is subtracted from the system time. Otherwise it is added to the system time.

Bits 30:0 TSUSS[30:0] : Time stamp update subseconds

The value in this field indicates the subsecond time to be initialized or added to the system time. This value has an accuracy of 0.46 ns (in other words, a value of 0x0000_0001 is 0.46 ns).

Ethernet PTP time stamp addend register (ETH_PTPTSAR)

Address offset: 0x0718

Reset value: 0x0000 0000

This register is used by the software to readjust the clock frequency linearly to match the master clock frequency. This register value is used only when the system time is configured for Fine update mode (TSFCU bit in ETH_PTPTSCR). This register content is added to a 32-bit accumulator in every clock cycle and the system time is updated whenever the accumulator overflows.

31302928272625242322212019181716
TSA[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
TSA[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 TSA[31:0] : Time stamp addend

This register indicates the 32-bit time value to be added to the Accumulator register to achieve time synchronization.

Ethernet PTP target time high register (ETH_PTPTHR)

Address offset: 0x071C

Reset value: 0x0000 0000

This register contains the higher 32 bits of time to be compared with the system time for interrupt event generation. The Target time high register, along with Target time low register, is used to schedule an interrupt event (TSARU bit in ETH_PTPTSCR) when the system time exceeds the value programmed in these registers.

31302928272625242322212019181716
TTSH[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
TTSH[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
Bits 31:0 TTSH[31:0] : Target time stamp high

This register stores the time in seconds. When the time stamp value matches or exceeds both Target time stamp registers, the MAC, if enabled, generates an interrupt.

Ethernet PTP target time low register (ETH_PPTTLR)

Address offset: 0x0720

Reset value: 0x0000 0000

This register contains the lower 32 bits of time to be compared with the system time for interrupt event generation.

31302928272625242322212019181716
TTSL[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
TTSL[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
Bits 31:0 TTSL[31:0] : Target time stamp low

This register stores the time in (signed) nanoseconds. When the value of the time stamp matches or exceeds both Target time stamp registers, the MAC, if enabled, generates an interrupt.

Ethernet PTP time stamp status register (ETH_PTPSSR)

Address offset: 0x0728

Reset value: 0x0000 0000

This register contains the time stamp status register.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.TSSTRTSSO
rr

Bits 31:2 Reserved, must be kept at reset value.

Bit 1 TSSTR : Time stamp target time reached

When set, this bit indicates that the value of the system time is greater than or equal to the value specified in the Target time high and low registers. This bit is cleared when the ETH_PTPTSSR register is read.

Bit 0 TSSO : Time stamp second overflow

When set, this bit indicates that the second value of the time stamp has overflowed beyond 0xFFFF FFFF.

Ethernet PTP PPS control register (ETH_PTPPSCR)

Address offset: 0x072C

Reset value: 0x0000 0000

This register controls the frequency of the PPS output.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.PPSFREQ[3:0]
rwrwrwrw

Bits 31:4 Reserved, must be kept at reset value.

Bits 3:0 PPSFREQ[3:0] : PPS frequency selection

The PPS output frequency is set to \( 2^{\text{PPSFREQ}} \) Hz.

0000: 1 Hz with a pulse width of 125 ms for binary rollover and, of 100 ms for digital rollover

0001: 2 Hz with 50% duty cycle for binary rollover (digital rollover not recommended)

0010: 4 Hz with 50% duty cycle for binary rollover (digital rollover not recommended)

0011: 8 Hz with 50% duty cycle for binary rollover (digital rollover not recommended)

0100: 16 Hz with 50% duty cycle for binary rollover (digital rollover not recommended)

...

1111: 32768 Hz with 50% duty cycle for binary rollover (digital rollover not recommended)

Note: If digital rollover is used (TSSSR=1, bit 9 in ETH_PTPTSCR), it is recommended not to use the PPS output with a frequency other than 1 Hz. Otherwise, with digital rollover, the PPS output has irregular waveforms at higher frequencies (though its average frequency will always be correct during any one-second window).

42.8.4 DMA register description

This section defines the bits for each DMA register. Non-32 bit accesses are allowed as long as the address is word-aligned.

Ethernet DMA bus mode register (ETH_DMABMR)

Address offset: 0x1000

Reset value: 0x0002 0101

The bus mode register establishes the bus operating modes for the DMA.

31302928272625242322212019181716
Res.Res.Res.Res.Res.MBAABFPMUSPRDP[5:0]FB
rwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
PM[1:0]PBL[5:0]EDFEDSL[4:0]DASR
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrs

Bits 31:27 Reserved, must be kept at reset value.

Bit 26 MB: Mixed burst

When this bit is set high and the FB bit is low, the AHB master interface starts all bursts of a length greater than 16 with INCR (undefined burst). When this bit is cleared, it reverts to fixed burst transfers (INCRx and SINGLE) for burst lengths of 16 and below.

Bit 25 AAB: Address-aligned beats

When this bit is set high and the FB bit equals 1, the AHB interface generates all bursts aligned to the start address LS bits. If the FB bit equals 0, the first burst (accessing the data buffer's start address) is not aligned, but subsequent bursts are aligned to the address.

Bit 24 FPM: 4xPBL mode

When set high, this bit multiplies the PBL value programmed (bits [22:17] and bits [13:8]) four times. Thus the DMA transfers data in a maximum of 4, 8, 16, 32, 64 and 128 beats depending on the PBL value.

Bit 23 USP: Use separate PBL

When set high, it configures the RxDMA to use the value configured in bits [22:17] as PBL while the PBL value in bits [13:8] is applicable to TxDMA operations only. When this bit is cleared, the PBL value in bits [13:8] is applicable for both DMA engines.

Bits 22:17 RDP[5:0]: Rx DMA PBL

These bits indicate the maximum number of beats to be transferred in one RxDMA transaction. This is the maximum value that is used in a single block read/write operation. The RxDMA always attempts to burst as specified in RDP each time it starts a burst transfer on the host bus. RDP can be programmed with permissible values of 1, 2, 4, 8, 16, and 32. Any other value results in undefined behavior. These bits are valid and applicable only when USP is set high.

Bit 16 FB: Fixed burst

This bit controls whether the AHB Master interface performs fixed burst transfers or not. When set, the AHB uses only SINGLE, INCR4, INCR8 or INCR16 during start of normal burst transfers. When reset, the AHB uses SINGLE and INCR burst transfer operations.

Bits 15:14 PM[1:0] : Rx Tx priority ratio

RxDMA requests are given priority over TxDMA requests in the following ratio:

00: 1:1

01: 2:1

10: 3:1

11: 4:1

This is valid only when the DA bit is cleared.

Bits 13:8 PBL[5:0] : Programmable burst length

These bits indicate the maximum number of beats to be transferred in one DMA transaction. This is the maximum value that is used in a single block read/write operation. The DMA always attempts to burst as specified in PBL each time it starts a burst transfer on the host bus. PBL can be programmed with permissible values of 1, 2, 4, 8, 16, and 32. Any other value results in undefined behavior. When USP is set, this PBL value is applicable for TxDMA transactions only.

The PBL values have the following limitations:

Bit 7 EDFE : Enhanced descriptor format enable

When this bit is set, the enhanced descriptor format is enabled and the descriptor size is increased to 32 bytes (8 DWORDS). This is required when time stamping is activated (TSE=1, ETH_PTPSCR bit 0) or if IPv4 checksum offload is activated (IPCO=1, ETH_MACCR bit 10).

Bits 6:2 DSL[4:0] : Descriptor skip length

This bit specifies the number of words to skip between two unchained descriptors. The address skipping starts from the end of current descriptor to the start of next descriptor. When DSL value equals zero, the descriptor table is taken as contiguous by the DMA, in Ring mode.

Bit 1 DA : DMA Arbitration

0: Round-robin with Rx:Tx priority given in bits [15:14]

1: Rx has priority over Tx

Bit 0 SR : Software reset

When this bit is set, the MAC DMA controller resets all MAC Subsystem internal registers and logic. It is cleared automatically after the reset operation has completed in all of the core clock domains. Read a 0 value in this bit before re-programming any register of the core.

Ethernet DMA transmit poll demand register (ETH_DMATPDR)

Address offset: 0x1004

Reset value: 0x0000 0000

This register is used by the application to instruct the DMA to poll the transmit descriptor list. The transmit poll demand register enables the Transmit DMA to check whether or not the current descriptor is owned by DMA. The Transmit Poll Demand command is given to wake up the TxDMA if it is in Suspend mode. The TxDMA can go into Suspend mode due to an underflow error in a transmitted frame or due to the unavailability of descriptors owned by

transmit DMA. User can issue this command anytime and the TxDMA resets it once it starts re-fetching the current descriptor from host memory.

31302928272625242322212019181716
TPD[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
TPD[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 TPD[31:0] : Transmit poll demand

When these bits are written with any value, the DMA reads the current descriptor pointed to by the ETH_DMACHTDR register. If that descriptor is not available (owned by Host), transmission returns to the Suspend state and ETH_DMASR register bit 2 is asserted. If the descriptor is available, transmission resumes.

ETHERNET DMA receive poll demand register (ETH_DMARPDR)

Address offset: 0x1008

Reset value: 0x0000 0000

This register is used by the application to instruct the DMA to poll the receive descriptor list. The Receive poll demand register enables the receive DMA to check for new descriptors. This command is given to wake up the RxDMA from Suspend state. The RxDMA can go into Suspend state only due to the unavailability of descriptors owned by it.

31302928272625242322212019181716
RPD[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
RPD[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 RPD[31:0] : Receive poll demand

When these bits are written with any value, the DMA reads the current descriptor pointed to by the ETH_DMACHRDR register. If that descriptor is not available (owned by Host), reception returns to the Suspended state and ETH_DMASR register bit 7 is not asserted. If the descriptor is available, the Receive DMA returns to active state.

Ethernet DMA receive descriptor list address register (ETH_DMARDLAR)

Address offset: 0x100C

Reset value: 0x0000 0000

The Receive descriptor list address register points to the start of the receive descriptor list. The descriptor list resides in the STM32F76xxx and STM32F77xxx physical memory space and must be word-aligned. The DMA internally converts it to bus-width aligned address by making the corresponding LS bits low. Writing to the ETH_DMARDLAR register is permitted only when reception is stopped. When stopped, the ETH_DMARDLAR register must be written to before the receive Start command is given.

31302928272625242322212019181716
SRL[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
SRL[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 SRL[31:0] : Start of receive list

This field contains the base address of the first descriptor in the receive descriptor list. The LSB bits [1/2/3:0] for 32/64/128-bit bus width) are internally ignored and taken as all-zero by the DMA. Hence these LSB bits are read only.

Ethernet DMA transmit descriptor list address register (ETH_DMATDLAR)

Address offset: 0x1010

Reset value: 0x0000 0000

The Transmit descriptor list address register points to the start of the transmit descriptor list. The descriptor list resides in the STM32F76xxx and STM32F77xxx physical memory space and must be word-aligned. The DMA internally converts it to bus-width-aligned address by taking the corresponding LSB to low. Writing to the ETH_DMATDLAR register is permitted only when transmission has stopped. Once transmission has stopped, the ETH_DMATDLAR register can be written before the transmission Start command is given.

31302928272625242322212019181716
STL[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
STL[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 STL[31:0] : Start of transmit list

This field contains the base address of the first descriptor in the transmit descriptor list. The LSB bits [1/2/3:0] for 32/64/128-bit bus width) are internally ignored and taken as all-zero by the DMA. Hence these LSB bits are read-only.

Ethernet DMA status register (ETH_DMASR)

Address offset: 0x1014

Reset value: 0x0000 0000

The Status register contains all the status bits that the DMA reports to the application. The ETH_DMASR register is usually read by the software driver during an interrupt service routine or polling. Most of the fields in this register cause the host to be interrupted. The ETH_DMASR register bits are not cleared when read. Writing 1 to (unreserved) bits in ETH_DMASR register[16:0] clears them and writing 0 has no effect. Each field (bits [16:0]) can be masked by masking the appropriate bit in the ETH_DMAIER register.

31302928272625242322212019181716
ResResTSTSPMTSMMCSResEBS[2:0]TPS[2:0]RPS[2:0]NIS
rrrrrrrrrrrrrc_w1
1514131211109876543210
AISERSFBESRes.Res.ETSRWTSRPSSRBUSRSTUSROSTJTSTBUSTPSSTS
rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1

Bits 31:30 Reserved, must be kept at reset value.

Bit 29 TSTS : Time stamp trigger status

This bit indicates an interrupt event in the MAC core's Time stamp generator block. The software must read the MAC core's status register, clearing its source (bit 9), to reset this bit to 0. When this bit is high an interrupt is generated if enabled.

Bit 28 PMTS : PMT status

This bit indicates an event in the MAC core's PMT. The software must read the corresponding registers in the MAC core to get the exact cause of interrupt and clear its source to reset this bit to 0. The interrupt is generated when this bit is high if enabled.

Bit 27 MMCS : MMC status

This bit reflects an event in the MMC of the MAC core. The software must read the corresponding registers in the MAC core to get the exact cause of interrupt and clear the source of interrupt to make this bit as 0. The interrupt is generated when this bit is high if enabled.

Bit 26 Reserved, must be kept at reset value.

Bits 25:23 EBS[2:0] : Error bits status

These bits indicate the type of error that caused a bus error (error response on the AHB interface). Valid only with the fatal bus error bit (ETH_DMASR register [13]) set. This field does not generate an interrupt.

Bit 23 1 Error during data transfer by TxDMA

0 Error during data transfer by RxDMA

Bit 24 1 Error during read transfer

0 Error during write transfer

Bit 25 1 Error during descriptor access

0 Error during data buffer access

Bits 22:20 TPS[2:0] : Transmit process state

These bits indicate the Transmit DMA FSM state. This field does not generate an interrupt.

000: Stopped; Reset or Stop Transmit Command issued

001: Running; Fetching transmit transfer descriptor

010: Running; Waiting for status

011: Running; Reading Data from host memory buffer and queuing it to transmit buffer (Tx FIFO)

100, 101: Reserved for future use

110: Suspended; Transmit descriptor unavailable or transmit buffer underflow

111: Running; Closing transmit descriptor

Bits 19:17 RPS[2:0]: Receive process state

These bits indicate the Receive DMA FSM state. This field does not generate an interrupt.

000: Stopped: Reset or Stop Receive Command issued

001: Running: Fetching receive transfer descriptor

010: Reserved for future use

011: Running: Waiting for receive packet

100: Suspended: Receive descriptor unavailable

101: Running: Closing receive descriptor

110: Reserved for future use

111: Running: Transferring the receive packet data from receive buffer to host memory

Bit 16 NIS: Normal interrupt summary

The normal interrupt summary bit value is the logical OR of the following when the corresponding interrupt bits are enabled in the ETH_DMAIER register:

Only unmasked bits affect the normal interrupt summary bit.

This is a sticky bit and it must be cleared (by writing a 1 to this bit) each time a corresponding bit that causes NIS to be set is cleared.

Bit 15 AIS: Abnormal interrupt summary

The abnormal interrupt summary bit value is the logical OR of the following when the corresponding interrupt bits are enabled in the ETH_DMAIER register:

Only unmasked bits affect the abnormal interrupt summary bit.

This is a sticky bit and it must be cleared each time a corresponding bit that causes AIS to be set is cleared.

Bit 14 ERS: Early receive status

This bit indicates that the DMA had filled the first data buffer of the packet. Receive Interrupt ETH_DMASR [6] automatically clears this bit.

Bit 13 FBES: Fatal bus error status

This bit indicates that a bus error occurred, as detailed in [25:23]. When this bit is set, the corresponding DMA engine disables all its bus accesses.

Bits 12:11 Reserved, must be kept at reset value.

Bit 10 ETS: Early transmit status

This bit indicates that the frame to be transmitted was fully transferred to the Transmit FIFO.

Bit 9 RWTS: Receive watchdog timeout status

This bit is asserted when a frame with a length greater than 2 048 bytes is received.

Bit 8 RPSS : Receive process stopped status

This bit is asserted when the receive process enters the Stopped state.

Bit 7 RBUS : Receive buffer unavailable status

This bit indicates that the next descriptor in the receive list is owned by the host and cannot be acquired by the DMA. Receive process is suspended. To resume processing receive descriptors, the host should change the ownership of the descriptor and issue a Receive Poll Demand command. If no Receive Poll Demand is issued, receive process resumes when the next recognized incoming frame is received. ETH_DMASR [7] is set only when the previous receive descriptor was owned by the DMA.

Bit 6 RS : Receive status

This bit indicates the completion of the frame reception. Specific frame status information has been posted in the descriptor. Reception remains in the Running state.

Bit 5 TUS : Transmit underflow status

This bit indicates that the transmit buffer had an underflow during frame transmission. Transmission is suspended and an underflow error TDES0[1] is set.

Bit 4 ROS : Receive overflow status

This bit indicates that the receive buffer had an overflow during frame reception. If the partial frame is transferred to the application, the overflow status is set in RDES0[11].

Bit 3 TJTS : Transmit jabber timeout status

This bit indicates that the transmit jabber timer expired, meaning that the transmitter had been excessively active. The transmission process is aborted and placed in the Stopped state. This causes the transmit jabber timeout TDES0[14] flag to be asserted.

Bit 2 TBUS : Transmit buffer unavailable status

This bit indicates that the next descriptor in the transmit list is owned by the host and cannot be acquired by the DMA. Transmission is suspended. Bits [22:20] explain the transmit process state transitions. To resume processing transmit descriptors, the host should change the ownership of the bit of the descriptor and then issue a Transmit Poll Demand command.

Bit 1 TPSS : Transmit process stopped status

This bit is set when the transmission is stopped.

Bit 0 TS : Transmit status

This bit indicates that frame transmission is finished and TDES1[31] is set in the first descriptor.

Ethernet DMA operation mode register (ETH_DMAOMR)

Address offset: 0x1018

Reset value: 0x0000 0000

The operation mode register establishes the Transmit and Receive operating modes and commands. The ETH_DMAOMR register should be the last CSR to be written as part of DMA initialization.

31302928272625242322212019181716
Res.Res.Res.Res.Res.DTCEFDRSFDFRFRes.Res.TSFFTFRes.Res.Res.TTC[2]
rwrwrwrwrsrw
1514131211109876543210
TTC[1:0]STRes.Res.Res.Res.Res.FEFFUGFRes.RTC[1:0]OSFSRRes.
rwrwrwrwrwrwrwrwrw

Bits 31:27 Reserved, must be kept at reset value.

Bit 26 DTCEFD : Dropping of TCP/IP checksum error frames disable

When this bit is set, the core does not drop frames that only have errors detected by the receive checksum offload engine. Such frames do not have any errors (including FCS error) in the Ethernet frame received by the MAC but have errors in the encapsulated payload only. When this bit is cleared, all error frames are dropped if the FEF bit is reset.

Bit 25 RSF : Receive store and forward

When this bit is set, a frame is read from the Rx FIFO after the complete frame has been written to it, ignoring RTC bits. When this bit is cleared, the Rx FIFO operates in Cut-through mode, subject to the threshold specified by the RTC bits.

Bit 24 DFRF : Disable flushing of received frames

When this bit is set, the RxDMA does not flush any frames due to the unavailability of receive descriptors/buffers as it does normally when this bit is cleared. (See Receive process suspended on page 1810 )

Bits 23:22 Reserved, must be kept at reset value.

Bit 21 TSF : Transmit store and forward

When this bit is set, transmission starts when a full frame resides in the Transmit FIFO. When this bit is set, the TTC values specified by the ETH_DMAOMR register bits [16:14] are ignored.

When this bit is cleared, the TTC values specified by the ETH_DMAOMR register bits [16:14] are taken into account.

This bit should be changed only when transmission is stopped.

Bit 20 FTF : Flush transmit FIFO

When this bit is set, the transmit FIFO controller logic is reset to its default values and thus all data in the Tx FIFO are lost/flushed. This bit is cleared internally when the flushing operation is complete. The Operation mode register should not be written to until this bit is cleared.

Bits 19:17 Reserved, must be kept at reset value.

Bits 16:14 TTT[2:0] : Transmit threshold control

These three bits control the threshold level of the Transmit FIFO. Transmission starts when the frame size within the Transmit FIFO is larger than the threshold. In addition, full frames with a length less than the threshold are also transmitted. These bits are used only when the TSF bit (Bit 21) is cleared.

000: 64

001: 128

010: 192

011: 256

100: 40

101: 32

110: 24

111: 16

Bit 13 ST : Start/stop transmission

When this bit is set, transmission is placed in the Running state, and the DMA checks the transmit list at the current position for a frame to be transmitted. Descriptor acquisition is attempted either from the current position in the list, which is the transmit list base address set by the ETH_DMATDLAR register, or from the position retained when transmission was stopped previously. If the current descriptor is not owned by the DMA, transmission enters the Suspended state and the transmit buffer unavailable bit (ETH_DMASR [2]) is set. The Start Transmission command is effective only when transmission is stopped. If the command is issued before setting the DMA ETH_DMATDLAR register, the DMA behavior is unpredictable.

When this bit is cleared, the transmission process is placed in the Stopped state after completing the transmission of the current frame. The next descriptor position in the transmit list is saved, and becomes the current position when transmission is restarted. The Stop Transmission command is effective only when the transmission of the current frame is complete or when the transmission is in the Suspended state.

Bits 12:8 Reserved, must be kept at reset value.

Bit 7 FEF : Forward error frames

When this bit is set, all frames except runt error frames are forwarded to the DMA.

When this bit is cleared, the Rx FIFO drops frames with error status (CRC error, collision error, giant frame, watchdog timeout, overflow). However, if the frame's start byte (write) pointer is already transferred to the read controller side (in Threshold mode), then the frames are not dropped. The Rx FIFO drops the error frames if that frame's start byte is not transferred (output) on the ARI bus.

Bit 6 FUGF : Forward undersized good frames

When this bit is set, the Rx FIFO forwards undersized frames (frames with no error and length less than 64 bytes) including pad-bytes and CRC).

When this bit is cleared, the Rx FIFO drops all frames of less than 64 bytes, unless such a frame has already been transferred due to lower value of receive threshold (e.g., RTC = 01).

Bit 5 Reserved, must be kept at reset value.

Bits 4:3 RTC[1:0] : Receive threshold control

These two bits control the threshold level of the Receive FIFO. Transfer (request) to DMA starts when the frame size within the Receive FIFO is larger than the threshold. In addition, full frames with a length less than the threshold are transferred automatically.

Note: Note that value of 11 is not applicable if the configured Receive FIFO size is 128 bytes.

Note: These bits are valid only when the RSF bit is zero, and are ignored when the RSF bit is set to 1.

00: 64

01: 32

10: 96

11: 128

Bit 2 OSF : Operate on second frame

When this bit is set, this bit instructs the DMA to process a second frame of Transmit data even before status for first frame is obtained.

Bit 1 SR : Start/stop receive

When this bit is set, the receive process is placed in the Running state. The DMA attempts to acquire the descriptor from the receive list and processes incoming frames. Descriptor acquisition is attempted from the current position in the list, which is the address set by the DMA ETH_DMARDLAR register or the position retained when the receive process was previously stopped. If no descriptor is owned by the DMA, reception is suspended and the receive buffer unavailable bit (ETH_DMASR [7]) is set. The Start Receive command is effective only when reception has stopped. If the command was issued before setting the DMA ETH_DMARDLAR register, the DMA behavior is unpredictable.

When this bit is cleared, RxDMA operation is stopped after the transfer of the current frame. The next descriptor position in the receive list is saved and becomes the current position when the receive process is restarted. The Stop Receive command is effective only when the Receive process is in either the Running (waiting for receive packet) or the Suspended state.

Bit 0 Reserved, must be kept at reset value.

Ethernet DMA interrupt enable register (ETH_DMAIER)

Address offset: 0x101C

Reset value: 0x0000 0000

The Interrupt enable register enables the interrupts reported by ETH_DMASR. Setting a bit to 1 enables a corresponding interrupt. After a hardware or software reset, all interrupts are disabled.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.NISE
1514131211109876543210
AISEERIEFBEIERes.Res.ETIERWTIERPSIERBUIERIETUIEROIETJTIETBUIETPSIETIE
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:17 Reserved, must be kept at reset value.

Bit 16 NISE : Normal interrupt summary enable

When this bit is set, a normal interrupt is enabled. When this bit is cleared, a normal interrupt is disabled. This bit enables the following bits:

Bit 15 AISE: Abnormal interrupt summary enable

When this bit is set, an abnormal interrupt is enabled. When this bit is cleared, an abnormal interrupt is disabled. This bit enables the following bits:

Bit 14 ERIE: Early receive interrupt enable

When this bit is set with the normal interrupt summary enable bit (ETH_DMAIER register[16]), the early receive interrupt is enabled.

When this bit is cleared, the early receive interrupt is disabled.

Bit 13 FBEIE: Fatal bus error interrupt enable

When this bit is set with the abnormal interrupt summary enable bit (ETH_DMAIER register[15]), the fatal bus error interrupt is enabled.

When this bit is cleared, the fatal bus error enable interrupt is disabled.

Bits 12:11 Reserved, must be kept at reset value.

Bit 10 ETIE: Early transmit interrupt enable

When this bit is set with the abnormal interrupt summary enable bit (ETH_DMAIER register [15]), the early transmit interrupt is enabled.

When this bit is cleared, the early transmit interrupt is disabled.

Bit 9 RWTIE: receive watchdog timeout interrupt enable

When this bit is set with the abnormal interrupt summary enable bit (ETH_DMAIER register[15]), the receive watchdog timeout interrupt is enabled.

When this bit is cleared, the receive watchdog timeout interrupt is disabled.

Bit 8 RPSIE: Receive process stopped interrupt enable

When this bit is set with the abnormal interrupt summary enable bit (ETH_DMAIER register[15]), the receive stopped interrupt is enabled. When this bit is cleared, the receive stopped interrupt is disabled.

Bit 7 RBUIE: Receive buffer unavailable interrupt enable

When this bit is set with the abnormal interrupt summary enable bit (ETH_DMAIER register[15]), the receive buffer unavailable interrupt is enabled.

When this bit is cleared, the receive buffer unavailable interrupt is disabled.

Bit 6 RIE: Receive interrupt enable

When this bit is set with the normal interrupt summary enable bit (ETH_DMAIER register[16]), the receive interrupt is enabled.

When this bit is cleared, the receive interrupt is disabled.

Bit 5 TUIE: Underflow interrupt enable

When this bit is set with the abnormal interrupt summary enable bit (ETH_DMAIER register[15]), the transmit underflow interrupt is enabled.

When this bit is cleared, the underflow interrupt is disabled.

Bit 4 ROIE : Overflow interrupt enable

When this bit is set with the abnormal interrupt summary enable bit (ETH_DMAIER register[15]), the receive overflow interrupt is enabled.

When this bit is cleared, the overflow interrupt is disabled.

Bit 3 TJTIE : Transmit jabber timeout interrupt enable

When this bit is set with the abnormal interrupt summary enable bit (ETH_DMAIER register[15]), the transmit jabber timeout interrupt is enabled.

When this bit is cleared, the transmit jabber timeout interrupt is disabled.

Bit 2 TBUIE : Transmit buffer unavailable interrupt enable

When this bit is set with the normal interrupt summary enable bit (ETH_DMAIER register[16]), the transmit buffer unavailable interrupt is enabled.

When this bit is cleared, the transmit buffer unavailable interrupt is disabled.

Bit 1 TPSIE : Transmit process stopped interrupt enable

When this bit is set with the abnormal interrupt summary enable bit (ETH_DMAIER register[15]), the transmission stopped interrupt is enabled.

When this bit is cleared, the transmission stopped interrupt is disabled.

Bit 0 TIE : Transmit interrupt enable

When this bit is set with the normal interrupt summary enable bit (ETH_DMAIER register[16]), the transmit interrupt is enabled.

When this bit is cleared, the transmit interrupt is disabled.

The Ethernet interrupt is generated only when the TSTS or PMTS bits of the DMA Status register is asserted with their corresponding interrupt are unmasked, or when the NIS/AIS Status bit is asserted and the corresponding Interrupt Enable bits (NISE/AISE) are enabled.

Ethernet DMA missed frame and buffer overflow counter register (ETH_DMAMFBOCR)

Address offset: 0x1020

Reset value: 0x0000 0000

The DMA maintains two counters to track the number of missed frames during reception. This register reports the current value of the counter. The counter is used for diagnostic purposes. Bits [15:0] indicate missed frames due to the STM32F76xxx and STM32F77xxx buffer being unavailable (no receive descriptor was available). Bits [27:17] indicate missed frames due to Rx FIFO overflow conditions and runt frames (good frames of less than 64 bytes).

31302928272625242322212019181716
Res.Res.Res.OFOCMFA[10:0]OMFC
rc_rrc_rrc_rrc_rrc_rrc_rrc_rrc_rrc_rrc_rrc_rrc_rrc_r
1514131211109876543210
MFC[15:0]
rc_rrc_rrc_rrc_rrc_rrc_rrc_rrc_rrc_rrc_rrc_rrc_rrc_rrc_rrc_rrc_r

Bits 31:29 Reserved, must be kept at reset value.

Bit 28 OFOC : Overflow bit for FIFO overflow counter

Bits 27:17 MFA[10:0] : Missed frames by the application

Indicates the number of frames missed by the application

Bit 16 OMFC : Overflow bit for missed frame counter

Bits 15:0 MFC[15:0] : Missed frames by the controller

Indicates the number of frames missed by the Controller due to the host receive buffer being unavailable. This counter is incremented each time the DMA discards an incoming frame.

Ethernet DMA receive status watchdog timer register (ETH_DMARSWTR)

Address offset: 0x1024

Reset value: 0x0000 0000

This register, when written with a non-zero value, enables the watchdog timer for the receive status (RS, ETH_DMASR[6]).

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.RSWTC[7:0]
rwrwrwrwrwrwrwrw

Bits 31:8 Reserved, must be kept at reset value.

Bits 7:0 RSWTC[7:0] : Receive status (RS) watchdog timer count

Indicates the number of HCLK clock cycles multiplied by 256 for which the watchdog timer is set. The watchdog timer gets triggered with the programmed value after the RxDMA completes the transfer of a frame for which the RS status bit is not set due to the setting of RDES1[31] in the corresponding descriptor. When the watchdog timer runs out, the RS bit is set and the timer is stopped. The watchdog timer is reset when the RS bit is set high due to automatic setting of RS as per RDES1[31] of any received frame.

Ethernet DMA current host transmit descriptor register (ETH_DMACHTDR)

Address offset: 0x1048

Reset value: 0x0000 0000

The Current host transmit descriptor register points to the start address of the current transmit descriptor read by the DMA.

31302928272625242322212019181716
HTDAP[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
HTDAP[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 HTDAP[31:0] : Host transmit descriptor address pointer

Cleared . Pointer updated by DMA during operation.

Ethernet DMA current host receive descriptor register (ETH_DMACHRDR)

Address offset: 0x104C

Reset value: 0x0000 0000

The Current host receive descriptor register points to the start address of the current receive descriptor read by the DMA.

31302928272625242322212019181716
HRDAP[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
HRDAP[15:0]
rrrrrrrrrrrrrrrr
Bits 31:0 HRDAP[31:0] : Host receive descriptor address pointer

Cleared On Reset. Pointer updated by DMA during operation.

Ethernet DMA current host transmit buffer address register (ETH_DMACHTBAR)

Address offset: 0x1050

Reset value: 0x0000 0000

The Current host transmit buffer address register points to the current transmit buffer address being read by the DMA.

31302928272625242322212019181716
HTBAP[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
HTBAP[15:0]
rrrrrrrrrrrrrrrr
Bits 31:0 HTBAP[31:0] : Host transmit buffer address pointer

Cleared On Reset. Pointer updated by DMA during operation.

Ethernet DMA current host receive buffer address register (ETH_DMACHRBAR)

Address offset: 0x1054

Reset value: 0x0000 0000

The current host receive buffer address register points to the current receive buffer address being read by the DMA.

31302928272625242322212019181716
HRBAP[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
HRBAP[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 HRBAP[31:0] : Host receive buffer address pointer
Cleared On Reset. Pointer updated by DMA during operation.

42.8.5 Ethernet register maps

Table 319 gives the ETH register map and reset values.

Table 319. Ethernet register map and reset values

Off-setRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x00ETH_MACCCRRes.Res.Res.Res.Res.Res.CSTFRes.WDJDRes.Res.IFG[2:0]Res.Res.CSDRes.FESRODLMDMIPCORDRes.APCSBL[1:0]DCTERERes.Res.
Reset value0000000000000000000
0x04ETH_MACFFRRARes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HPFSAFSAIFPCFRes.BFDPAMDAIFHMHUPM
Reset value00000000000
0x08ETH_MACHTHRHTH[31:0]
Reset value00000000000000000000000000000000
0x0CETH_MACHTLRHTL[31:0]
Reset value00000000000000000000000000000000
0x10ETH_MACMIARRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.PA[4:0]MR[4:0]CR[3:0]MWMB
Reset value0000000000000000
0x14ETH_MACMIIDRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.MD[15:0]
Reset value0000000000000000
0x18ETH_MACFCRPT[15:0]Res.Res.Res.Res.Res.Res.Res.Res.ZQPDRes.PL[1:0]UPFDRFCETFCEFCB/BPA
Reset value00000000000000000000000
0x1CETH_MACVLANTRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.VLANTCVLANTI[15:0]
Reset value00000000000000000
0x28ETH_MACRWUFFRFrame filter reg0\Frame filter reg1\Frame filter reg2\Frame filter reg3\Frame filter reg4...\Frame filter reg7
Reset value0
0x2CETH_MACPMTCSRWFFRPRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.GURes.Res.WFRMPRRes.Res.WFEMPEPD
Reset value0000000
0x34ETH_MACDBGRRes.Res.Res.Res.Res.Res.TFFTFNEGURes.TFWATFRS[1:0]Res.MTPMTFC[1:0]Res.MMTEARes.Res.Res.Res.Res.RFLL[1:0]Res.Res.RFRCS[1:0]Res.RFWRRes.MSFRWCS[1:0]Res.MMRPEA
Reset value000000000000000000
0x38ETH_MACSR-Res.Res.Res.Res.Res.Res.TSTSRes.Res.MMCTSMMCRSMMCSPMTSRes.Res.Res.
Reset value-00000
0x3CETH_MACIMR-Res.Res.Res.Res.Res.Res.TSTIMRes.Res.Res.Res.Res.PMTIMRes.Res.Res.
Reset value-00
0x40ETH_MACA0HRMORes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.MACA0H[15:0]
Reset value11111111111111111
Table 319. Ethernet register map and reset values (continued)
Off-setRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x44ETH_MACA0LRMACA0L[31:0]
Reset value11111111111111111111111111111111
0x48ETH_MACA1HRAESAMBC[5:0]Res.Res.Res.Res.Res.Res.Res.Res.MACA1H[15:0]
Reset value000000001111111111111111
0x4CETH_MACA1LRMACA1L[31:0]
Reset value11111111111111111111111111111111
0x50ETH_MACA2HRAESAMBC[5:0]Res.Res.Res.Res.Res.Res.Res.Res.MACA2H[15:0]
Reset value000000001111111111111111
0x54ETH_MACA2LRMACA2L[31:0]
Reset value11111111111111111111111111111111
0x58ETH_MACA3HRAESAMBC[5:0]Res.Res.Res.Res.Res.Res.Res.Res.MACA3H[15:0]
Reset value000000001111111111111111
0x5CETH_MACA3LRMACA3L[31:0]
Reset value11111111111111111111111111111111
0x100ETH_MMCCRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.MCFHPMCPMCFRORCSRCR
Reset value000000
0x104ETH_MMCRIRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.RGUFSRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.RFAESRFCESRes.Res.Res.Res.
Reset value000
0x108ETH_MMCTIRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.TGFSRes.Res.Res.Res.Res.TGFMSCSTGFSCSRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Reset value000
0x10CETH_MMCRIMRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.RGUFMRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.RFAEMRFCEMRes.Res.Res.Res.
Reset value000
0x110ETH_MMCTIMRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.TGFMRes.Res.Res.Res.Res.TGFMSCMTGFSCMRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Reset value00
0x14CETH_MMCTGFS
CCR
TGFSCC[31:0]
Reset value00000000000000000000000000000000
0x150ETH_
MMCTGFMSCCR
TGFMSCC[31:0]
Reset value00000000000000000000000000000000
0x168ETH_
MMCTGFCR
TGFC[31:0]
Reset value00000000000000000000000000000000
0x194ETH_
MMCRFCECR
RFCEC[31:0]
Reset value00000000000000000000000000000000
0x198ETH_
MMCRFAECR
RFAEC[31:0]
Reset value00000000000000000000000000000000
Table 319. Ethernet register map and reset values (continued)
Off-setRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x1C4ETH_MMCRGUFCRRGUFC[31:0]
Reset value00000000000000000000000000000000
0x700ETH_PTPSCRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.TSFFMAERes.TSCNT[1:0]TSSMRMETSSEMETSSIPV4FETSSIPV6FETSSPTPOEFETSPTPSV2ETSSSRTSSARFERes.Res.TTSARUTSLITETSSTUTSSTITSFCUTSE
Reset value00000100000000000
0x704ETH_PTPSSIRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.STSSI[7:0]
Reset value00000000
0x708ETH_PTPSHRSTS[31:0]
Reset value00000000000000000000000000000000
0x70CETH_PTPSLRSTPNSSTSS[30:0]
Reset value00000000000000000000000000000000
0x710ETH_PTPSHURTSUS[31:0]
Reset value00000000000000000000000000000000
0x714ETH_PTPSLURTSUPNSTSUSS[30:0]
Reset value00000000000000000000000000000000
0x718ETH_PTPSARTSA[31:0]
Reset value00000000000000000000000000000000
0x71CETH_PTPTHRTTSH[31:0]
Reset value00000000000000000000000000000000
0x720ETH_PTPTTLRTTSL[31:0]
Reset value00000000000000000000000000000000
0x728ETH_PTPSSRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.TSTTRTSSO
Reset value00
0x1000ETH_DMABMRRes.Res.Res.Res.MBAABFPMUSPRDP[4:0]FBPMPBL[4:0]EDFEDSL[3:0]DASR
Reset value000000000100000001000000001
0x1004ETH_DMATPDRTPD[31:0]
Reset value00000000000000000000000000000000
0x1008ETH_DMARPDRRPD[31:0]
Reset value00000000000000000000000000000000
0x100CETH_DMARDLARSRL[31:0]
Reset value00000000000000000000000000000000
0x1010ETH_DMATDLARSTL[31:0]
Reset value00000000000000000000000000000000
0x1014ETH_DMASRRes.Res.TSTSPMTSMMCSRes.EBS[2:0]TPS[2:0]RPS[2:0]NISAISERSFBESRes.Res.ETSRWTSRPSSRBUSRSTUSROSTJTSTBUSTPSSTS
Reset value000000000000000000000000000
0x1018ETH_DMAOMRRes.Res.Res.Res.DTCEFDRSFDFRFRes.Res.TSFFTFRes.Res.Res.TTC[2:0]STRes.Res.Res.Res.FEFFUGFRes.RTCOSFSRRes.Res.Res.Res.
Reset value000000000000000

Table 319. Ethernet register map and reset values (continued)

Off-setRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x101CETH_DMAIERRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.NISEAISEERIEFBEIERes.Res.ETIERWTIERPSERBUIERIETUIEROIETJIETBUJETPSIETIE
Reset value000000000000000
0x1020ETH_DMAMFBO
CR
Res.Res.Res.OFOCMFA[10:0]OMFCMFC[15:0]
Reset value00000000000000000000000000000
0x1024ETH_DMARSWTRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.RSWTC
Reset value000000000
0x1048ETH_DMACHTDRHTDAP[31:0]
Reset value00000000000000000000000000000000
0x104CETH_DMACHRDRHRDAP[31:0]
Reset value00000000000000000000000000000000
0x1050ETH_DMACHTBARHTBAP[31:0]
Reset value00000000000000000000000000000000
0x1054ETH_DMACHRBARHRBAP[31:0]
Reset value00000000000000000000000000000000

Refer to Section 2.2 on page 76 for the register boundary addresses.