cancel
Showing results for 
Search instead for 
Did you mean: 

ETH and LwIP memories configurations

iTTy
Associate III

Hi there!

I already configured LwIP package and make it work on a NUCLEO-H755ZIQ following @Adam BERLINGER gude in the Knowledge base section.

Even if the communication is working, some configurations are to me totally cryptic...
In particular, I would like to learn how to configure ETH and LWIP in a consistent and effective way, avoiding memory waste and ensuring stability.

I have a lot of question and I would like to collect yours replies in a sort of practical guide for newbies...

Below, my actual working ETH configuration: 

iTTy_0-1712837348043.png

There, my LwIP configuration:

iTTy_1-1712837663959.png

Starting from these, on the ETH side:

  1. What is the descriptors size? (To locate the right memory amount, descriptor size shall be multiplied for the descriptors length, right?)
  2. Rx buffer length is a constant or could be changed? What other parameters will be affected from this?

On the LwIP side (my nightmare):

  1. How several memory-related parameters should be calculated according to others ones?
  2. How much heap shall be allocated?
  3. Is the configuration above is coherent or I'm wasting/missing memory?

...

 

Thanks in advance for your support!

1 REPLY 1
STea
ST Employee

 

Hello @iTTy,

I would like to thank you for your interest in the clarification of Ethernet software and Hardware configuration for newbies and we are actively trying to cover all unclear point regarding the Ethernet peripheral across the supporting STM32 families.

Now answering some of your inquiries:

Starting from these, on the ETH side:

the configuration of Ethernet can vary from an STM32 family to another due to the supported modes and features like RMII and MII and the implemented cortex (M4 M7 M33...) as well as the memory that we are using to store the descriptors and buffers causing deferent memory configurations for example the MPU the cachability for M7 based MCUs and security access permission for cortex M33. we try to address each configuration separately in articles as the article you used.  

1-What is the descriptors size? (To locate the right memory amount, descriptor size shall be multiplied for the descriptors length, right?)

the descriptor size can be either 96 or 128 bytes depending on the DMA descriptor size we assume in the default configuration it is 128 bytes.

2-Rx buffer length is a constant or could be changed? What other parameters will be affected from this?

the Rx buffer length can be modified, and this will affect the amount of memory allocated in the SRAM for it because we will allocate Rx buffer length * Rx descriptor length.

On the LwIP side (my nightmare) (hope it won't be anymore):

How several memory-related parameters should be calculated according to others ones?

you need to calculate the starting address of the LWIP heap depending on the last address of the RX buffer to properly align all the parameters in the same SRM region to be able to do the proper MPU configuration in one region if needed. this can give you better flexibility in the placement of your allocated memories as you can change the placement to a more rapidly accessed memory for your specific MCU( DTCM ,AXISRAM,SRAM1,SRAM2,external memories using FMC OR OCTOSPI interfaces ...)

How much heap shall be allocated?

Thins depends on your application needs for handling tcp/ip stack and other high-level application protocols (http, ftp ...)

Is the configuration above is coherent or I'm wasting/missing memory?

you are placing descriptors and Buffers in SRAM 3 (starting with 0x30040000) which is connected to the Ethernet MAC using 32-bit AHB bus matrix in the D2 domain and placing the LWIP heap in AXISRAM (region starting with 24000000) and you are allocating 64 KB for the LWIP HEAP this can be reduced or added depending on your planned usage if you are not really in need of it you can reduced and place it alongside the buffer and descriptors in the SRAM3 .

a very helpful detailed video explains the proper configuration the Ethernet and the necessary memory configuration and changes to the Linker file can be found in here.

hope this helps clarifying some of your questions and we will be regularly adding some hints/tips and usecases for the Ethernet peripheral in the Knowledge base section. 

BR

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.