
GD32F10x User Manual
706
Configure AFIO_PCF0 to define which interface mode is selected (MII or RMII).
Configure GPIO module to make selected PADs to alternate function.
Wait the resetting complete
Polling the ENET_DMA_BCTL register until the SWR bit is reset. (SWR bit is set by
default after power-on reset or system reset).
Obtain and configure the parameters in PHY register
According to the frequency of HCLK, configure the SMI clock frequency and access
external PHY register to obtain the information of PHY (e.g. support Half/Full duplex or
not, support 10M/100Mbit speed or not, and so on). Based on supported mode of
external PHY, configure ENET_MAC_CFG register consistent with PHY register.
Initialize the DMA in Ethernet module for transaction
Configure the ENET_DMA_BCTL, ENET_DMA_RDTADDR, ENET_DMA_TDTADDR,
ENET_DMA_CTL registers to initialize the DMA module. (Detailed information refer to
Initialize the physical memory space for descriptor table and data buffer
According to the address value in ENET_DMA_RDTADDR and ENET_DMA_TDTADDR
register, program transmitting and receiving descriptors (with DAV=1) and data buffer.
Enable MAC and DMA module to start transmit and receive
Set TEN and REN bit in ENET_MAC_CFG register to make MAC work for transmit and
receive. Set STE and SRE bit in ENET_DMA_CTL register to make DMA controller work
for transmit and receive.
If transmitting frames is needed
1) Choose one or more programmed transmitting descriptor, write the transmit frame
data into buffer address which is decided in TDES.
2) Set the DAV bit in these one or more transmit frame descriptor.
3) Write any value in ENET_DMA_TPEN register to make TxDMA exit suspend state
and start transmitting.
4) There are two methods for application to confirm whether current transmitting frame
is complete or not. The first method is that application can poll the DAV bit of current
transmit descriptor until it is reset, this means the transmitting is complete. The
second method can be used only when INTC=1. Application can poll the TS bit in
ENET_DMA_STAT register until it is set, this means the transmitting is complete.
If receiving frames is enabled
1) Check the first receive descriptor in descriptor table (whose address is configured in
ENET_DMA_RDTADDR register).
2) If DAV bit in RDES0 is reset, then the descriptor is used and receive buffer space
Summary of Contents for GD32F10 Series
Page 63: ...GD32F10x User Manual 63 programmed during the chip production ...
Page 117: ...GD32F10x User Manual 117 010 1 0 011 0 9 ...
Page 416: ...GD32F10x User Manual 416 shadow register updates every update event ...
Page 427: ...GD32F10x User Manual 427 value ...
Page 518: ...GD32F10x User Manual 518 These bits are not used in SPI mode ...