cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H563RGT6 with LAN8742A phy

aravindpv
Associate II

Hi as part of my project I am trying to integrate the mentioned parts in subject to control modbus eth relay over tcpip.

What I have done so far.

1. Integrated Lan chip driver to stm32 library and initalization done.

2. Integrated LwIP stack from online resources and confirmed LwIP integration succeeded. (Since i'm using STM32H563RGT6 MCU and it doesnt have inbuilt LwIP stack with in it).

3. Initially tried to establish a connection with my PC and try a ping test.

4. I'm facing ARP Resolution initally but somehow it resolved and now i can find my MCU ip and mac address on my PC, but still ping is not reachable.

5. My POV is that if its capable of handling etherent packets then i can start work on with modbus packets to trigger the relay module.

Pls help me with this case...
 

aravindpv_0-1750917437924.pngaravindpv_1-1750917664915.pngaravindpv_2-1750917679386.png

 

12 REPLIES 12
STackPointer64
ST Employee

Thanks for sharing your project details, @aravindpv. From my review, here are a few points to consider:

  • In app_freertos.c, the linker file is missing LwIP section configurations, and the stack size is set to 256 words × 4, which may be insufficient. Also, using LwIP polling functions (like ethernetif_input(...)) inside the default task’s while loop is incorrect and won’t work. You should terminate the init thread with osThreadTerminate instead.

  • In ethernetif.c, several essential functions are missing, including LwIP and callback functions that handle semaphores and other tasks. Additionally, the MAC address is commented out, so no MAC is assigned as the config struct used by LwIP.

  • The project also lacks an application layer such as a UDP server, which is necessary to ping the board and test connectivity.

To move forward, you have two options:

  1. Compare your project with a working example that uses FreeRTOS. Note that the LwIP_TCP_ECHO_SERVER example does not implement FreeRTOS, so configurations differ between RTOS and non-RTOS setups.

  2. I recommend starting from the LwIP_UDPTCP_Echo_Server_Netconn_RTOS project and adapting only chip-specific parts like GPIO configuration, ETH MSP init/deinit, clock setup, linker file (ensuring memory sections are respected), and LwIP configurations (memory size, stack size, etc.).

The choice is yours, and I will support you along the way until you have a working example.

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

Hi @STackPointer64 , I was busy with some other works for the last week.
As you suggested I used the LwIP_UDPTCP_Echo_Server_Netconn_RTOS and the integration was successful.

  1.  I used the stack size 512*4
  2. As you mentioned using ethernetif_input inside the for(;;) loop, i expect it to do polling and i feel its correct for my requirement.
  3. I followed this  https://community.st.com/t5/stm32-mcus/how-to-use-the-lwip-ethernet-middleware-on-the-stm32h5-series/ta-p/691100#:~:text=This%20article%20presents%20a%20tutorial%20on%20manually%20importing,STM32H5%20microcontroller%20series%20without%20relying%20on%20the%20STM32CubeMX. for developement
  4. Present condition is that the normal ping from PC isnt working, it showing request timed out. But the ARP resolution is working and i can see th log on uart (Pls refer the screenshots attached)

  5. But nping from works well and getting response (Pls refer the screenshots attached)
  6. I can see the traffic on wireshark aswell
  7. Tried turning off the firewall etc..

pls help me with this case..

aravindpv_0-1752756758419.png

 

Screenshot 2025-07-17 182538.png

 

 

aravindpv
Associate II

@STackPointer64 
please see the attached file.
I am not passin after netconn_accept. i have tried running a client from windows PC using telnet and it exits with timeout.