It seems chip is really sending part of data, and packet exchange is valid. I do not have any immediate idea, therefore we must continue to investigate. The fact that you use more sockets now and it improves, shows hat there’s some flaw in the program’s logic.
- You are using
disconnect()
from the library as shown here, right? Strange but I can not find code for this routine in the WIZnet github. Can you please display what value disconnect returns (it returns a byte) every time you access the W5500? Would you please put explicit socket close()
after everydisconnect()
; - you did not say if re-reading and comparison of the TX buffer contents is always successful;
- just before the
setSn_CR(sn,Sn_CR_SEND);
re-readptrtemp = getSn_TX_RD(sn);
and compare pointers to ensure that it is still the same valueif(ptr != ptrtemp) <display error>
. This is very low probability RD pointer has changed, but as we do not know what is going on it would be beneficial to check it just after data comparison and just before performing SEND.