Data Sheet
© Copyright 2013 WIZnet Co.,Ltd. All rights reserved.
40
iEthernet
W5200
the transmission data to the upper-bound, and change the physical address to the
gSn_TX_BASE. Next, write the rest of the transmission data.) After that, be sure to increase
the Sn_TX_WR value as much as the data size that indicates the size of writing data. Finally,
give SEND command to Sn_CR(Socket n Command Register).
Refer to the psedo code of the transmission part on TCP Server mode if detail is needed.
Sn_RX_RSR (SOCKET n Received Size Register) [R] [0x4026+0x0n00-0x4027+0x0n00]
[0x0000]
It informs the user of the byte size of the received data in Internal RX Memory of Socket n . As
this value is internally calculated with the values of Sn_RX_RD and Sn_RX_WR, it is
automatically changed by RECV command of Socket n Command Register (Sn_CR) and
receives data from the remote peer. When reading this register, user should read upper
byte(0x4026, 0x4126, 0x4226, 0x4326, 0x4426, 0x4526, 0x4626, 0x4726) first, and lower
byte(0x4027, 0x4127, 0x4227, 0x4327, 0x4427, 0x4527, 0x4627, 0x4727) later to get the
correct value.
Ex) In case of 2048(0x0800) in S0_RX_RSR,
0x4026 0x04027
0x08 0x00
The total size of this value can be decided according to the value of RX Memory Size Register.
Sn_RX_RD (Socket n RX Read Pointer Register) [R/W] [0x4028+0x0n00-0x4028+0x0n00]
[0x0000]
This register offers the location information to read the receiving data. When reading this
register, user should read upper byte (0x4028, 0x4128, 0x4228, 0x4328, 0x4428, 0x4528,
0x4628, 0x4728) first, and lower byte (0x4029, 0x4129, 0x4229, 0x4329, 0x4429, 0x4529,
0x4629, 0x4729) later to get the correct value. It has a random value as its initial value.
Caution: This register value is changed after the SEND command is successfully executed to
Sn_CR.
Ex) In case of 2048(0x0800) in S0_RX_RD,
0x4028 0x4029
0x08 0x00
But this value itself is not the physical address to read. So, the physical address should be
calculated as follow.
1. Socket n RX Base Address (hereafter we'll call gSn_RX_BASE) and Socket n RX Mask
Address (hereafter we'll call gSn_RX_MASK) are calculated on RMSR value. Refer to
the pseudo code of the 5.1 Initialization if the detail is needed.
2. The bitwise-AND operation of two values, Sn_RX_RD and gSn_RX_MASK give result the
offset address(hereafter we'll call get_offset), in RX memory range of the socket.
3. Two values get_offset and gSn_RX_BASE are added together to give result the