If you would log direct value it would be big-endian. From your code I see there’re several move, AND and shift operations are applied. Log direct values read by
REGS[ sn ].RX_RSR.WORD and
REGS[ sn ].RX_RD.WORD. Does your implementation read byte at offset +0 first, and then byte at offset +1, or vice versa?
WAIT_ENDPROCESS() in the code.
Else condition for
if(0 < recLen) in
recv() is wrong - even if socket is closed at the time you read socket status, it does not mean that nothing was received into W5100 buffer after you last time checked for the RX_RSR being 0 and before status read. You must check for RSR being 0 once more, and flush remaining data of there’s any data.
What is the value of
W5100_RX_BUFF_SIZE? According to comment, must be 0x800.
- log register values just before they are being written or just after they are being read;
- check which order bytes in word read are being read;
recv in its else condition;
- perform dump of all registers as asked before, byte by byte.