I'm developing my own TCP stack for ATMEGA32 and I'm having a problem with calculating the TCP checksum. According to the information I gathered from the internet, the TCP checksum is calculated based on the IP pseudoheader (that is source IP, destination IP, protocol (0x06 for TCP) and overall packet length) and complete TCP header together with data to be sent. The checksum is one's complement of sum of all 16-bit words. I'm almost sure it is calculated correctly as it works ok for
the IP header. Do you have any suggestions on what can I be doing wrong? Do I have to convert all header data to network byte order before calculating the checksum (I'm doing it this way now)?
Thanks in advance