![ARTERY AT32F435 Series Reference Manual Download Page 591](http://html1.mh-extra.com/html/artery/at32f435-series/at32f435-series_reference-manual_2977592591.webp)
AT32F435/437
Series Reference Manual
2022.11.11
Page 591
Rev 2.03
DMA AHB host burst access
The DMA executes a fixed-length burst access on the AHB master interface if the FB bit is set in the
EMAC_DMABM register. The maximum burst length is defined by the PBL filed (bit [13: 8] in the
EMAC_DMABM register). The receive and transmit descriptors are always accessed in the maximum
possible burst size (limited by PBL) for the 16 bytes to read.
The DMA provides the start address and the number of transfers to the AHB master interface before
starting one transfer.
Note that one of the following conditions must be respected for transmission:
1.
TXFIFO space is greater than the programmed burst size
2.
The number of bytes before the end of a frame is less than the burst size and the TXFIFO can
accommodate these bytes
One of the following conditions must be respected for reception:
1. The data available in the RXFIO is greater than the programmed burst size
2.
The number of bytes before the end of a frame is less than the burst size and the end of the frame
is detected in the RXFIFO
AHB host data alignment
The DMA always initiates transfers with address aligned to the bus width. But the start address of the
buffers can aligned to any of the four bytes.
Example of buffer read: If the transmit buffer address is 0x2000 0AA3, and 15 bytes are to be
transferred, then the DMA will read five words (32 bits) from the address 0x2000 0AA0, but when
transferring data to the TXFIFO, the first three bytes and the last two bytes will be ignored. The
DMA always ensures that is transfer a 32-bit data to the TXFIFO, unless it is the end of the
frame.
Example of buffer write: If the receive buffer address is 0x2000 0BB2 and 16 bytes are to be
transferred, the DMA will read five 32-bit data from the address 0x2000 0BB0. But the first two
bytes and the last two bytes are dummy data.
Buffer size calculation
For transmission, software needs to calculate the buffer size. The TXDMA transfers the exact number of
bytes programmed by buffer size field in the TDES1 to the EMAC core. If the FS bit is set in the TDES0,
the DMA marks the first transfer from the buffer as the start of frame. If the LS bit is set in the TDES0,
the DMA marks the last transfer from the buffer as the end of frame.
During a frame reception, if the receive buffer address is word-aligned, the valid length of the buffer
refers to the value programmed in the RDES1 if the receive buffer address is not word-aligned, the valid
length of the buffer is less than the value configured in the RDES1. The valid length value of the buffer
is the value indicated by the RDES1 minus the lower two bit value of the buffer address. For example, if
the total buffer size is 1024 bytes and the buffer address is 0x2000 0001, the lower 2-bit value of the
address is 0x01, then the valid buffer size is 1023 bytes.
The FS bit is set by the DMA controller when an SOF is received. The LS is set when an EOF is received.
If the receive buffer length field is big enough to accommodate a full frame, then both the FS and LS bits
will be set in the same descriptor. The actual length of the received frame is indicated by the FL bit in
the RDES0.
DMA arbiter
Two types of arbitrations are used for the arbitration between transmit and receive controller: round-bin,
and fixed-priority. When round-robin is selected (DA bit is set in the EMAC_DMABM register), the arbiter
allocates the databus according to the ratio set by the PR bit in the EMAC_DMABM register, when both
transmit and RXDMA request access to the AHB bus simultaneously. When the DA bit is set, the RXDAM
always has priority over the TXDMA for data access.
Error response to DMA
If an error response is received during DMA transfer, then the DMA stops all operations and updates the
error bit and the fatal bus error bit in the EMAC_DMASTS register. The DMA can resume operation after
software or hardware resets the Ethernet peripherals and re-initiates the DMA.