STM32F207VC – Ping works after cable insertion, but TCP server does not accept connections
Hello,
I am using an STM32F207VC custom board with Ethernet and LwIP. I am facing an issue related to Ethernet cable connection during power-up.
I performed the following tests:
Test A: Ethernet cable connected before power ON
Connect the Ethernet cable.
Power ON the STM32 board.
Result:
Ping: Working
TCP server connection: Working
Test B: Ethernet cable disconnected during power ON
Disconnect the Ethernet cable.
Power ON the STM32 board.
Wait until all STM32, Ethernet, and LwIP initialization is completed.
Connect the Ethernet cable.
Result:
PHY Link Up: Detected
Ping: Working
TCP server connection: Not working
Test C: Cable disconnect and reconnect after normal startup
Start the board with the Ethernet cable connected.
TCP server works normally.
Disconnect the Ethernet cable.
Reconnect the Ethernet cable.
Result:
Ping: Working
TCP server connection: Working
The issue occurs only when the STM32 board is powered ON while the Ethernet cable is disconnected and the cable is connected later.
Since ping works and the PHY link-up event is detected, I believe the Ethernet MAC and PHY communication are working correctly. However, the TCP server does not accept a connection in this case.
I am using:
MCU: STM32F207VC
Ethernet: RMII
LwIP: [Please add your version]
PHY: [LAN8720 / LAN8742A]
TCP server: [Raw API / Netconn API / Socket API]
Could this issue be related to:
netif_set_link_up() handling?
LwIP network interface state when the cable is disconnected during startup?
TCP server initialization before the PHY link becomes UP?
Ethernet link status callback handling?
What is the recommended method to handle a situation where the Ethernet cable is disconnected during power-up and connected later?
Any guidance or example would be appreciated.
Thank you.
