29.01.2015 Views

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

RM0008<br />

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

databus width. If a descriptor is marked as last, then the buffer may not be full (as indicated<br />

by the buffer size in RDES1). To compute the amount of valid data in this final buffer, the<br />

driver must read the frame length (FL bits in RDES0[29:16]) <strong>and</strong> subtract the sum of the<br />

buffer sizes of the preceding buffers in this frame. The receive DMA always transfers the<br />

start of next frame with a new descriptor.<br />

Note:<br />

Even when the start address of a receive buffer is not aligned to the system databus width<br />

the system should allocate a receive buffer of a size aligned to the system bus width. For<br />

example, if the system allocates a 1024 byte (1 KB) receive buffer starting from address<br />

0x1000, the software can program the buffer start address in the receive descriptor to have<br />

a 0x1002 offset. The receive DMA writes the frame to this buffer with dummy data in the first<br />

two locations (0x1000 <strong>and</strong> 0x1001). The actual frame is written from location 0x1002. Thus,<br />

the actual useful space in this buffer is 1022 bytes, even though the buffer size is<br />

programmed as 1024 bytes, due to the start address offset.<br />

27.6.5 DMA arbiter<br />

The arbiter inside the DMA takes care of the arbitration between transmit <strong>and</strong> receive<br />

channel accesses to the AHB master interface. Two types of arbitrations are possible:<br />

round-robin, <strong>and</strong> fixed-priority. When round-robin arbitration is selected (DA bit in<br />

ETH_DMABMR is reset), the arbiter allocates the databus in the ratio set by the RTPR bits<br />

in ETH_DMABMR, when both transmit <strong>and</strong> receive DMAs request access simultaneously.<br />

When the DA bit is set, the receive DMA always gets priority over the transmit DMA for data<br />

access.<br />

27.6.6 Error response to DMA<br />

For any data transfer initiated by a DMA channel, if the slave replies with an error response,<br />

that DMA stops all operations <strong>and</strong> updates the error bits <strong>and</strong> the fatal bus error bit in the<br />

Status register (ETH_DMASR register). That DMA controller can resume operation only<br />

after soft- or hard-resetting the peripheral <strong>and</strong> re-initializing the DMA.<br />

27.6.7 Tx DMA configuration<br />

TxDMA operation: default (non-OSF) mode<br />

The transmit DMA engine in default mode proceeds as follows:<br />

1. The user sets up the transmit descriptor (TDES0-TDES3) <strong>and</strong> sets the OWN bit<br />

(TDES0[31]) after setting up the corresponding data buffer(s) with Ethernet frame data.<br />

2. Once the ST bit (ETH_DMAOMR register[13]) is set, the DMA enters the Run state.<br />

3. While in the Run state, the DMA polls the transmit descriptor list for frames requiring<br />

transmission. After polling starts, it continues in either sequential descriptor ring order<br />

or chained order. If the DMA detects a descriptor flagged as owned by the CPU, or if an<br />

error condition occurs, transmission is suspended <strong>and</strong> both the Transmit Buffer<br />

Doc ID 13902 Rev 9 881/995

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

Saved successfully!

Ooh no, something went wrong!