LWIP STM32H7 Raw TCP connection closes after receiving a few bytes

118 views Asked by At

I'm using STM32H7 on a custom board. Board is server TCP using RAW TCP LWIP. It's IP 192.168.3.1 and listens to port 31. Host PC has Hercules (IP 192.168.3.2). It's a client Gateway for both set to 192.168.3.0

I can connect Hercules to my board (using port 31)

However when I send any data (for example 10 bytes number 0 to 9) form host (Hercules) to board. Board receives the data and sends a request to close connection (I can read "Connection refused by remote host")

Wire Shark, shows a connection (SYN from 3.2 to 3.1), SYN ACK from (3.1 to 3.2) and finally ACK from 3.2 to 3.1. Connection stays on as long as I don't send any data. Then after I send data (Len 10) for 10 bytes. Hercules sends it with PSH and ACK (screen shot attached).

Immediately, after reception of data on board (function tcp_listen_input). This function checks the received flag, if it has ACK (which is the case), it does call tcp_rst which sends RST and ACK to Hercules and shuts the connection. Wire Shark snippet

I'm using LWIP 2.1.2 with CubeMX 6.6.1

I disabled NAGLE algorithm

what's wrong here? why my board (TCP server) shuts connection just after receiving data? why Hercules sends data with PSH and ACK?

any help is appreciated. Thanks

tried to change settings. tried different IP. Tried another TCP tool

0

There are 0 answers