2025-01-09 04:46 AM - last edited on 2025-01-09 05:31 AM by SofLit
Steps to reproduce:
Start a new STM32 Project in STM32CubeIDE v1.17.0
Select NUCLEO-F746ZG board, and initailize all peripherals.
Now in the IOC editor, under Middleware select LwIP and enable it.
Set the PHY to LAN8742 in the "Platform Settings" tab.
On the Key Options tab set NO_SYS to OS Not Used.
In General Settings tab, disable DHCP, disable the TCP module and enable UDP.
Go back to Key Options tab and note that the "LWIP_RAM_HEAP_POINTER" is set to 0x30004000
Save, Build an run the project in debug mode.
The code will hard-fault during MX_LWiP_Init() because the RAM HEAP POINTER is wrong.
Now open the file at LWIP/Target/lwipopts.h
Note that at approximately line 58/59 there is:
/*----- Default Value for F7/H7 devices: 0x30044000 -----*/
#define LWIP_RAM_HEAP_POINTER 0x30004000
FIrst of all the comment doesn't match the value given, and even if you change the value given to the same as the comment (this is an F7 device after all) the code will still hard-fault.
If you comment out the #define the code will now build and run, but the number of ETH_RX_BUFFER_CNT buffers you can set in the IOC editor is very limited.
Also, if you make any changes at all to anything in the IOC editor, this line will get put back i and your code will hard-fault again.
Solved! Go to Solution.
2025-01-13 07:16 AM
Hello @KMill, @OWLchan, and @z0ki
Thank you all for your contributions, after discussion with dedicated team:
The “LwIP_HTTP_Server_Netconn_RTOS” example provided for the NUCLEO-F746ZG board is setting LWIP_RAM_HEAP_POINTER to the value of 0x20048000 which is correct because:
(LWIP_RAM_HEAP_POINTER + MEM_SIZE) <= (SRAM1_BASE + SRAM1_SIZE)
So, the computing formula should be:
LWIP_RAM_HEAP_POINTER=(SRAM1_BASE + SRAM1_SIZE - MEM_SIZE)=( 0x20001000 + 0x3C000 + 0x4000)= 0x20048000
Minimal value is 1600 (from the lwIP mw opt.h file)
Max value for F7 is (SRAM1_BASE + SRAM1_SIZE – STACK_SIZE – HEAP_SIZE)
Max value for H7 is (D2_AHBSRAM_BASE + D2_AHBSRAM_SIZE – M4_STACK_SIZE – M4_HEAP_SIZE).
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.
2025-01-13 07:47 AM
@Sarra.S Thank you for this detailed response!
2025-01-13 07:54 AM
If so, can I later move it to sdram or other external ram?