Showing results for 
Search instead for 
Did you mean: 

Ethernet peer to peer without a switch - partially working

Associate III

I'm using a STM32F746-disco and lwip to communicate with and another embedded system (a commercial standalone air monitoring system).

When the two are connected via a switch the STM32 can Ping, get web pages via HTTP and get FTP files from the industrial system quite happily.

When I remove the switch, Ping works, however with HTTP and FTP lwip’s netconn_connect() seems to connect but I can’t get any data to transfer, it just times out on the read/write.

I tried cross over cables etc, and everything I can think of. Normally I'd have access to an optiview, but with lockdown I cant get hold it it!

I can go into a lot more detail, lwip diagnostics etc, and share code etc, but if there is someone out there who can say if this should work or not, or what to look for it’d really help.



Chief II

The LAN8742A supports Auto-MDIX, therefore it should work with both direct and cross cables, if it's not misconfigured.

What's with IP address configuration - do you use DHCP, manual or Auto-IP for connection without switch?

And the main question - what drivers/software are involved? If it's ST's broken bloatware, then are all of the following issues fixed?

Associate III


thanks for the reply. There is a lot to read there, looks like good information.. its going to take a day or two to digest 🙂

As for your question, I've tried manual and auto-IP configuration and both give the same result. Clearly as ping is working, data is being passed.

I get the same results if I cross the cable, so yea with Auto-MDIX, its not the cabling config (again, ping works)

It all the latest CubeMX, HAL and lwip. I've played around with the clocks, heap/stack everything. I've got the Ethernet MPU regions correctly configured etc.

It must be something a switch is doing that isn't there when directly wired. The switch has nothing else plugged into it, just the uC and target device.

to summerise, with a switch I get Ping, HTTP and FTP working fine. Directly wired just FTP.

Anyway off to read the stuff you reference.... (and take another look at the lwip debug output!)



Associate III

Pirhana, (and anyone else who can help - I'm really stuck)

Bit of an update.


Piranha, I've read all your stuff regarding the Ethernet, wow what a mess ST's code is!!

I know you're prob busy fixing all their bugs, but maybe this is one as well 🙂


I'm still having problems after I've hacked about with my code wrt to all your observations/fixes.

Interestingly I've tried it all in Ethernet polling mode and it make no difference.

Remember, My FTP client works well when I have a switch, but not without. I’ve turned off/on auto negotiation and played with the settings – but I have these right,

In my FTP client, I setup two netconn interfaces, one for the cmd and one for the data (using PORT mode, as server does not support PASV).

The command port logs and sees all the FTP responses from the server etc, but I get nothing on the data port. It’s as if the data is just being discarded by the hardware. Interestingly I get a 226 Transfer Complete after a while on the command port, suggesting the server thinks it sent the data.

I'm seeing no interrupts when I expect to see then as FTP data packets arrive on the other port. When it works with the switch my ETH_IRQHandler get loads of hits, but man less without - corresponding to it not seeing the data packets, I think.

I get the 226 Transfer Complete FTP response a few second later after I issue the GET, when I have the switch (and it works) and when its directly connected (and doesn't). Hence why I think the server thinks all is well and it’s sent the data, and the data is not being passed on by the hardware when directly connected. Is this actually possible?

So I think the PHY/MAC is getting the data, but not passing it onto the uC.

Problem is it can stick monitor the comms as I need to add a switch to do this, and then it works!!

Here is my 'printf' debug output.

I can attach the lwip debug output too, but basically nothing happens on the data connection (remember I'm not even detting interrupts when my code is waiting on the data port).

008453 --------- Getting file countlog

008456 Sending FTP cmd: PORT 192,168,1,40,195,81

008460 Waiting Cmd response

008477 Incomming Cmd Resp(s): 200 ok

008480 Sending FTP cmd RETR countlog

008483 Waiting Cmd response

008495 Incomming Cmd Resp(s): 150 Transferring data..

008500 Waiting Cmd response

008508 Accepted Data Rx connection (port 50001)

[with a switch , I get the data arriving here..., but without one my code/logic generates the following timeout ]

018502 RETR WaitResponse() timeout

018505 Force data termination (newDataConn) netconn_delete()

018510 FTP Error 0x117 RETR WaitResponse() timeout. Inner 0

020501 Incomming Cmd Resp(s): 226 Transfer Complete

186581 Incomming Cmd Resp(s): 221 Bye



Hello @MS.9  @Piranha 

I am trying to implement basic ethernet data transfer on stm32f746 discovery board. My project consists of FreeRTOS CMSIS V1, touchGFX and LWIP, I am using stm32CubeIDE : 1.15.1 along with CubeMX 6.11.1.

I am trying to configure the ethernet functionality and am now able to ping the configured static IP Address.
Please guide me accordingly as to how should be the flow of data and also could you please point me to some material that could help me go ahead in the right direction.

Thankyou for your time and consideration