GD32F20x User Manual
829
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 has
stored the receive frame.
3) Handling this receive frame data.
4) Set DAV bit of this descriptor to release this descriptor for new frame receiving.
5) Check next descriptor in table, then goes to Step 2.
27.3.8.
Ethernet interrupts
There are two interrupt vectors in Ethernet module. The first interrupt vector is made up of
Summary of Contents for GD32F20 Series
Page 191: ...GD32F20x User Manual 191 Bits Fields Descriptions 31 0 TRNDATA 31 0 32 Bit Random data ...
Page 290: ...GD32F20x User Manual 290 conversion is ongoing ...
Page 325: ...GD32F20x User Manual 325 15 0 ALRM 15 0 RTC alarm value low ...
Page 385: ...GD32F20x User Manual 385 ...
Page 523: ...GD32F20x User Manual 523 clears AERR bit by writing 0 to it ...