cancel
Showing results for 
Search instead for 
Did you mean: 

Ethernet + LwIP + FreeRTOS Issues on NUCLEO-H753ZI

gregoor
Associate

Hi guys, 

I have a STM32 NUCLEO-H753ZI board and the overall goal is to run open62541. In order to do that, I need a working LwIP stack and Ethernet connection. I have done a lot of research and tried multiple settings, but can´t get it working. Below, I´ll describe what I have done so far / settings in the .ioc I have made.

It would be awesome if you could tell me, where my mistake is. 

 

Using STM32CubeIDE Version: 1.19.0 Build: 25607_20250703_0907 (UTC).

 

Clock Configuration:

Input frequency = 8MHz -> PLL Source Mux = HSE -> System Clock Mux = PLLCLK (Enable CSS) 

-> SYSCLOCK = 400 MHz -> D1 CPRE Prescaler = /1 -> 400 MHz -> HPRE Prescaler = /2 -> 200 MHz

-> D1 PPRE, D2 PPRE1, D2 PPRE2, D3 PPRE = /2

 

System Core:

RCC: 

HSE = BYPASS Clock Source

LSE = Crystal

Power Regulator Voltage Scale = Power Regulator Voltage Scale 1

SYS:

Timebase Source = TIM6

NVIC:

Ethernet global interrupt = Enabled, Preemption Priority = 5

Ethernet wake-up interrupt through EXTI line 86 = Enabled, Preemption Priority = 5

CORTEX_M7:

See Screenshot attached below.

Connectivity:

ETH: 

Enabled in RMII

NVIC Settings as described in NVIC

GPIO Settings: Set Maximum output speed to "Very High" for every Pin

 

Middleware and Software Packs:

FreeRTOS:

Using CMSIS v1 (FreeRTOS version 10.3.1, CMSIS-RTOS version 1.02)

ENABLE_FPU = Enabled

MINIMAL_STACK_SIZE = 1024 Words

TOTAL_HEAP_SIZE = 300000 Bytes

Memory Management scheme = heap_4

LWIP:

Platform Settings: LAN8742 and as Solution also LAN8742

General Settings: DHCP = Disabled, Set own IP-Address, Netmask and Gateway (those are fine) 

General Settings: ICMP, DNS, UDP, TPC = Enabled 

Key Options: Please see .pdf with Screenshots below

 

Preprocessor:

Under Properties -> C/C++ Build -> MCU/MPU GCC Compiler -> Preprocessor I added "DATA_IN_D2_SRAM"

to the Define symbols.

 

_FLASH.id:

/* Specify the memory areas */
MEMORY
{
  FLASH (rx)     		: ORIGIN = 0x08000000, LENGTH = 2048K
  DTCMRAM (xrw) 	 	: ORIGIN = 0x20000000, LENGTH = 128K
  RAM_D1 (xrw)   		: ORIGIN = 0x24000000, LENGTH = 512K
  RAM_D2   (xrw) 		: ORIGIN = 0x30020000, LENGTH = 256K   /* SRAM2 */
  RAM_D2_SRAM3 (xrw) 	: ORIGIN = 0x30040000, LENGTH = 32K    /* SRAM3 */
  RAM_D3 (xrw)   		: ORIGIN = 0x38000000, LENGTH = 64K
  ITCMRAM (xrw)  		: ORIGIN = 0x00000000, LENGTH = 64K
}

And between .data and .bss I added:

  /* --- Ethernet DMA descriptors -> D2 SRAM3 --- */
  ETH_DESCRIPTORS (NOLOAD) :
  {
    . = ALIGN(32);
    *(.RxDecripSection)
    *(.TxDecripSection)
    . = ALIGN(32);
  } >RAM_D2_SRAM3

  /* --- Ethernet buffers -> D2 SRAM2 --- */
  ETH_BUFFERS (NOLOAD) :
  {
    . = ALIGN(32);
    *(.Rx_PoolSection)
    *(.RxArraySection)
    *(.TxArraySection)
    . = ALIGN(32);
  } >RAM_D2

And in ethernetif.c there is:

#if defined ( __ICCARM__ ) /*!< IAR Compiler */
#pragma location = 0x30000100
extern u8_t memp_memory_RX_POOL_base[];

#elif defined ( __CC_ARM ) /* MDK ARM Compiler */
__attribute__((section(".Rx_PoolSection"))) extern u8_t memp_memory_RX_POOL_base[];

#elif defined ( __GNUC__ ) /* GNU */
__attribute__((section(".Rx_PoolSection"))) extern u8_t memp_memory_RX_POOL_base[];
#endif

in the .map there is:

ETH_DESCRIPTORS
                0x30040000       0xc0
                0x30040000                        . = ALIGN (0x20)
 *(.RxDecripSection)
 .RxDecripSection
                0x30040000       0x60 ./LWIP/Target/ethernetif.o
                0x30040000                DMARxDscrTab
 *(.TxDecripSection)
 .TxDecripSection
                0x30040060       0x60 ./LWIP/Target/ethernetif.o
                0x30040060                DMATxDscrTab
                0x300400c0                        . = ALIGN (0x20)

ETH_BUFFERS     0x30020000     0x6220
                0x30020000                        . = ALIGN (0x20)
 *(.Rx_PoolSection)
 .Rx_PoolSection
                0x30020000     0x6203 ./LWIP/Target/ethernetif.o
                0x30020000                memp_memory_RX_POOL_base
 *(.RxArraySection)
 *(.TxArraySection)
                0x30026220                        . = ALIGN (0x20)

 

When debugging, it always ends in an endless loop somewhere or jumps to a Hard Fault. 

Couldn`t really figure out why or which specific error it is. 

If you have any tips or maybe some kind of example project where LwIP + FreeRTOS is working, that would be awesome. 

Cheers, 

Gregor 

1 REPLY 1
STackPointer64
ST Employee

Hello @gregoor, and welcome to ST community!

Knowing which instruction halts your application can greatly help in resolving any issues you encounter. For that, I suggest you take a look at the article below—it will help you pinpoint the cause of the HardFault. When the program halts, if possible, check the tab called "Call Stack" on your left. There, you will find an ordered list of functions that led to the HardFault.

For similar projects you can refer to and learn from, the second link provides an example of an LwIP + FreeRTOS application on the STM32H743-Nucleo. This board shares the same architecture as the STM32H753-Nucleo, with the only difference being the addition of the cryptography module in the latter MCU.

Best regards,

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.