Sn_RX_FIFOR problem

W5300 configured as TCP server
When the W5300 receive more of 16383 byte the S0_RX_FIFOR refer to TX memory space:
Why the S0_RX_FIFOR is not automatically reset?
Is possible reset the S0_RX_FIFOR manually?
This is the receive code:

u32 lanRecv(u8 *buf, u32 len)
u16 pack_size=0;

lanReadBuf(buf, (u32)len);
return len;

lanReadBuf((u8 *)&pack_size,2); // extract the PACKET-INFO(DATA packet length)
if( LAN_MR_REG & MR_FS )
pack_size = ((((pack_size << 8 ) & 0xFF00)) | ((pack_size >> 8)& 0x00FF));

lanReadBuf(buf, (u32)pack_size); // copy data
setS0_CR(S0_CR_RECV); // recv

return (u32)pack_size;

u32 lanReadBuf(u8 *buf, u32 len)
u32 idx;
for (idx = 0; idx < len; idx+=2)
*((u16 *)(buf+idx)) = LAN_SCKT_RX_FIFO_REG;
return len;

Best Regards

I am sorry that W5300’s Sn_RX_FIFOR can not support flush the data in Sn_RX_MEMORY.
For flushing the received data in Sn_RX_MEMORY, You should be read Sn_RX_FIFOR as the received size and be ignored it.

Thank you.

I have set the RMS01R=0x4000 (64KB), the TMSR=0x4000 (64KB) and the MTYPER=0x00FF, is it correct?

As I told you before I have set the Socket 0 RX memory size register to 64KB but after 16KB the S0_RX_FIFOR return the first TX data sent. It seems that MTYPER is not correctly configured, but it is set with the first 8 blocks as TX memory (88KB=64KB)and the last 8 blocks as RX memory (88KB=64KB).

What is the mistake?

Sorry, i didn’t understand your question.

Do you want to use S0 socket TX and RX memory with 64KB size? am I right?

For 64KB socket, when your system is 16bit and big-endian.

RMS01R = 0x4000;
RMS23R = 0x0000;
RMS45R = 0x0000;
RMS67R = 0x0000;

TMS01R = 0x4000;
TMS23R = 0x0000;
TMS45R = 0x0000;
TMS67R = 0x0000;

MTYPER = 0x00FF;

If you used in little-endian system. the value shoud be swap MSB & LSB.

Thank you.

Yes, I want to use only one socket(S0) with 64KB Tx and RX memory length…
Maybe the problem is that I have set only the RMS01R?

Ok, that was the problem.
Thanks a lot.

Best Regards.

I am glad to solve your problem, too.
Thank you.