cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H723VGT6 + ETH + LWIP: Error pbuf_alloc and ETH DMAErrorCode 0x4080

phamtutailtvm
Associate II

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  

  1. Is it safe to locate memp_memory_RX_POOL_base in D1 SRAM (0x24000000) on STM32H723?

  2. 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?

  3. 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,

z7022415138318_53a4ba9ef2a8800c838796943092a048.jpg

z7022403546046_2400ad221a721cad087ab732fae8b8da.jpg

z7022405348900_284cad205d7a6ee56e6b91a70d6989ca.jpg

z7022406758162_ce3601a00c2d406fbcddef932d4bfdee.jpg

z7022408559660_beeb34be33d51a1390d129f00e20d067.jpg

z7022414328393_290b6b67e8b28a3feac63785e9170180.jpg

0 REPLIES 0