Unable to read from register Sn_RX_RD0

I send/receive UDP packets. But a lot of packets lost. So while debugging my program I found out that I read the wrong pointer.
So I do the test

//WRITE
ptr = 8; 
IINCHIP_WRITE(Sn_RX_RD0(s),(uint8)((ptr & 0xff00) >> 8));
IINCHIP_WRITE((Sn_RX_RD0(s) + 1),(uint8)(ptr & 0x00ff));
//READ
ptr = IINCHIP_READ(Sn_RX_RD0(s));
ptr = ((ptr & 0x00ff) << 8) + IINCHIP_READ(Sn_RX_RD0(s) + 1);
//at this point ptr = 0 !!!

So I write a predefined value to Sn_RX_RD0 and read it back and get a wrong value. At this poin i even don’t know if it’s written properly.

Unfortunately this is normal. You will not read new value until specific event.
I recommend you looking into W5100’s datasheet, chapter 5 “Functional description”.
For example, in 5.2.1.1 you will learn that after updating RX_RD register you should issue RECV command, which makes your register update effective. Until this command, RX_RD will read back the old value.
So conclusion is that you should be very careful reading registers, and should only do it in specific conditions. I am sure if you will study those datasheet’s diagrams you will be doing it right.