Hi to everyone. I hope that you can help me with this “issue”. I am new to the world of c and micro controllers.
I am working with:
W5200 and Atmega328p
W5500 and Atmega328p
This is the scenario:
I am using netcat on my windows computer so I can try with W5500 a TCP connection.
I am using the ioLibrary provided by Wiznet.
I am able to establish a connection with the W5200 with out any issues but when I try the same with the w5500 for some reason it drops the connection.
Everything seems that is working, I can establish the connection but after some X sec it drops the connection. To handle the connection I am checking the Sn_SR.
What I found is that after the connection is established( 0x17 according to the datasheet) for some reason, some times when I read this register it gives me numbers that do not exist on the data sheet, for example: 0x80, 0xc9,0xe4, 0x00(this is = to SOCK_CLOSED).
The numbers 0x80, 0x1e I do not worry about but when I read 0x00 then I think that the socket was closed for some reason so I reinitialize it and I try to connect to the server again but the server thinks that is still connected because the connection was actually never dropped.
This is how I found out about those numbers:
uint8_t status = getSn_SR(tcp_socket);
if( status != 0x17 ) printf(“why I get this!!!? 0x%x\r\n”,status );
***If I do not check for the 0x17 I will never read the other values because the 0x17 is the number it normally appears and I am checking this value as fast as I can.
*** this is a basic example but I get hundreds of 0x17: 0x17,0x17,0x17,0x00,0x17,0x17,0x17,0x80,0x17,0x17
Maybe this is not even related but is what it makes sense to me.
Also I base my code on the loopback.c and .h files that are in the ioLibrary.