cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Discovery TCP problem

vanvinh1502
Associate
Posted on March 02, 2015 at 11:20

Hello, 

I am trying to implmenet TCP server on my STM32F4 Dis which connects to a client computer via Ethernet. The Client computer keeps sending connection request and data to the server and receives the data from the server. It is 1 client- 1 server model. Everything works just fine but then, when I unpluged the power suplply for STM32F4 Dis board for > 20 secs and pluged it back, the TCP connection breaks. ( no data received, cannot ping). I tried to unplug/replug the ethernet cable, reboot the client computer, still not working. However, if I unplug then plug back the STM power supply in <5sec, the TCP connection restores ( if I plug back after > 10sec, it does not work). After so many testing, I know that if I unplug then replug the STM power after >10 sec, the TCP connection breaks. The only way to restore is to unplug then replug STM power in <5sec. May I know any reason causing this happen and what is the solution for that?

Thank you.
3 REPLIES 3
AvaTar
Lead
Posted on March 02, 2015 at 12:28

I would suggest to use wireshark for tracing your network traffic.

Perhaps your client PC is choking on interrupted sessions, but that's impossible to tell from a ''work/don't work'' statement.

Remove as much ''side traffic'' as possible, ideally have just your server and your client on the network.

But be warned, this might involve longer hours of network-RFC reading sessions.

vanvinh1502
Associate
Posted on March 04, 2015 at 09:00

I used WireShark on my computer to trace the network and found something:

1. My STM board and my computer have to connect through a switch. If I connect them directly ( STM board to computer), the issue has gone. However, because of the design, I have to stick with the switch.

2. If i connect STM board with Computer via a switch, using Wireshark to trace the network traffic, if I unplug for around <5sec and then plug back, the STM board broadcasts Gratuitous ARP, which then makes the connection restore and everything works. However, if I unplug for around >7s and then plug back, there is no gratuitous ARP parkage sent by STM boards and the problem happens again.

(I have attach 2 photos for wireshark screenshot. the one with gratuitous arp is ok, the one without does not work.)

Could you give me some advice?

Thank you.

________________

Attachments :

plug_less_3sec.JPG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzoH&d=%2Fa%2F0X0000000bPw%2FGbueHfSHDMhuilimxbepSYYZIAWqBnD9ZAqkYoyY7pc&asPdf=false

plug_more_7s.JPG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hzo7&d=%2Fa%2F0X0000000bPv%2F5PTLysiDF4ihH3yXnKDB5Pp1YYmcTFRUFUmdV5Eac0c&asPdf=false
AvaTar
Lead
Posted on March 04, 2015 at 14:02

Could you give me some advice?

 

I'm not a networking expert, so I can't really point you directly to the issue.

However, it seems ARP requests are not really ''gratuitous''.

Not sure what makes the difference between a '<5-seconds-off' and a '<7-seconds-off'. Perhaps large caps in the power supply, and a warm boot vs. cold boot.

A look at the source code of your network stack and instrumentation of the same might help.

If the problem turns out to be not (STM32 -) hardware-specific, an Ethernet and TCP/IP related forum might be the best place to ask.