I’m using a W5500 with an Atmel AVR XMega MCU. Going pretty well so far. I now want to write polled code to receive from a TCP socket - I don’t have the option to write interrupt driven code because I’m working inside a bootloader and trying to present a virtual serial port (serial data encapsulated in TCP) without making changes to the main bootloader code.
It is possible that the W5500 will receive more than one packet before I poll it. If this happens, I believe the Sn_RX_RSR register will contain the total amount of data received, so I will not be able to tell how many packets have been received - and I will not know how many times to issue a RECV command (Sn_CR = RECV). Is this correct?
This problem does not happen with UDP because received data also includes a header with the sender IP, socket and payload length, so individual packets can be identified. Can these headers be enabled for TCP reception?
Note that a similar question to mine is raised in this thread:
[url]TCP receive process - data length]
Any advice much appreciated.