STM32H723VGT6 + ETH + LWIP: Error pbuf_alloc and ETH DMAErrorCode 0x4080
Post edited by ST moderator to be inline with the community rules especially with the code sharing. In next time please use </> button to paste your code. Please read this post: How to insert source code.
Hi all,
I am working with STM32H723VGT6, using ETH and SPI4.
I have configured Ethernet following this ST Community guide:
https://community.st.com/t5/stm32-mcus/how-to-create-a-project-for-stm32h7-with-ethernet-and-lwip-stack/ta-p/49308
When I follow the instructions exactly, I noticed that memp_memory_RX_POOL_base is located at 0x24000000.
Current problem
When running my program, the crash occurs at:
struct pbuf *q;
q = pbuf_alloc(PBUF_TRANSPORT, length, PBUF_RAM);
Inside pbuf_alloc, in the case PBUF_RAM:
p = (struct pbuf *)mem_malloc(alloc_len);
In mem_malloc, the program fails at:
/* Scan through the heap searching for a free block that is big enough */
for (ptr = mem_to_ptr(lfree); ptr < MEM_SIZE_ALIGNED - size;
ptr = ptr_to_mem(ptr)->next) {
mem = ptr_to_mem(ptr);
}
Although mem is allocated with the LWIP heap pointer address successfully, at the same time, ETH->DMAErrorCode reports 0x4080.
What I have configured
-
I have set up MPU regions for DMA descriptors and LWIP RAM heap.
-
RX pool is located in D1 SRAM (0x24000000).
-
DMA descriptors are in D2 SRAM (0x30000000 onwards).
-
LWIP RAM heap pointer for TX buffers is set correctly in D2 SRAM.
Observations
-
The crash seems related to mem_malloc scanning the heap, possibly because of DMA or MPU configuration.
-
ETH DMA fails immediately with code 0x4080 when trying to allocate pbuf.
Files attached
-
main.c with MPU configuration
-
Screenshots showing memory map and error
-
Other relevant configuration
Questions
-
Is it safe to locate memp_memory_RX_POOL_base in D1 SRAM (0x24000000) on STM32H723?
-
Should RX pool be moved to D2 SRAM, even if only 32 KB is available? How to divide RX descriptors, RX pool, and TX heap safely?
-
Are there known issues with mem_malloc + pbuf_alloc when using D1 SRAM + DMA ETH on H723?
Any guidance or suggestions will be highly appreciated!
Thanks,






