09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>RM0090</strong> Ethernet (ETH): media access control (MAC) with DMA controller<br />

Receive descriptor acquisition<br />

The receive engine always attempts to acquire an extra descriptor in anticipation of an<br />

incoming frame. Descriptor acquisition is attempted if any of the following conditions is/are<br />

satisfied:<br />

● The receive Start/Stop bit (ETH_DMAOMR register[1]) has been set immediately after<br />

the DMA has been placed in the Run state.<br />

● The data buffer of the current descriptor is full before the end of the frame currently<br />

being transferred<br />

● The controller has completed frame reception, but the current receive descriptor has<br />

not yet been closed.<br />

● The receive process has been suspended because of a CPU-owned buffer<br />

(RDES0[31] = 0) and a new frame is received.<br />

● A Receive poll demand has been issued.<br />

Receive frame processing<br />

The MAC transfers the received frames to the STM32F4xx memory only when the frame<br />

passes the address filter and the frame size is greater than or equal to the configurable<br />

threshold bytes set for the Receive FIFO, or when the complete frame is written to the FIFO<br />

in Store-and-forward mode. If the frame fails the address filtering, it is dropped in the MAC<br />

block itself (unless Receive All ETH_MACFFR [31] bit is set). Frames that are shorter than<br />

64 bytes, because of collision or premature termination, can be purged from the Receive<br />

FIFO. After 64 (configurable threshold) bytes have been received, the DMA block begins<br />

transferring the frame data to the receive buffer pointed to by the current descriptor. The<br />

DMA sets the first descriptor (RDES0[9]) after the DMA AHB Interface becomes ready to<br />

receive a data transfer (if DMA is not fetching transmit data from the memory), to delimit the<br />

frame. The descriptors are released when the OWN (RDES0[31]) bit is reset to 0, either as<br />

the data buffer fills up or as the last segment of the frame is transferred to the receive buffer.<br />

If the frame is contained in a single descriptor, both the last descriptor (RDES0[8]) and first<br />

descriptor (RDES0[9]) bits are set. The DMA fetches the next descriptor, sets the last<br />

descriptor (RDES0[8]) bit, and releases the RDES0 status bits in the previous frame<br />

descriptor. Then the DMA sets the receive interrupt bit (ETH_DMASR register [6]). The<br />

same process repeats unless the DMA encounters a descriptor flagged as being owned by<br />

the CPU. If this occurs, the receive process sets the receive buffer unavailable bit<br />

(ETH_DMASR register[7]) and then enters the Suspend state. The position in the receive<br />

list is retained.<br />

Receive process suspended<br />

If a new receive frame arrives while the receive process is in Suspend state, the DMA refetches<br />

the current descriptor in the STM32F4xx memory. If the descriptor is now owned by<br />

the DMA, the receive process re-enters the Run state and starts frame reception. If the<br />

descriptor is still owned by the host, by default, the DMA discards the current frame at the<br />

top of the Rx FIFO and increments the missed frame counter. If more than one frame is<br />

stored in the Rx FIFO, the process repeats. The discarding or flushing of the frame at the<br />

top of the Rx FIFO can be avoided by setting the DMA Operation mode register bit 24<br />

(DFRF). In such conditions, the receive process sets the receive buffer unavailable status bit<br />

and returns to the Suspend state.<br />

Doc ID 018909 Rev 3 956/1416

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!