Clarification of overflow spec. of read/write flags of input buffer.
Ethernet Chips
- C/C++
- W5500
No replies yet. Be the first to reply.
Join the discussion.
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Share projects and connect with makers.
Joined before the site update? first.
New to WIZnet Makers?
We sent a verification link to your address. Open it to activate your account, then log in.
Accounts from this email provider are reviewed by an administrator after verification. Approval usually takes one business day.
Already have an account?
Enter your email address. If it belongs to an account, we'll send a link to set a new password. Members who joined before the site update use this to set their password.
If an account uses that address, we sent a link to set a new password. The link works once and expires in 30 minutes.
Know your password?
Need an account?
RE: Clarification of overflow spec. of read/write flags of input buffer.
by Lihan__ WIZnet ·
The socket buffer pointers in the W5500 (such as Sn_RX_RD and Sn_TX_WR) are 16-bit registers. These registers are not tied directly to the physical buffer size (which is up to 16KB), but instead represent a logical address space ranging from 0x0000 to 0xFFFF (64KB).
The actual buffer size is configured by Sn_RXBUF_SIZE, and can be 2KB, 4KB, 8KB, or 16KB. Regardless of the buffer size, the pointer always increments within the 16-bit range and wraps back to 0x0000 after 0xFFFF.
Internally, the hardware maps the pointer into the real buffer by applying a modulo operation with the configured buffer size. For example, with 2KB the physical address is calculated as
pointer % 0x0800, with 4KB aspointer % 0x1000, with 8KB aspointer % 0x2000, and with 16KB aspointer % 0x4000.Therefore, the overflow mentioned in the datasheet does not mean the buffer is physically larger than 16KB. It simply describes the circular buffer mechanism where the 16-bit pointer naturally rolls over. For smaller buffer sizes, the higher bits of the pointer are ignored and only the lower bits are used to index the actual buffer.
As a developer, you can safely use the pointer values as provided; the W5500 ensures they always map correctly into the actual buffer space.