My problem is losing Data over my TCP Data transfer.
I've built a homemade AVR based web-server (or at least trying to).
I'm able to communicate with the client PC (my PC), and I'm able to send a few HTML lines (total data <100 bytes), no problem there.
But when I want to sent my basic home page (~1KB), I'm only getting in WireShark 181bytes of data.
I suspect the problem lies in the construction of the TCP.
data below are in hex format
From client(my PC):
sequence number: de db c7 b1
ack number: 00 0a 00 0b
From server(AVR):
sequence number: 00 0a 00 0b
ack number: de b6 c9 18
Total TCP Length: 935byte, IP and TCP header 20-20 byte
What settings did I set wrong?
Problem Solved!
ENC28J60_CS();
ENC28J60_CMD(WCR,ETXNDL);
SPIWR(package_length);
SPIWR(16+(package_length>>8));
ENC28J60_DS();
package_length is a integer, so is the ETXNDL(register). Until now the second SPIWR() function sent only the value 16: SPIWR(16); So the problem was, I never added the high-byte of the package_length to the 16, so the chip always sended 1-255 byte long packages.
why 16? RX buffer starts at 0x0000, and ends at 0x0fff. TX buffer starts at 0x1000, and ends at 0x1fff.