Skip to main content
Visitor II
October 7, 2024
Solved

STM32H7 RMII and lwIP memory allocation problem

  • October 7, 2024
  • 2 replies
  • 1217 views

Hello members of the ST community,

I want to access LAN8742 PHY with RMII via ethernet protocol with STM32H743VIT6 microcontroller. I want to run the system using the default address settings generated by CubeMX. I created 10kB space for MEM_SIZE. I wanted to access the callback function of the system over ethernet by creating a UDP server. The system does not enter the callback function determined by the data coming over UDP. The addressing I used in this microcontroller is shown below;


LWIP_RAM_HEAP_POINTER : 0x30004000
First Tx Identifier Address : 0x30000080
First Rx Identifier Address : 0x30000000
Rx Buffers Address : 0x30000100


I found an application for lwIP application in the forum using MII connections. I tried the configurations there but no results. When I run the system in debug mode, mem_malloc: could not allocate in mem.c is returned;

 

MEM_STATS_INC(err);
LWIP_MEM_ALLOC_UNPROTECT();
sys_mutex_unlock(&mem_mutex);
LWIP_DEBUGF(MEM_DEBUG | LWIP_DBG_LEVEL_SERIOUS, (“mem_malloc: could not allocate %”S16_F“ bytes\n”, (s16_t)size));
return NULL;

 

Can you help how to fix this problem. Thanks.

 

    This topic has been closed for replies.
    Best answer by mƎALLEm

    You can also refer to this github link (especially for flash.ld file modification for placement of DMA descriptors and RX buffers).

     

    2 replies

    Technical Moderator
    October 7, 2024

    Hello @mmercan and welcome to the community,

    Could you please refer to this article on how to create a project for STM32H7 with Ethernet and LwIP stack 

    mƎALLEmAnswer
    Technical Moderator
    October 8, 2024

    You can also refer to this github link (especially for flash.ld file modification for placement of DMA descriptors and RX buffers).