W5500 Receive Buffer

Dear, tell me about working with the module. I’m doing something wrong, but what’s the problem?
In the W5500 I use only zero socket (I work with AVR).
All exchange with the module occurs at a fixed length in single-byte mode (Fixed Lenght Data Mode)
When initializing, I configure the module as a server:
in steps:

  1. I reset the module, wait 2 seconds after reset
  2. Even though the module itself breaks 16kB into 8 buffers, I specify all the same that the receive buffer and the Socket transfer buffer 0 = 2kB
  3. I assign the module MAC, IP, Gateway, Mask, and install the local port
  4. Socket 0 install TCP protocol
  5. I set an interrupt from Socket 0 for all socket events. (connection, break, timeout, data arrival, data sending)
  6. Socket commands - I open a socket (open) and then immediately translate the command to LISTEN
  7. the module is pinged, the connection to the port is, the interruption is generated by the connection and the connection is broken. When the interrupt arrives, I tell the module that I responded (the SIR register)
  8. From the client came the data: I read the register of the size of the received data (S0_RSR) first the high byte, then the low one. (in old W3300 modules this is important)
  9. I read the register of the beginning of the data in the buffer (S0_RX_RD), first the high byte and then the low byte.
  10. I read the end-of-data register in the buffer (S0_RX_WR), first the high byte and then the low byte.
  11. I transfer data from the W5500 receive buffer to the local AVR buffer.
  12. In the register S0_RX_RD I write the value S0_RX_WR. first low byte then high byte. I give the command to the module that I read everything (in the register S0_CR <- 0x40)

Everything works until the port while the register S0_RX_RD has values ​​less than 0x0800.
let’s say S0_RX_RD = 0x07F0, and S0_RX_WR = 0x0840.
as soon as I assign a S0_RX_RD value above 0x0800 (0x0840 in our example) everything is fucking hanging …
in theory, these registers run in the range from 0x0000 to 0xFFFF and in a circle. and then he stared at 0x0800 and at least kill …
increased the buffer to 4kb, all one …> 0x0800 hung …
Tell me pliz … what am I doing wrong :frowning:

I believe that while the internal S0_RX_RD and S0_RX_WR pointers wrap around as the W5500 stores data it receives, you are responsible for sending a valid pointer when you read incoming data.

Try logically ANDing your read pointer in your code with 0x7FF before reading and see if that helps.

Thank you very much for responding! I try but for now all the same: (

char WSOCKET0_Read(unsigned int adres){
char result,l,h;
SPI1_Write(h); // адрес в регистре
return result;
void WSOCKET0_Write(unsigned int adres, char dat){
char result,l,h;

sdata=word(b,c); //START DATA
ssdata=sdata & 0x07FF;
edata=word(b,c); //END DATA

Read the W5100 datasheet chapter 5. It gives crystal clear information on how to manage socket and its registers for proper data flow. Register locations and access type may be different for the devices, but the flow is the same.