WIZnet Developer Forum

W5100s Socket WrapAround

I only have one socket opened. The RMSR is initialized to 0x55.
However, when I wrote 1950 bytes, then 100 bytes.
I expected this to cause a wrap around. However, I see the Rx write pointer is at 0x802 (2002d).

Is this expected behavior?
Thanks.
Giri

RX_RD is rather 16-bit counter than pointer. You get pointer to the data according to the datasheet by masking with buffer size and adding buffer base address. Thus counter us 0x802, buffer size is 0x800 then relative data location in the buffer is 0x002.

That doesn’t make sense.

If each Socket Receive pointers do a wrap around, then when I get data > RX Buffer size it should start back at the start of buffer.

What you define is NOT wrap around, if the counter continues to increment PAST the buffer size.

The RX_RD has to be a 16-bit pointer as the buffer/socket would be > 256bytes.

So a Wrap around definition to me is (ignoring the base offset), then the buffer (of 2KB will go from 0000 to x0800. Then when I get the next byte the RX_RD has
to have a value of 0x001 (and not 0x0801).

If not, the SN0 Rx data would be overwriting the data in Sn1 Rx buffer.

Giri

What exactly does not make sense?

This is true. And you can not get more data than RX buffer size. By definition. Extra data will wait at another end (TCP) or will be discarded (UDP/RAW).

I did not say these words - “wrap around”, and did not define this term. It seems you want to see wraparound here.

It is.

You can see definition of wraparound here:

Wraparound , wrap around , or wrap-around is anything that wraps around something.

Did you read the datasheet, sepecially chapter 4? It clearly says how to use RX_RD register, and how to obtain address to the data from it.

It will if you do not follow datasheet guidelines and do not mask the RX_RD value with the RX buffer size.

You are right. I wanted the Rx_Rd to behave a certain way, and didn’t fully understand the datasheet.
I apologize for my response.
Giri

No problem. There’re some uncertainties even in datasheets, thus if you have questions come here and ask.

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.