embedded network_error ai_generated true

ETH: MAC FIFO underflow, transmission stalled on queue 3

ID: embedded/eth-mac-fifo-underflow

Also available as: JSON · Markdown · 中文
76%Fix Rate
83%Confidence
1Evidence
2024-06-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
STM32Cube_FW_H7_V1.11.0 active
LWIP 2.1.3 active
FreeRTOSv202212.01 active
IAR EWARM 9.50.1 active

Root Cause

Ethernet MAC transmit FIFO empties before the packet is fully sent due to insufficient DMA bandwidth or low-priority queue scheduling.

generic

中文

以太网MAC发送FIFO在数据包完全发送前变空,原因是DMA带宽不足或低优先级队列调度。

Official Documentation

https://www.st.com/resource/en/application_note/dm00352730-ethernet-mac-dma-controller-on-stm32-mcus-stmicroelectronics.pdf

Workarounds

  1. 82% success Increase DMA burst length for ETH TX: set ETH_DMABMR->FB = 0x1 (fixed burst) and ETH_DMABMR->PBL = 0x20 (32-beat burst) in HAL_ETH_Init().
    Increase DMA burst length for ETH TX: set ETH_DMABMR->FB = 0x1 (fixed burst) and ETH_DMABMR->PBL = 0x20 (32-beat burst) in HAL_ETH_Init().
  2. 78% success Prioritize ETH DMA channel over other DMA channels using NVIC priority and DMA stream priority (low/high) in CubeMX.
    Prioritize ETH DMA channel over other DMA channels using NVIC priority and DMA stream priority (low/high) in CubeMX.
  3. 80% success Enable ETH TX FIFO threshold programming: set ETH_MACFCR->TFE = 1 and configure ETH_MACFCR->TFT to 0x10 (16 bytes threshold) to trigger DMA earlier.
    Enable ETH TX FIFO threshold programming: set ETH_MACFCR->TFE = 1 and configure ETH_MACFCR->TFT to 0x10 (16 bytes threshold) to trigger DMA earlier.

中文步骤

  1. Increase DMA burst length for ETH TX: set ETH_DMABMR->FB = 0x1 (fixed burst) and ETH_DMABMR->PBL = 0x20 (32-beat burst) in HAL_ETH_Init().
  2. Prioritize ETH DMA channel over other DMA channels using NVIC priority and DMA stream priority (low/high) in CubeMX.
  3. Enable ETH TX FIFO threshold programming: set ETH_MACFCR->TFE = 1 and configure ETH_MACFCR->TFT to 0x10 (16 bytes threshold) to trigger DMA earlier.

Dead Ends

Common approaches that don't work:

  1. Increasing Ethernet buffer size in lwIPopts.h (e.g., PBUF_POOL_SIZE from 16 to 32) 85% fail

    Larger buffers increase latency but do not solve MAC FIFO underflow caused by DMA starvation.

  2. Disabling interrupt coalescing in ETH DMA 75% fail

    More interrupts can increase CPU load and worsen DMA bandwidth contention.

  3. Reducing TCP window size to 1 90% fail

    Severely limits throughput and does not address the underlying FIFO drain issue.