---
title: "Clarification of overflow spec. of read/write flags of input buffer."
url: "https://maker.wiznet.io/forum/15895"
markdown_url: "https://maker.wiznet.io/forum/15895/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "friedrichluna"
created: "2025-09-30T00:04:58+09:00"
last_activity: "2025-10-01T09:02:58+09:00"
language: "en"
tags: ["C/C++", "W5500"]
views: 5
replies: 1
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# Clarification of overflow spec. of read/write flags of input buffer.

## Question

Asked by friedrichluna on 2025-09-30 in Ethernet Chips.

In the reference spec of the W5500 there are several similar notes, stating that the value of a pointer register can overflow. This concerns pointers and sizes for the per socket read- and write-buffers. For example for Sn_RX_RD :

```plaintext
If the increased value exceeds the maximum value 0xFFFF, (greater than 0x10000 and the carry bit occurs), this carry bit is ignored and will automatically update with the lower 16bits value.
```

But the maximum configurable buffer size in Sn_RXBUF_SIZE is 16kB. 0xFFFF == 65535 > 16kB

Thus, I don't understand how and when this overflow can actually occur. I also wonder how overflowed values are meant to be interpreted.

## Replies

### Reply 1 by Lihan__, 2025-10-01

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 as `pointer % 0x1000`, with 8KB as `pointer % 0x2000`, and with 16KB as `pointer % 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.

---

Source: https://maker.wiznet.io/forum/15895
