Specialist Supplier of Crystals & Frequency Control Componentssales@mecxtal.com.cn0755-26500570
MERLIN home / Rednote / System Validation and Replacement

W5500 with a 25 MHz KDS Crystal: Why Did an SPI Read Not Free the Receive Buffer?

Reading bytes over SPI is not the same as telling the W5500 they have been consumed. WIZnet requires the host to advance Sn_RX_RD by the bytes it actually read and then issue RECV to complete processing. Correct bytes on SPI or clearing a receive interrupt do not replace this step. On a board using a 25 MHz KDS crystal, first check the receive pointer and command if the initial data reads correctly but later traffic backs up.

Do not trim the logical pointer to the physical buffer size

In a controlled TCP example, start with Sn_RX_RD at 0xFFF0 and read 32 bytes. Adding 0x20 and discarding the carry above 16 bits gives 0x0010. Use the number of bytes actually consumed, not the advertised buffer capacity or the intended read size. The W5500 translates the logical offset into the assigned physical socket buffer. Setting the physical allocation to 2 KB does not make it correct to truncate every value written back to an 11-bit pointer.

Capture the read, writeback, command and following traffic

Send a known TCP sequence to cover ordinary reads, the logical boundary and the wrap. Save the captured data, the new pointer, the RECV transaction and evidence of subsequent arrivals. An omitted-RECV control can be useful on an isolated test board; start a fresh connection before the next comparison. If byte reads are correct and the backlog only follows the omitted update or command, fix the driver. If correctly committed reads still lose traffic, investigate capacity, application service rate and link behavior independently. One successful SPI read is not proof that the receive area was released.

Related selection guide: MERLIN Crystal Timing: Can a 12 pF crystal replace the 18 pF crystal on a 25 MHz W5500 board?

Resource link: https://www.mecxtal.com.cn/en/handbook/new-0785.html

WeChat

MERLIN · TIMING COMPONENTS

Scan with WeChat to contact Sales

Add our WeCom contacts from your usual WeChat app.

On desktop, scan with your phone. On mobile, save the QR image and select it from your album in WeChat Scan.