Data Sheet
© Copyright 2013 WIZnet Co.,Ltd. All rights reserved.
50
iEthernet
W5200
/* update destination_ptr */
dst_address += upper_size;
/* copy left_size bytes of gSn_RX_BASE to destination_address */
left_size = len – upper_size;
memcpy(gSn_RX_BASE, dst_address, left_size);
}
else
{
copy len bytes of source_ptr to destination_address */
memcpy(src_ptr, dst_ptr, len);
}
/* increase Sn_RX_RD as length of len */
Sn_RX_RD += len;
/* set RECV command */
Sn_CR = RECV;
}
ESTABLISHMENT: Check send data / Send process
The size of the transmit data cannot be larger than assigned internal TX memory of
Socket n . If the size of transmit data is larger than configured MSS, it is divided by
size of MSS and transmits. To transmit the next data, user must check the completion
of prior SEND command. An error may occur if the SEND command executes before
completion of prior SEND command. The larger the data size, the more time to
complete the SEND command. So the user should properly divide the data to transmit.
To check the completion of the SEND command, it should be check that the send data
length is equal with the actual sent data length. The actual sent data length is
calculated by the difference of the Sn_TX_RD before and after performing the SEND
command. If the actual sent data is less than the send data length, the SEND command
is retried for sending the left data. The send process is therefore completed the
SENDwhen the sum of the actual sent data is equal the send data length. A simple
example of the send process is as below
Ex) Send Data Length Size= 10,
1) Execute SEND Command with send data length
2) Calculate the actual sent data length
If the actual sent data length is 7 (= Sn_TX_RD_after_SEND-Sn_TX_RD_befor_SEND),
the left Data length= 3
3) Retry SEND Command until the sum of the actual sent data length is same the
send data length.
Note: Don’t copy data until the sum of the actual sent data length is the send data length.