cancel
Showing results for 
Search instead for 
Did you mean: 

Ethernet transmit descriptor BxL vs FL, treatment of oversized packets bellow 2kb, and D2 memory (STM32H745ZI - RM0399).

Bmen.1
Associate

B1L/B2L vs FL

I'm writing an ethernet driver and the FL field in TDES3 seems to not do anything.

0693W00000FAmTkQAL.jpgI am not setting the TSE bit.

The packets seem to always leave with a size that is the sum of both B1L and B2L (if used).

In my last test I set it up like so:

0693W00000FAmUdQAL.jpgAnd it still worked.

No matter the combination of B1L, B2L and FL, it always just sends the totality of the buffers.

My struct for the descriptor is as far as I can tell correct:

0693W00000FAmTzQAL.jpgI have gone over it a few times, and the other flags in TDES3 are getting set correctly as well so I'm pretty sure it's correct.

I could see this as perhaps being used for a >1 descriptor transmit, but I have yet to use that, or jumbo packets, or giant packets - and even for giant packets, B1L and B2L both have 14 bits, and FL has 15, which means MAX(B1L)+MAX(B2L)==MAX(FL), which makes it seem to me like you don't even need multiple descriptors to send the maximum size packet of ~32kb. That's not relevant though because even with jabber disabled, transmit can only go up to 16kb, for which only 1 buffer is required. Plus the value can be zero and still work, which makes me think it wouldn't work even for >1 descriptor transmit.

Regardless I would just like to know whether I should be concerned just setting it to 0, or what I should actually set it to. The HAL seems to set it but since it doesn't seem to do anything, a little clarification would be greatly appreciated.

Oversized packets < 2k

One other thing is - there is a jabber timeout error that gets set in multiple places (TDES3, MACRXTXSR, and or-ed in MACISR with other errors) - but the jabber only times out at 2k.

I initially sent a 1536 (1024+512) byte buffer, I set FL to 48 (the real packet size) thinking it would make it only send 48 bytes, but it attempted to send the whole 1536 (the big size on the buffer was just for future use and to keep it aligned and padded to a 512 byte border).

The packet never really got to my computer, and I didn't get any errors on the STM.

I sadly have no access to a computer with jumbo packet support at the moment, so I can't be sure whether the packets were dropped at the MAC, PHY or the PC's NIC. The last 2 could make sense as that is slightly above the MTU, and the first could happen if the documentation failed to mention that the MAC drops packets > MTU if jumbo is disabled.

So I would like to know whether that's the case for the MAC - does it drop transmitted packets if their size is greater than the MTU, or does it always send them (up to the jabber limit of 2048)?

D2 Memory

Last thing is about the need to use domain 2 memory for ethernet buffers and descriptors.

I found in this article (link is to an article here) that that was the case, but only after I banged my head on the peripheral for a week. I looked at the bus interconnect matrix on pages 108 and 109 of RM0399, and as far as I could understand (I'm not terribly experienced) the ethernet DMA master should have no problems writing to AXI SRAM. And in the whole ethernet chapter (I split it off the reference manual for ease of searching) the term "SRAM" is only present once where it says "In the Ethernet peripheral, the DMA transfers data based on a linked list of descriptors. The application creates the descriptors in the system memory (SRAM). " (page 3035 of RM0399), and the term "domain" is only mentioned in unrelated clock matters.

Did I misread the documentation or is there no mention that one has to use D2 memory? If I did misread, I would also love to know how, so I don't repeat the same mistake on another peripheral/controller.

:grinning_face:

I put these 3 questions in a single post because I felt it wasn't warranted to create 3 for matters which are so closely related, feel free to let me know if that's wrong on my part as well.

Thank you.

0 REPLIES 0