cancel
Showing results for 
Search instead for 
Did you mean: 

How does the STM32F769 Ethernet DMA advance to the next descriptor in ring mode?

Myasu.1
Senior

I am working with an STM32F769NI and planning to implement my own Ethernet driver without using the HAL. While studying the DMA descriptor system, I found that the hardware supports both ring structure and chain structure descriptors. However, I am having trouble understanding the exact behavior of the ring structure.

For example, suppose I have three TX descriptors: DESC0, DESC1, and DESC2.

  • After the DMA finishes transmitting DESC0, how does it advance to DESC1?

  • Since the descriptor size is fixed, does the hardware simply move to the next descriptor by doing something like: current_descriptor_address + descriptor_size?

  • If that is the case, then I don’t clearly understand what the practical difference is between ring mode and chain mode.

So my questions are:

  1. In the STM32F769 Ethernet DMA, how exactly does the DMA engine move to the next descriptor in ring structure mode? (I would like to understand this at the hardware/register level.)

  2. What is the functional difference between ring structure and chain structure, from the DMA’s point of view? (Both seem to allow continuous descriptor traversal, so I want to understand what changes internally.)

Any detailed explanation of how the DMA walks through descriptors in ring mode vs chain mode would be greatly appreciated.

1 REPLY 1
STackPointer64
ST Employee

Hello @Myasu.1,

Yes, your intuition is basically correct.

In ring mode, the DMA does not read a “next descriptor pointer” from the current descriptor. Instead, it keeps an internal current-descriptor address and advances to the next descriptor by fixed address stepping.

So if descriptors are laid out contiguously and DSL(Descriptor skip length) = 0, the DMA effectively goes from:

DESC0 ==> DESC16 ==> DESC1 and so on.

When the DMA reaches a descriptor marked as end of ring:

  • TX: TER (bit 21 of TDES0)
  • RX: RER (bit 15 of RDES2)

it wraps back to the base address programmed in:

  • TX base: ETH_DMATDLAR (Ethernet DMA transmit descriptor list address register)
  • RX base: ETH_DMARDLAR (Ethernet DMA receive descriptor list address register)

For example, with 3 TX descriptors in ring mode:

  • DESC0: normal
  • DESC1: normal
  • DESC2: TER = 1

the DMA walk is simply:

On the other hand, in chain mode, one of the descriptor address fields is repurposed as the pointer to the next descriptor by setting the RCH and TCH bits. In ring mode, that field can instead be used normally for buffer addressing, because the DMA already knows how to advance.

So, to summarize: ring mode descriptors are treated like an array, whereas chain mode descriptors are treated like a linked list. I encourage you to read the Ethernet chapter in the reference manual, as this is explained very well there.

Best regards,

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.