Data Sheet
© Copyright 2013 WIZnet Co.,Ltd. All rights reserved. 
68
iEthernet 
W5200
SOCKET Initialization 
Select  the  SOCKET  and  set  the  SN_MR(P3:P0)  to  MACRAW  mode.  Then  execute  the 
‘OPEN’ command. After the ‘OPEN’ command, if the Sn_SR is successfully changed to 
‘SOCK_MACRAW’,  the  SOCKET  initialization  is  completed.  Since  all  information  about 
communication  (Source  hardware  address,  Source  IP  address,  Source  port  number, 
Destination  hardware  address,  Destination  IP  address,  Destination  port  number, 
Protocol header, etc.) is in the ‘MACRAW data’, there is no more register setting. 
{ 
START: 
/* sets MAC raw mode */ 
S0_MR = 0x04; 
/* sets OPEN command */ 
S0_CR = OPEN; 
/* wait until Sn_SR is changed to SOCK_MACRAW */ 
if (Sn_SR != SOCK_MACRAW) S0_CR = CLOSE; goto START; 
} 
Check received data 
Refer to the “5.2.2.1 Unicast & Broadcast.” 
Receiving process 
Process the MACRAW data of the SOCKET which received it in internal RX memory.   
The structure of the MACRAW data is as below: 
Figure 17    The received MACRAW data Format 
The  MACRAW  data  consists  of  ‘PACKET-INFO,’  ‘DATA  packet’  and  4bytes  CRC.  The 
‘PACKET-INFO’  is  the  length  of  the  DATA  packet.  The  ‘DATA  packet’  consists  of  6bytes 
‘Destination MAC address,’ 6bytes ‘Source MAC address’ and 2bytes ‘Type,’ 46~1500 bytes 
‘Payload.’  The  ‘Payload’  of  DATA  packet  consists  of  Internet  protocol  such  as  ARP,  IP 
according to the ‘Type.’ The details of ‘Type’ please refer to the web:   
(
U
http://www.iana.org/assignments/ethernet-numbers
U
) 
{ 
/* calculate offset address */ 
src_mask = Sn_RX_RD & gSn_RX_MASK;        // src_mask is offset address 
/* calculate start address(physical address) */ 










