29.01.2015 Views

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

RM0008<br />

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

Figure 310. Descriptor ring <strong>and</strong> chain structure<br />

Ring structure<br />

Chain structure<br />

Descriptor 0<br />

Buffer 1<br />

Buffer 2<br />

Descriptor 0<br />

Buffer 1<br />

Descriptor 1<br />

Descriptor 2<br />

Buffer 1<br />

Buffer 2<br />

Buffer 1<br />

Buffer 2<br />

Descriptor 1<br />

Buffer 1<br />

Descriptor n<br />

Buffer 1<br />

Buffer 2<br />

Descriptor 2<br />

Buffer 1<br />

Next descriptor<br />

ai15638<br />

27.6.1 Initialization of a transfer using DMA<br />

Initialization for the MAC is as follows:<br />

1. Write to ETH_DMABMR to set STM32F107xx bus access parameters.<br />

2. Write to the ETH_DMAIER register to mask unnecessary interrupt causes.<br />

3. The software driver creates the transmit <strong>and</strong> receive descriptor lists. Then it writes to<br />

both the ETH_DMARDLAR <strong>and</strong> ETH_DMATDLAR registers, providing the DMA with<br />

the start address of each list.<br />

4. Write to MAC Registers 1, 2, <strong>and</strong> 3 to choose the desired filtering options.<br />

5. Write to the MAC ETH_MACCR register to configure <strong>and</strong> enable the transmit <strong>and</strong><br />

receive operating modes. The PS <strong>and</strong> DM bits are set based on the auto-negotiation<br />

result (read from the PHY).<br />

6. Write to the ETH_DMAOMR register to set bits 13 <strong>and</strong> 1 <strong>and</strong> start transmission <strong>and</strong><br />

reception.<br />

7. The transmit <strong>and</strong> receive engines enter the running state <strong>and</strong> attempt to acquire<br />

descriptors from the respective descriptor lists. The receive <strong>and</strong> transmit engines then<br />

begin processing receive <strong>and</strong> transmit operations. The transmit <strong>and</strong> receive processes<br />

are independent of each other <strong>and</strong> can be started or stopped separately.<br />

27.6.2 Host bus burst access<br />

The DMA attempts to execute fixed-length burst transfers on the AHB master interface if<br />

configured to do so (FB bit in ETH_DMABMR). The maximum burst length is indicated <strong>and</strong><br />

limited by the PBL field (ETH_DMABMR [13:8]). The receive <strong>and</strong> transmit descriptors are<br />

always accessed in the maximum possible burst size (limited by PBL) for the 16 bytes to be<br />

read.<br />

The Transmit DMA initiates a data transfer only when there is sufficient space in the<br />

Transmit FIFO to accommodate the configured burst or the number of bytes until the end of<br />

frame (when it is less than the configured burst length). The DMA indicates the start address<br />

<strong>and</strong> the number of transfers required to the AHB Master Interface. When the AHB Interface<br />

is configured for fixed-length burst, then it transfers data using the best combination of<br />

Doc ID 13902 Rev 9 879/995

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

Saved successfully!

Ooh no, something went wrong!