iethernet w5200 datasheet v1.2.1 en - jameco electronicsegrated ethe p, igmp, and 200 uses a 200,...
TRANSCRIPT
© Co
opyright 201
i
11WIZnet Co
iEth
o., Inc. All rig
hern
DatVer
ghts reserve
net
tashrsion 1.
ed.
W5
heet.2.1
http
200
t
p://www.w
0
wiznet.co.
1
kr
iEthernet W
5200
© Co
WThe
con
use
TC
The
int
AR
W5
W5
pro
SPI
The
80M
on
pac
Fe-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
opyright 201
W5200 e W5200 chip
nnection for e
ers who need
P/IP Stack, 1
e W5200 is
egrated Ethe
P, IGMP, and
5200 uses a
5200, users c
ogram instea
(Serial Peri
e W5200 SP
MHz.In order
LAN) and po
cket, which
eaturesSupport Ha
Supports 8
Very small
Support Po
Support Wa
Support Hig
Internal 32
10BaseT/10
Support Au
Support Au
Support AD
mode)
Not suppor
3.3V opera
Lead-Free
Multi-funct
11WIZnet Co
is a Hardwire
embedded syst
d Internet co
10/100 Ethe
s composed
ernet MAC &
d PPPoE, wh
32Kbytes i
can impleme
ad of handlin
ipheral Inter
I supports a
r to reduce
ower down m
is the Raw E
s ardwired TCP
independen
48 Pin QFN P
wer down m
ake on LAN
gh Speed Ser
2Kbytes Mem
00BaseTX Et
to Negotiati
to MDI/MDIX
DSL connectio
rt IP Fragmen
ation with 5V
Package
tion LED outp
o., Inc. All rig
ed TCP/IP em
tems using SP
onnectivity f
rnet MAC an
of a fully
& PHY. Hard
hich has bee
nternal buff
ent the Ether
ng a complex
rface) is pro
a high speed
power consu
mode. To wak
Ethernet pac
P/IP Protocol
t sockets sim
Package
mode
rial Peripher
ory for Tx/R
hernet PHY e
on (Full and
X
on (with sup
ntation
V I/O signal t
puts (Full/Ha
ghts reserve
mbedded Ethe
PI (Serial Peri
for applicatio
d PHY.
hardwired
dwired TCP/
en proven in
fer as its d
rnet applicat
x Ethernet Co
ovided for ea
d SPI capabl
umption of t
ke up during
ket.
ls : TCP, UDP
multaneously
ral Interface
Rx Buffers
embedded
half duplex
pport PPPoE
tolerance
alf duplex, L
ed.
rnet controlle
ipheral Inter
on that uses
market-pro
/IP stack sup
n various ap
ata commun
tion they ne
ontroller.
asy integrati
e of commu
the system, W
g WOL, W520
P, ICMP, IPv4
y
(SPI MODE 0,
, 10 and 100
Protocol wit
Link, Speed)
er that enable
rface). W520
a single chi
ven TCP/IP
pports TCP, U
pplications f
nication me
ed by using
ion with the
unicating ove
W5200 provi
00 should be
ARP, IGMP, P
, 3)
0-based )
th PAP/CHAP
es easier inte
00 suits best
ip to implem
P stack and
UDP, IPv4, IC
for many ye
emory. By us
a simple soc
e external M
er SPI at up
ides WOL (W
received ma
PPPoE, Ether
P Authenticat
2
rnet
t for
ment
an
CMP,
ars.
sing
cket
MCU.
p to
Wake
agic
net
tion
iEthernet W
5200
© Co
TaThe
-
-
-
-
-
-
-
-
-
opyright 201
arget Ae W5200 is w
Home Netw
Serial-to-Et
Parallel-to-
USB-to-Eth
GPIO-to-Et
Security Sy
Factory and
Medical Mo
Embedded
11WIZnet Co
pplicatwell suited fo
work Devices
thernet: Acc
-Ethernet: P
ernet: Stora
hernet: Hom
ystems: DVRs
d Building Au
onitoring Equ
Servers
o., Inc. All rig
tions or many emb
s: Set-Top Bo
cess Controls
OS / Mini Pri
age Devices,
me Network S
s, Network C
utomations
uipments
ghts reserve
bedded appli
oxes, PVRs, D
s, LED display
inters, Copie
Network Pri
Sensors
Cameras, Kio
ed.
ications, inc
Digital Media
ys, Wireless
ers
nters
sks
luding:
a Adapters
AP relays, eetc.
3
iEthernet W
5200
© Co
Bl
opyright 201
lock Dia
W5
11WIZnet Co
agram
5200
Hard
P
o., Inc. All rig
Tr
S
T
Et
dwired TC
PPPoE
802
TC
ghts reserve
MCU
RJ45
ransform
PI Interfa
Tx/Rx Buf
thernet P
CP/IP Cor
.3 Ehtern
ARP
P
ed.
er
ace
ffer
PHY
re
net MAC
I
UDP
P
4
iEthernet W
5200
© Co
Ta1 P
1
1
1
1
1
1
2 M
3 W
3
3
4 R
4
4
5 F
5
5
6 E
6
6
6
7 E
7
7
7
7
opyright 201
able ofPin Assignme
MC1.1
1.21.2
Mis1.3
Pow1.4
Clo1.5
LED1.6
Memory Map
W5200 Regis
com3.1
Soc3.2
Register Des
Com4.1
Soc4.2
Functional D
Init5.1
Dat5.2
5.2.1
5.2.
5.2.
5.2.2
5.2.
5.2.
5.2.3
5.2.4
External Inte
SPI6.1
Dev6.2
Pro6.3
Electrical Sp
Abs7.1
DC 7.2
PO7.3
AC 7.4
7.4.1
7.4.2
7.4.3
11WIZnet Co
f Content ...........
CU Interface
2 PHY Signals
scellaneous S
wer Supply S
ock Signals ..
D Signals ....
p ..............
sters ..........
mmon regist
cket register
criptions ....
mmon Regist
cket Register
Descriptions .
tialization ..
ta Communic
TCP .......
.1.1 TCP S
.1.2 TCP C
UDP .......
.2.1 Unica
.2.2 Multic
IPRAW ....
MACRAW ..
erface .......
(Serial Perip
vice Operati
ocess of usin
pecifications
solute Maxim
Characteris
WER DISSIPAT
Characteris
Reset Timi
Crystal Ch
SPI Timing
o., Inc. All rig
ents ...............
Signals ......
s ..............
Signals .......
Signals .......
...............
...............
...............
...............
ers ...........
rs .............
...............
ters ..........
rs .............
...............
...............
cations ......
...............
SERVER .......
CLIENT .......
...............
ast and Broad
cast ..........
...............
...............
...............
pheral Interf
ons ...........
g general SP
...............
mum Ratings
tics ..........
ATION(Vcc 3.3
tics...........
ing ...........
aracteristics
g ..............
ghts reserve
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
dcast ........
...............
...............
...............
...............
face) mode .
...............
PI Master dev
...............
..............
...............
3V Temperat
...............
...............
s .............
...............
ed.
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
vice ..........
...............
...............
...............
ture 25°C) ..
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
5
..... 8
..... 8
..... 9
.... 10
.... 10
.... 12
.... 12
.... 13
.... 14
.... 14
.... 15
.... 16
.... 16
.... 23
.... 41
.... 41
.... 44
.... 44
.... 45
.... 52
.... 53
.... 53
.... 60
.... 63
.... 65
.... 71
.... 71
.... 71
.... 72
.... 77
.... 77
.... 77
.... 77
.... 78
.... 78
.... 78
.... 79
iEthernet W
5200
© Co
8 I
9 P
Docu
opyright 201
7.4.4
IR Reflow Te
Package Des
ment History
11WIZnet Co
Transform
mperature P
criptions ....
y Informatio
o., Inc. All rig
er Character
Profile (Lead
...............
n .............
ghts reserve
ristics .......
-Free) .......
...............
...............
ed.
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
6
.... 80
.... 81
.... 82
.... 84
iEthernet W
5200
© Co
F
F
F
F
F
F
F
F
F
F
F
F
F
F
F
F
F
F
F
F
F
F
F
F
F
F
opyright 201
TableFigure 1 Pin
Figure 2 Pow
Figure 3 Crys
Figure 4 INTL
Figure 5 Sock
Figure 6 Phys
Figure 7 Allo
Figure 8 TCP
Figure 9 TCP
Figure 10 TC
Figure 11 UD
Figure 12 The
Figure 13 IPR
Figure 14 The
Figure 15 MA
Figure 16 T
Figure 17 SPI
Figure 18 W5
Figure 19 Add
Figure 20 REA
Figure 21 Wr
Figure 22 Res
Figure 23 SPI
Figure 24 Tra
Figure 25 IR
Figure 26 Pac
11WIZnet Co
e of FigDescription W
wer Design ...
stal Referenc
LEVEL Timing
ket Status Tr
sical Address
cation Intern
SERVER and
SERVER Ope
P CLIENT Op
DP Operation
e Received U
RAW Operatio
e receive IPR
ACRAW Opera
The received
I Interface ..
5200 SPI Fram
dress and OP
AD Sequence
rite Sequence
set Timing ..
I Timing .....
ansformer Ty
Reflow Temp
ckage Dimen
o., Inc. All rig
gure
W5200 .......
...............
ce Schematic
g ..............
ransition .....
s Calculation
nal TX/RX m
d TCP CLIENT
eration Flow
peration Flow
Flow ........
UDP data For
on Flow ......
RAW data Fo
ation Flow ...
MACRAW da
...............
me Format ..
P/DATA Lengt
e ..............
e ..............
...............
...............
ype ............
perature .....
nsions ........
ghts reserve
...............
...............
c .............
...............
...............
n ..............
emory of So
T ..............
..............
w .............
...............
rmat .........
...............
ormat ........
...............
ata Format ..
...............
...............
th Sequence
...............
...............
...............
...............
...............
...............
...............
ed.
...............
...............
...............
...............
...............
...............
cket n-th ...
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
e Diagram ...
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
...............
7
..... 8
.... 11
.... 12
.... 20
.... 31
.... 37
.... 43
.... 44
.... 45
.... 52
.... 53
.... 55
.... 63
.... 64
.... 65
.... 66
.... 71
.... 72
.... 72
.... 73
.... 75
.... 78
.... 79
.... 80
.... 81
.... 82
iEthernet W
5200
© Co
1
1.Sy
n
n
n
opyright 201
Pin As
MCU I1ymbol Ty
nRST
nSCS
nINT
11WIZnet Co
ssignme
InterfaceType Pin
I 46
I 41
O 40
o., Inc. All rig
ent
Figure 1 P
e SignalsNo Descr
6 RESET
This
W520
RESET
wait
PLL l
Elect
1 SPI SL
This p
SPI in
0 INTER
This
after
ghts reserve
Pin Descripti
s ription
T ( Active LO
pin is active
00.
T should be
for at least
logic to be
trical Specifi
LAVE SELECT
pin is used t
nterface.
RRUPT (Activ
pin indicate
r socket con
ed.
ion W5200
OW )
e Low input
held at lea
150ms after
stable. Ref
cation”
T ( Active LOW
to SPI Slave
ve LOW )
es that W52
nnecting, dis
to initialize
st 2us after
r high de-ass
fer to RESE
W )
Select signa
200 requires
sconnecting,
e or re-initia
low assert,
sert in orde
ET timing o
al Pin when u
s MCU atten
, data recei
8
alize
and
r for
f “7
using
ntion
iving
iEthernet W
5200
© Co
S
M
M
P
1.S
opyright 201
SCLK
MOSI
MISO
PWDN
1.2 PH2Symbol
RXIP
RXIN
TXOP
TXON
BIAS
ANE
DUP
11WIZnet Co
I 42
I 43
O 44
I 45
HY SignaType
I
I
O
O
O
I
I
o., Inc. All rig
timeo
clear
n-th I
pin is
2 SPI C
This
interf
3 SPI M
This
interf
4 SPI M
This p
5 POWE
This p
Low :
High
als Pin No De
20 RX
Th
th21
17 TX
Th
th18
12 BI
Co
Re
29 Au
Th
Mo
Lo
Hi
30 Fu
Th
Lo
Hi
Th
ghts reserve
out, and W
red by writin
Interrupt Re
s active low.
LOCK
pin is used
face.
MASTER OUT
pin is used
face.
MASTER IN SL
pin is used to
ER DOWN ( A
pin is used to
: Normal Mod
: Power Dow
escription
XIP/RXIN Sig
he different
he RXIP/RXIN
XOP/TXON Si
he different
he TXOP/TXIN
AS Register
onnect a resi
efer to the “
uto Negotiat
his pin sele
ode.
ow :Auto Neg
igh : Auto Ne
ull Duplex Mo
his pin select
ow = Half Du
igh = Full Du
his function
ed.
WOL (Wake
ng IR(Interrup
gister). All in
to SPI Cloc
SLAVE IN
to SPI MOS
AVE OUT
o SPI MISO si
Active HIGH )
o power dow
de Enable
wn Mode Ena
nal Pair
ial data fro
N signal pair.
ignal Pair
ial data is t
N signal pair
istor of 28.7
Reference sc
ion Mode En
cts Enable/
gotiation Mo
egotiation Mo
ode Enable
ts Enable/Di
plex Mode E
plex Mode E
activates on
on LAN). T
pt Register)
nterrupts are
k signal Pin
I signal pin
ignal pin.
)
wn pin.
ble
m the medi
transmitted
r.
㏀±1% to the
chematic”.
able
Disable of
de Disable
ode Enable
sable of Full
nable
nable
ly during res
The interrup
or Sn_IR (So
e maskable.
when using
when using
ia is receive
to the med
e ground.
Auto Negot
l Duplex Mod
set period.
9
pt is
ocket
This
g SPI
g SPI
ed on
dia on
iation
de.
iEthernet W
5200
© Co
1.
nF
nS
nL
1.Sym
VCC
VCC
VCC
GND
GND
1V8O
opyright 201
SPD
Misce3Symbol
FDXLED/M2
SPDLED/M1
LINKLED/M0
M3
RSV
Notes: Pull
Power4mbol Ty
C3V3A Po
C3V3 Po
C1V8 Po
DA G
D G
O O
11WIZnet Co
I
llaneousType
I
I
- 7
l-Up/Down re
r Supply ype Pin
ower
ower
ower
round 1
round
o., Inc. All rig
31 Sp
Th
Lo
Hi
Th
s Signals Pin No
3,
4,
5
6
7,32,33,34,3
37,38,39
egister = 40K
Signals n No
11, 15, 23
27, 47
8, 25
3, 19, 22, 24
9, 10, 26,
28, 48
14
ghts reserve
peed Mode
his pin select
ow = 10M Spe
igh = 100M S
his function
Desc
W52
Norm
Othe
This
perio
This
5,36,
9
Rese
The
The
shou
KΩ to 100KΩ
Descript
3.3V po
3.3V po
1.8V po
4 Analog g
Digital g
1.8V reg
1.8V/20
regulato
( VCC1V
Be sure
1V8O
compen
capacito
Notice:
operati
power o
ed.
ts 100M/10M
eed Mode
peed Mode
activates on
cription
00 MODE SEL
mal mode :
er test mode
function a
od
pin should b
erved Pin
pin number
reserved pi
uld be pull-do
Ω. Typical va
tion
ower supply f
ower supply f
ower supply f
ground
ground
gulator outp
00mA power
or, is used
V8).
e to connect
and GND
nsation, and
or for high
1V8O is t
on. It shou
of other dev
M Speed Mode
ly during res
LECT
111
s are interna
activates on
be pull-up.
7 should be
ns except t
own or GND.
alue are 75KΩ
for Analog pa
for Digital pa
for Digital pa
ut voltage
r created by
for core
tantalum ca
D for ou
d selectively
frequency n
the power
ld not be c
vices.
e.
set period.
al test mode
nly during
pull-up.
the pin num
.
Ω.
art
art
art
y internal p
operation p
apacitor bet
utput freq
y connect
noise decou
for W5200
connected t
10
e.
reset
mber 7
power
power
tween
uency
0.1uF
pling.
core
o the
iEthernet W
5200
© Co
XTAL
Rec
1
2
3
4
opyright 201
LVDD I
commend fo
1. Locate
2. Use gro
3. If groun
digital g
4. If groun
ground
11WIZnet Co
16
r power desi
decoupling
ound plane a
nd plane wid
ground plan
nd plane is n
plane, rath
o., Inc. All rig
Figure
ign.
capacitor a
as wide as p
dth is adeq
ne is good p
not wide, d
her than sep
ghts reserve
Connect
e 2 Power
as close as p
possible.
uate, havin
practice.
design analo
parate them
ed.
t a capacitor
Design
possible to
ng a separat
og and digita
m.
r of 10.1uF t
W5200.
te analog gr
al ground p
to the ground
round plane
planes as a s
11
d.
e and
single
iEthernet W
5200
© Co
1.
1.
nF
nS
nLI
opyright 201
Clock5Symbol
XI
XO
LED S6Symbol
FDXLED/M2
PDLED/M1
INKLED/M0
11WIZnet Co
k Signals Type
I
O
ignals Type
O
O
O
o., Inc. All rig
Pin No
1
2
Pin No
3
4
5
ghts reserve
Description
25MHz crys
Oscillator is
Figu
Description
Full Duplex
Low: Full-du
High: Half-d
Link speed
Low: 100Mb
High: 10Mbp
Link LED
Low: Link (1
High: Un-Lin
blink: TX or
ed.
stal input/o
s used to con
ure 3 Crystal
x/Collision LE
uplex
duplex.
LED
bps
ps
10/100M)
nk
r RX state on
utput. A 25
nnect these p
Reference S
ED
Link
5MHz crysta
pins.
Schematic
12
l and
iEthernet W
5200
© Co
2
W5
sho
opyright 201
Memo
5200 is comp
own below.
11WIZnet Co
ory Map
posed of Com
o., Inc. All rig
mmon Regist
W52
ghts reserve
ter, Socket R
200 Memory
ed.
Register, TX M
y Map
Memory, and
d RX Memory
13
y as
iEthernet W
5200
© Co
3
3.1
Ad
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
0x
opyright 201
W520
comm1
ddress
x0000
x0001
x0002
x0003
x0004
x0005
x0006
x0007
x0008
x0009
x000A
x000B
x000C
x000D
x000E
x000F
x0010
x0011
x0012
x0013
x0014
x0015
x0016
x0017
x0018
x0019
x001A
x001B
11WIZnet Co
00 Regist
mon regis
Register
Mode (MR)
Gateway Ad
(GAR0)
(GAR1)
(GAR2)
(GAR3)
Subnet mas
(SUBR0)
(SUBR1)
(SUBR2)
(SUBR3)
Source Hard
(SHAR0)
(SHAR1)
(SHAR2)
(SHAR3)
(SHAR4)
(SHAR5)
Source IP Ad
(SIPR0)
(SIPR1)
(SIPR2)
(SIPR3)
Reserved
Interrupt (I
Socket In
(IMR2)
Retry Time
(RTR0)
(RTR1)
Retry Count
Reserved
o., Inc. All rig
ters
sters
ddress
sk Address
dware Addre
ddress
R)
terrupt Ma
t (RCR)
ghts reserve
ess
ask
ed.
Address
0x001C
0x001D
0x001E
0x001F
0x0020
~
0x0027
0x0028
0x0029
0x002A
~
0x002F
0x0030
0x0031
0x0032
~
0x0033
0x0034
0x0035
0x0036
Registe
Authent
in PPPo
(PATR0)
(PATR1)
Authent
Algorith
(PPPALG
Chip ve
Reserve
PPP
Request
(PTIMER
PPP
number
Reserve
Interrup
Timer
(INTLEV
(INTLEV
Reserve
Socket
(IR2)
PHY Sta
Interrup
er
tication Ty
oE
)
)
tication
hm in PPPoE
GO)
ersion(VERSIO
ed
L
tTimer
R)
LCP Mag
r (PMAGIC)
ed
pt Low Lev
VEL0)
VEL1)
ed
Interru
atus(PSTATUS
pt Mask (IMR
14
ype
ONR)
LCP
gic
vel
upt
S)
R)
iEthernet W
5200
© Co
3.2Note
Addres
0x4n00
0x4n01
0x4n02
0x4n03
0x4n04
0x4n05
0x4n06
0x4n07
0x4n08
0x4n09
0x4n0A
0x4n0B
0x4n0C
0x4n0D
0x4n0E
0x4n0F
0x4n10
0x4n11
0x4n12
0x4n13
0x4n14
0x4n15
0x4n16
0x4n17
~
0x4n1D
opyright 201
Socke2 : n is socket
ss Regi
0 Socket
1 Socket
2 Socket
3 Socket
4
5
Socket
(SN_PO
(SN_PO
6
7
8
9
A
B
Socket
Addres
(Sn_DH
(Sn_DH
(Sn_DH
(Sn_DH
(Sn_DH
(Sn_DH
C
D
E
F
Socket
(Sn_DI
(Sn_DI
(Sn_DI
(Sn_DI
0
1
Socket
(Sn_DP
(Sn_DP
2
3
Socket
(Sn_MS
(Sn_MS
4
Socket
(Sn_PR
5 Socket
6 Socket
7
D
Reserv
11WIZnet Co
et registet number ( 0
ster
t n Mode (Sn_
t n Command
t n Interrupt
t n Status (Sn
t n SourcePo
ORT0)
ORT1)
t n Destinatio
ss
HAR0)
HAR1)
HAR2)
HAR3)
HAR4)
HAR5)
t 0 Destinatio
PR0)
PR1)
PR2)
PR3)
t 0 Destinatio
PORT0)
PORT1)
t 0 Maximum
SSR0)
SSR1)
t 0 Protocol i
ROTO)
t n IP TOS (Sn
t n IP TTL (Sn
ved
o., Inc. All rig
ers , 1, 2, 3, 4,
_MR)
d (Sn_CR)
(Sn_IR)
n_SR)
rt
on Hardware
on IP Addres
on Port
m Segment Siz
in IP Raw mo
n_TOS)
n_TTL)
ghts reserve
5, 6, 7 )
e
ss
ze
ode
ed.
Address
0x4n1E
0x4n1F
0x4n20
0x4n21
0x4n22
0x4n23
0x4n24
0x4n25
0x4n26
0x4n27
0x4n28
0x4n29
0x4n2A
0x4n2B
0x4n2C
0x4n2D
0x4n2E
0x4n30
~
0x4nFF
Register
Receive M
(Sn_RXMEM
Transmit M
(Sn_TXMEM
Socket 0 T
(Sn_TX_FS
(Sn_TX_FS
Socket 0 T
(Sn_TX_RD
(Sn_TX_RD
Socket 0 T
(Sn_TX_W
(Sn_TX_W
Socket 0 R
(Sn_RX_RS
(Sn_RX_RS
Socket 0 R
(Sn_RX_RD
(Sn_RX_RD
Socket 0 R
(Sn_RX_W
(Sn_RX_W
Socket Int
(Sn_IMR)
Fragment
(Sn_FRAG0
(Sn_FRAG1
Reserved
r
Memory Size
M_SIZE)
Memory Size
M_SIZE)
TX Free Size
SR0)
SR1)
TX Read Poin
D0)
D1)
TX Write Poin
WR0)
WR1)
RX Received
SR0)
SR1)
RX Read Poin
D0)
D1)
RX Write Poin
WR0)
WR1)
terrupt Mask
Offset in IP
0)
1)
15
nter
nter
Size
nter
nter
header
iEthernet W
5200
© Co
4
4.
MR (Mo
This r
7
RS
Bit
7
6
5
4
3
2
1
0
GAR (G
This R
SUBR (
This
opyright 201
Regis
Comm1
ode Register
register is us
7 6
ST
t Sym
RS
Reser
Reser
PB
PPP
Reser
Reser
Reser
Gateway IP A
Register sets
Ex) In cas
0x000
192 (0xC
(Subnet Mas
register set
Ex) In cas
11WIZnet Co
ter Desc
mon Regi
r) [R/W] [0x
sed for S/W
6 5
mbol
ST
S
If
a
rved R
rved R
B
P
0
1
If
PoE
P
0
1
If
‘1
a
rved R
rved R
rved R
Address Regi
s up the defa
se of “192.16
1
C0)
k Register)
ts up the su
se of “255.25
o., Inc. All rig
cription
sters
x0000] [0x00
reset, ping b
4
PB
/W Reset
f this bit is
utomatically
Reserved
Reserved
Ping Block Mo
: Disable Pin
: Enable Pin
f the bit is se
PPPoE Mode
: DisablePP
: EnablePPP
f you use AD
1’ to connec
pplication no
Reserved
Reserved
Reserved
ister) [R/W]
ault gateway
68.0.1”
0x0002
168 (0xA8
[R/W] [0x00
bnet mask a
55.255.0”
ghts reserve
s
0]
block mode a
3
B PPP
‘1’, internal
y cleared aft
ode
ng block
ng block
et as ‘1’, the
PoE mode
PoE mode
DSL without r
ct to ADSL
ote, “How to
] [0x0001 – 0
y address.
)
005 – 0x000
address.
ed.
and PPPoE m
3 2
PoE
Description
l register wi
ter reset.
ere is no resp
router or etc
Server. For
o connect AD
0x0004] [0x
0x0003
0 (0x00)
8] [0x00]
mode.
2 1
n
ill be initiali
ponse to the
c, you should
more detail
DSL”.
x00]
0
1
1 0
ized. It will
e ping reques
d set the bit
l, refer to t
0x0004
(0x01)
16
0
be
st.
t as
the
iEthernet W
5200
© Co
SHAR (
This r
0x
0
SIPR (S
This r
IR (Inte
This
interr
as lon
have
7
CONF
Bit
7
6
5
4
3
2
1
0
opyright 201
0x000
255 (0xF
(Source Hard
register sets
Ex) In cas
x0009
0x00
Source IP Ad
register sets
Ex) In cas
0x000
192 (0xC
errupt Regis
register is
ruption can
ng as any ma
been cleare
7
FLICT Rese
t Sym
CONF
Rese
5 PPP
Rese
Rese
Rese
Rese
Rese
11WIZnet Co
5
FF)
dware Addre
up the Sour
se of “00.08.
0x000A
0x08
ddress Regist
up the Sour
se of “192.16
F
C0)
ster) [R] [0x
accessed by
be masked i
asked signal
ed.
6
erved PP
mbol
FLICT
I
I
a
t
erved R
PoE
P
I
t
c
erved R
erved R
erved R
erved R
erved R
o., Inc. All rig
0x0006
255 (0xFF
ess Register
rce Hardware
.DC.01.02.03
0x000
0xDC
ter) [R/W] [
rce IP addres
68.0.2”
0x0010
168 (0xA8
x0015] [0x00
y the host
in the Interr
is set, and w
5
PPoE Rese
IP Conflict
It is set as ‘1
as Source IP
this bit.
Reserved
PPPoE Conn
In the Point
the PPPoE c
cleared to ‘0
Reserved
Reserved
Reserved
Reserved
Reserved
ghts reserve
)
r) [R/W] [0x0
e address.
3”
0B 0
C
0x000F – 0x
ss.
)
0]
processor t
rupt Mask Re
will not go h
4
erved Res
1’ when the
address. Th
ection Close
-to-Point Pro
connection i
0’ by writing
ed.
0x0007
255 (0xFF)
0009 – 0x00
0x000C
0x01
x0012] [0x0
0x0011
0 (0x00)
to know the
egister (IMR).
igh until all
3
served Rese
Descriptio
re is ARP req
his bit is clea
e
otocol over
is closed, ‘1
g ‘1’ to this b
0
0
00E] [0x00]
0x000D
0x02
0]
0
2
e cause of
. The nINT si
masked bits
2
erved Rese
n
quest with sa
ared to ‘0’ by
Ethernet (P
1’ is set. Th
bit.
0x0008
0 (0x00)
0x00
0x0
0x0012
2 (0x02)
interrupt.
ignal retain
s in this Regis
1
erved Rese
ame IP addr
y writing ‘1’
PPPoE) Mode
his bit will
17
00E
03
Any
low
ster
0
erved
ress
’ to
, if
be
iEthernet W
5200
© Co
IMR (
The I
a bit
when
will n
7
IM_
Bit
7
6
5
4
3
2
1
0
RTR (
It co
initia
Ex)
Re-tr
CONN
RCR (
It co
‘RCR+
In c
cha
‘1’
Ex)
opyright 201
(Interrupt M
nterrupt Mas
in the Inter
never the cor
not occur tho
7 6
_IR7 Rese
t Sym
IM_
Rese
IM_
Rese
Rese
Rese
Rese
Rese
(Retry Time
nfigures the
alized with 2
) When timeo
ansmission w
NECT, DISCON
(Retry Coun
nfigures the
+1’ times, Ti
case of using
anged to ‘SO
. In case of n
) RCR = 0x00
11WIZnet Co
ask Register
sk Register i
rrupt Registe
rresponding
ough the bit
6
erved IM_
mbol
_IR7 I
rved R
_IR5 P
rved R
rved R
rved R
rved R
rved R
-value Regis
e retransmiss
000(0x07D0)
out-period is
will occur if
N, CLOSE, SE
nt Register) [
e number of
imeout inter
g TCP commu
OCK_CLOSED
not using TC
007
o., Inc. All rig
r) [R/W] [0x
s used to ma
er (IR). If an
bit in the IR
in the IR is s
5 4
_IR5 Rese
P Conflict E
Reserved
PPPoE Close
Reserved
Reserved
Reserved
Reserved
Reserved
ster) [R/W] [
sion timeout
) and has 200
s set as 400m
0x0017
0x0F
there is no
END, SEND_M
[R/W] [0x00
f retransmiss
rrupt is set (‘
unication, th
D’ and Sn_IR
CP communic
ghts reserve
x0036] [0x00
ask interrupt
interrupt m
R is set. If an
set.
4
erved Rese
nable
Enable
[0x0017 – 0x
t-period. Th
0ms timeout
ms, RTR = (40
response fro
MAC and SEN
019] [0x08]
sion times.
‘TIMEOUT’ b
he value of S
(Socket n-th
cation, only S
0x0019
0x07
ed.
0]
ts. Each inte
mask bit is se
ny bit in the
3 2
erved Rese
Description
x0018] [0x0
he standard
t-period.
00ms / 1ms)
0x0018
0xA0
om the remo
D_KEEP, or t
When retra
bit of Sn_IR is
Sn_SR (Socke
h Status Reg
Sn_IR(TIMEO
errupt mask b
et, an interru
IMR is set as
2
erved Rese
n
07D0]
unit of RTR
X 10 = 4000
ote peer to
he response
nsmission oc
s set as ‘1’).
et n-th-th Sta
ister) (TIMEO
UT) turns int
bit correspo
rupt will be i
s ‘0’, an inte
1
erved Rese
R is 100us. R
0(0x0FA0)
the comman
is delayed.
ccurs as ma
.
atus Registe
OUT) turns i
to ‘1’.
18
nds to
issued
errupt
0
erved
RTR is
nds of
any as
r) is
into
iEthernet W
5200
© Co
The t
Resol
At th
autom
inform
peer,
trans
Even
respo
The v
At th
packe
there
retra
packe
timeo
Sn_IR
Ex) W
ARPTO
TCPTO
The v
PATR (A
This
PPPoE
N=0
N :M :RTR
opyright 201
timeout of W
lution Protoc
he ARP (Refe
matically se
mation (used
if there is n
mitted. It is
after ARP-r
onse, the fin
value of fina
e TCP packe
ets) and wa
e is no AC
nsmitted. Th
et retransmi
out occurs
R(TIMEOUT) =
When RTR = 2
O = 2000 X 0.
O = (0x07D0 +
= (2000 + 40
= 318000 X
value of fina
Authenticat
register not
E Server. W5
TCPT0
Retransmiss: Minimum vaRMAX: RTR X 2
11WIZnet Co
W5200 can b
col (ARP) and
er to RFC 82
nds ARP-req
d for commu
no response d
repeated as
request retr
al timeout o
l timeout (A
et retransmis
its for the a
K from the
he retransm
issions are r
and Sn_SR
= ‘1’
2000(0x07D0
.1ms X 9 = 18
0x0FA0 + 0x1F
000 + 8000 +
0.1ms = 31.8
l timeout (T
tion Type in
tifies authen
5200 support
Value
0xC023
0xC223
M
TO = ( Σ(R
sion count, alue when RT2M
A
o., Inc. All rig
be configura
d TCP retran
6, http://ww
quest to the
unication of I
during the ti
s many as ‘R
ransmissions
occurs and Sn
RPTO) of ARP
ssion timeou
acknowledge
e peer, Tim
issions are r
epeated ‘RC
R is chang
0), RCR = 8(0
800ms = 1.8s
F40 + 0x3E80
16000 + 320
8s
CPTO) of TCP
PPPoE mod
ntication me
s two types
Au
RTR X 2N )
0<= N <= M TR X 2(M+1) >
ARPTO =(RTR
ghts reserve
ble with RT
nsmission tim
ww.ietf.org/
e peer’s IP a
IP, UDP, or TC
ime set in RT
RCR + 1’ time
are repeate
n_IR(TIMEOU
P-request is a
ut, W5200 tr
ement (ACK)
meout occur
repeated as
CR +1’ times
ged to ‘SO
0x0008),
s
+ 0x7D00 + 0x
000 + ((8 - 4)
P packet retr
e) [R] [0x00
ethod that h
of Authentic
uthentication
PAP
CHAP
+ ((RCR-
65535 and 0
R X 0.1ms ) X
ed.
R and RCR.
meout.
/rfc.html) re
address in o
CP). As wait
TR, Timeout
es.
ed ‘RCR + 1
UT) becomes
as below.
ansmits TCP
) during the
rs and TCP
many as ‘RC
s, if there is
CK_CLOSED”
xFA00 + 0xFA0
) X 64000)) X
ransmission c
01C-0x001D
has been ag
cation metho
n Type
-M) X RTRM
0 <= M <= RCR
X ( RCR + 1
W5200’s tim
etransmission
rder to acq
ing for ARP-r
occurs and A
1’ times, if
‘1’.
P packets (SY
time set in
packets (s
CR + 1’ time
s no ACK fro
” at the s
0 + 0xFA00 + 0
X 0.1ms
can be calcu
] [0x0000]
reed at the
od - PAP and
MAX) ) X 0
R
)
meout has Ad
n timeout, W
uire MAC ad
response fro
ARP-request
there is no
YN, FIN, RST,
n RTR and R
sent earlier
es. Even afte
om the peer,
same time
0xFA00) X 0.1
ulated as belo
e connection
CHAP.
0.1ms
19
ddress
W5200
ddress
om the
t is re-
o ARP-
, DATA
RCR. If
r) are
er TCP
, final
with
ms
ow,
n with
iEthernet W
5200
© Co
PPPA
This
pleas
VERS
This r
PTIM
This r
PMAG
This
note,
INTLE
It se
the n
a. At S
(IR
b. At S
(IR
c. The
(IR
d. S0_
How
opyright 201
ALGO(Authen
register not
se refer to PP
SIONR (W520
register is th
ER (PPP Lin
register indic
Ex) in cas
200 * 2
GIC (PPP Lin
register is u
, “How to co
EVEL (Interr
ets Interrupt
next interru
SOCKET 0, Re
(S0_IR) = ‘1’
SOCKET 1, Co
(S1_IR) = ‘1’
e Host clear
(S0_IR) = ‘0’
_IR is cleare
wever, as INT
11WIZnet Co
ntication Alg
tifies authe
PPoE applica
00 Chip Vers
he W5200 chi
k Control Pr
cates the du
se that PTIM
25(ms) = 500
nk Control Pr
sed in Magic
onnect ADSL”
rupt Low Lev
t Assert wait
upt.
IAWT = (INTL
Receive Inter
). nINT signa
onnected Int
).
rs S0_IR1 (S
). nINT signa
ed. As IR2 is
TLEVEL0 is 0
o., Inc. All rig
gorithm in P
ntication al
ation note.
sion Register
ip version re
rotocol Requ
uration for se
ER is 200,
00(ms) = 5 se
rotocol Magi
c number op
”.
vel Timer Re
t time (IAWT)
EVEL0 + 1) *
Figure 4
rupt occurs
al is asserted
terrupt occu
0_IR = 0x00
al becomes H
s not 0x00,
0x000F, the in
ghts reserve
PPPoE mode)
lgorithm in
r)[R][0x001
egister.
uest Timer R
ending LCP E
econds
ic number R
ption during
egister)[R/W
). It configur
* PLL_CLK (
4 INTLEVE
(S0_IR(3) = ‘
d low.
urs (S1_IR(0)
0) and corre
High.
nINT should
nterrupt abo
ed.
)[R][0x001E
PPPoE mod
F][0x03]
Register) [R/
Echo Request
Register) [R/
LCP negotia
W][0x0030 –
res nINT Low
(when INTLE
L Timing
‘1’) and corr
= ‘1’) and c
esponding IR
d be asserte
out IR is proc
E][0x00]
e. For deta
/W] [0x0028
t. Value 1 is a
/W] [0x0029
tion. Refer t
0x0031][0x
w Assert wa
EVEL0 > 0)
responding IR
orresponding
bit is auto
ed low right
cessed after
ailed inform
8]
about 25ms.
9][0x00]
to the applic
x0000]
iting time u
R2 bit is set
g IR2 bit set
omatically cl
t after 1PLL
IAWT(16 PLL_
20
ation,
.
cation
until
as ‘1’
as ‘1’
leared
L_CLK.
_CLK).
iEthernet W
5200
© Co
IR2(W
IR2 is
relate
keeps
autom
7
S7_
Bit
7
6
5
4
3
2
1
0
opyright 201
W5200 SOCK
s the Registe
ed bit of IR2
s low until a
matically.
7 6
_INT S6_
Symbol
S7_INT
S6_INT
S5_INT
S4_INT
S3_INT
S2_INT
S1_INT
S0_INT
11WIZnet Co
KET Interrup
er to notify W
2 is set as ‘1
all bits of Sn
6 5
_INT S5_
l Descri
When
interru
cleared
When
interru
cleared
When
interru
cleared
When
interru
cleared
When
interru
cleared
When
interru
cleared
When
interru
cleared
When
interru
cleared
o., Inc. All rig
pt Register)[
W5200 SOCK
’. When rela
_IR becomes
5 4
_INT S4_
ption
an interrup
upt informat
d when S7_IR
an interrup
upt informat
d when S6_IR
an interrup
upt informat
d when S5_IR
an interrup
upt informat
d when S4_IR
an interrup
upt informat
d when S3_IR
an interrup
upt informat
d when S2_IR
an interrup
upt informat
d when S1_IR
an interrup
upt informat
d when S0_IR
ghts reserve
[R/W][0x003
KET interrupt
ated Mask B
s ‘0’. If all b
4 3
_INT S3_
pt occurs a
tion is appl
R is cleared
pt occurs a
tion is appl
R is cleared
pt occurs a
tion is appl
R is cleared
pt occurs a
tion is appl
R is cleared
pt occurs a
tion is appl
R is cleared
pt occurs a
tion is appl
R is cleared
pt occurs a
tion is appl
R is cleared
pt occurs a
tion is appl
R is cleared
ed.
34][0x00]
t to the Host
it is ‘1’, nIN
bits of Sn_IR
3 2
_INT S2_
at SOCKET
lied to S7_I
to 0x00 by h
at SOCKET
lied to S6_I
to 0x00 by h
at SOCKET
lied to S5_I
to 0x00 by h
at SOCKET
lied to S4_I
to 0x00 by h
at SOCKET
lied to S3_I
to 0x00 by h
at SOCKET
lied to S2_I
to 0x00 by h
at SOCKET
lied to S1_I
to 0x00 by h
at SOCKET
lied to S0_I
to 0x00 by h
t. If any inte
NT signal is a
become ‘0’
2 1
_INT S1_
7-th, it be
R. This bit
host.
6-th, it be
R. This bit
host.
5-th, it be
R. This bit
host.
4-th, it be
R. This bit
host.
3-th, it be
R. This bit
host.
2-th, it be
R. This bit
host.
1-th, it be
R. This bit
host.
0-th, it be
R. This bit
host.
errupt occur
asserted low
’, it become
1 0
_INT S0_
ecomes ‘1’.
is automat
ecomes ‘1’.
is automat
ecomes ‘1’.
is automat
ecomes ‘1’.
is automat
ecomes ‘1’.
is automat
ecomes ‘1’.
is automat
ecomes ‘1’.
is automat
ecomes ‘0’.
is automat
21
rs, the
w. nINT
s high
0
_INT
This
ically
This
ically
This
ically
This
ically
This
ically
This
ically
This
ically
This
ically
iEthernet W
5200
© Co
PHYS
PHYS
Bit
7
6
5
4
3
2
1
0
IMR2
The I
a bit
issued
interr
7
S7_
Bit
7
6
5
4
3
2
1
0
opyright 201
STATUS(W52
STATUS is th
t Sy
Res
Res
L
Res
POW
Res
Res
Res
(Interrupt M
nterrupt Mas
in the Inter
d whenever
rupt will not
7 6
_INT S6_
Symbol
S7_INT
S6_INT
S5_INT
S4_INT
S3_INT
S2_INT
S1_INT
S0_INT
11WIZnet Co
200 PHY stat
he Register t
ymbol
served
served
LINK
served
ERDOWN
served
served
served
Mask Registe
sk Register i
rrupt Registe
the corresp
t occur thoug
6
_INT S5_
l Descri
IR(S7_
IR(S6_
IR(S5_
IR(S4_
IR(S3_
IR(S2_
IR(S1_
IR(S0_
o., Inc. All rig
tus Register)
to indicate W
Reserved
Reserved
Link Stat
This regis
0 : Link d
1 : Link U
Reserved
Power do
This regis
0 : Disab
1 : Enabl
Reserved
Reserved
Reserved
er2)[R/W][0x
s used to ma
er2 (IR2). If
ponding bit i
gh the bit.
5 4
_INT S4_
ption
INT) Interrup
INT) Interrup
INT) Interrup
INT) Interrup
INT) Interrup
INT) Interrup
INT) Interrup
INT) Interrup
ghts reserve
)[R/W][0x17
W5200 statu
d
d
tus Register
ster indicate
down
Up
d
own mode o
ster indicate
le Power dow
le Power dow
d
d
d
x0016][0x00
ask interrupt
an interrup
n the IR2 is
4
_INT S3_
pt Mask
pt Mask
pt Mask
pt Mask
pt Mask
pt Mask
pt Mask
pt Mask
ed.
7]
us of PHY.
Descripti
[Read Only]
es Link statu
of PHY[Read
es status of P
wn mode(op
wn mode
0]
ts. Each inte
t mask bit i
set. If any
3 2
_INT S2_
ion
]
s.
Only]
Power down
erates norm
errupt mask b
s set, an int
bit in the IM
2
_INT S1_
mode
al mode)
bit correspo
terruption w
MR is set as
1
_INT S0_
22
nds to
will be
‘0’ an
0
_INT
iEthernet W
5200
© Co
4.2Sn1_M
Thi
MU
Bi
7
6
5
1n is S2[Readsocket
opyright 201
Socke2MR (Socket n
is register se
7
ULTI
it Sym
7 MUL
6 MF
5 ND/
Socket n-thumd/Write] [addt 4, address of
11WIZnet Co
et Registen-th-th Mod
ets up socket
6
ND
bol
LTI
Mult
0 : d
1 : e
It is
For
Dest
Dest
F
MAC
0 : D
1 : E
It is
Whe
itsel
pack
reco
host
MC
Use
0 : D
1 : E
This
ACK
from
to in
Mult
0 : u
1 : u
This
P0 :
num
mber (0, 1, 2, 3, dress of socketf socket 5, add
o., Inc. All rig
ers e Register)
t option or p
5 4
/ MC
ticasting
disable Multic
enable Multic
applied only
using multic
tination IP
tination Port
Filter
Disable MAC f
Enable MAC f
used in MAC
en this bit is
lf or broadca
kets on Eth
ommended to
.
No Delayed A
Disable No De
Enable No De
only applie
packet is
m a peer. If t
nternal timeo
ticast
using IGMP ve
using IGMP ve
bit is valid
“0010”). In
ber in IGMP
4, 5, 6, 7). t 0, address of dress of socket
ghts reserve
[R/W] [0x40
protocol type
4
P
casting
casting
y in case of U
casting, wri
and multic
Register, be
filter
filter
CRAW (P3~P0
set as ‘1’,
asting. When
hernet. Whe
o be set as
ACK
elayed ACK o
elayed ACK o
es to TCP ca
immediately
this bit is cl
out mechani
ersion 2
ersion 1
when MULT
addition, m
messages su
socket 1, addt 6, address of
ed.
000+0x0n00
e for each so
3
P3 P
Descriptio
UDP.
te multicast
cast group
efore OPEN c
0: “0100”).
W5200 can r
n this bit is s
en using th
‘1’ for redu
option
option,
se (P3-P0 :
y transmitte
eared, ACK
ism.
TI bit is enab
ulticast can
uch as Join/L
ress of socket socket 7] [Res
0] [0x00]2
ocket.
2
P2 P
on
t group add
port numb
command.
receive pack
set as ‘0’, W
he hybrid T
ucing the re
“0001”) If t
ed after rec
packet is tra
bled and UDP
be used to s
Leave/Repor
2, address of sset value]
1
P1 P
dress to Soc
ber to Sock
ket that is b
W5200 can rec
TCP/IP stac
eceiving over
this bit is se
ceiving data
ansmitted ac
P mode is u
send out the
rt to multica
socket 3,addre
23
0
P0
ket n-th
ket n-th
belong in
ceive all
k, it is
rhead of
t as ‘1’,
a packet
ccording
sed (P3-
e version
st-group
ess of
iEthernet W
5200
© Co
4
3
2
1
0
opyright 201
4 Reser
3 P3
2 P2
P1
0 P0
11WIZnet Co
rved Rese
3
Prot
Se
* In
S0
S0
co
ut
2
1
0
o., Inc. All rig
erved
tocol
ets up corres
P
3
0
0
0
0
case of sock
P
3
0
0
0_MR_MACRA
0_MR_PPPoE
onnection/Te
tilized as ano
ghts reserve
sponding soc
P
2
P
1
0 0
0 0
0 1
0 1
ket 0, MACR
P
2
P
1
1 0
1 0
AW and S0_M
is temporari
ermination. A
other protoc
ed.
ket as TCP, U
P
0
0
1
0
1
RAW and PPP
P
0
0
1
MR_PPPoE are
ily used for P
After connec
ol.
UDP, or IP RA
Meaning
Closed
TCP
UDP
IPRAW
PoE mode ex
Meaning
MACRAW
PPPoE
e valid only i
PPPoE server
ction is estab
AW mode
xist.
in SOCKET 0.
r
blished, it ca
24
.
an be
iEthernet W
5200
© Co
Sn_C
This
SEND
clear
To ve
regist
Valu
0x0
0x0
0x0
opyright 201
CR (Socket n-
is used to s
, and RECEIV
red to 0x00.
erify whethe
ters.
ue Symbo
01 OPEN
02 LISTE
04 CONNE
11WIZnet Co
-th Comman
set the com
VE. After W5
Even though
er the com
ol Descr
N
Socke
in Sn
corres
N
This i
mode,
conne
registe
When
chang
becom
to SO
transf
cf> If
conne
uncha
ECT
This m
TCP c
conne
port r
When
registe
‘1’.In
occurs
acquir
o., Inc. All rig
nd Register)
mand for So
5200 identifi
h Sn_CR is cl
mand is co
iption
t n-th is init
n_MR (P3:P0
sponding to S
Sn_MR(P3
Sn_MR_C
Sn_MR_T
Sn_MR_U
Sn_MR_IP
S0_MR_M
S0_MR_P
is valid only
, the Socket
ection-reques
er changes t
a client’s co
es from SO
mes ‘1’. On t
CK_CLOSED
fer)
the destina
ection reque
anged.
mode is only
client.A conn
ecting to the
egisters (Sn_
a client’s co
er is change
the followi
s (Sn_IR(s)=‘
red through
ghts reserve
[R/W] [0x4
ocket n-th s
ies the comm
leared to 0x0
mpleted or
tialized and
0). The ta
Sn_MR
3:P0)
CLOSE (0x00)
TCP (0x01)
UDP (0x02)
PRAW (0x03)
MACRAW (0x0
PPPoE (0x05)
y in TCP m
t n-th is conf
st (SYN pac
the state fro
onnection re
OCK_LISTEN
the other ha
during a co
ation port o
est, W5200
y valid in TC
nect-request
e IP address
_DIPR0 and S
onnection re
ed to SOCK
ing cases, t
‘1’) because
the ARP proc
ed.
001+0x0n00
such as OPE
mand, the Sn
00, the com
not, please
opened acc
able below
Sn_S
) -
SOC
SOC
SOC
04) SOC
SOC
ode (Sn_MR
figured as a
cket) from
m SOCK_INIT
equest is suc
to SOCK_ES
and, Sn_IR(3)
onnection fa
of the TCP
will transm
CP mode and
t (SYN packe
and port st
Sn_DPORT0)
equest is suc
K_ESTABLIESH
the connect
e the Destin
cess
0] [0x00]
N, CLOSE, C
n_CR registe
mand is still
e check the
cording to th
shows the
SR
CK_INIT (0x13
CK_UDP (0x22
CK_IPRAW (0x
CK_MACRAW (
CK_PPPoE (0x
R(P3:P0) = S
TCP server
any “TCP C
T to SOCKET_
ccessfully est
STABLIESHED
) is set as ‘1
ailure(SYN/AC
Client does
it a RST pa
d operates t
et) is sent to
ored in dest
ccessfully est
HED and the
-request fai
nation Hardw
CONNECT, LI
er is automat
l being proce
e Sn_IR or
he protocol
e value of
3)
2)
x32)
(0x42)
x5F)
Sn_MR_TCP).
which is wa
CLIENT”. Th
_LISTEN.
tablished, th
D and the
’ and Sn_SR
CK packet f
not exist d
acket and S
the Socket n
o the TCP se
tination add
tablished, th
e Sn_IR(0) b
ils When a
ware Addres
25
STEN,
tically
essed.
Sn_SR
selected
f Sn_SR
. In this
aiting for
e Sn_SR
he Sn_SR
Sn_IR(0)
changes
failed to
during a
Sn_SR is
n-th as a
erver by
ress and
he Sn_SR
becomes
a ARPTO
ss is not
iEthernet W
5200
© Co
0x0
0x1
0x2
0x2
0x2
0x4
opyright 201
08 DISCO
0 CLOS
0 SEND
1 SEND_M
2 SEND_K
40 RECV
11WIZnet Co
When
When
Above
ON
Only v
Regard
Active
conne
Passiv
replie
when
When
and Sn
cf> If
SOCK_
packe
uncon
E Closes
Sn_SR
D
SEND
please
th TX
Pointe
MAC
Used i
The b
Destin
(Addre
Destin
witho
EEP
Used i
It che
has no
occur.
V
RECV
registe
For m
with S
Write
Regist
o., Inc. All rig
a SYN/ACK p
a RST packe
e three cases
valid in TCP m
dless of “TC
e close :
ected peer
ve close : W
d back to th
FIN/ACK pac
a disconnec
n_SR is chan
f CLOSE is
_CLOSED wit
et is receiv
nditionally ch
s Socket n-th
R is changed t
transmits al
e refer to So
X Write Poin
er Register(S
in UDP mode
basic operati
nation Hardw
ess Resoluti
nation Hardw
ut going thro
in TCP mode
cks the conn
o response f
processes
er(Sn_RX_RD
more detail,
Socket n-th R
Pointer Re
ter(Sn_RX_RD
ghts reserve
packet is no
et is received
s, Sn_SR is ch
mode
P SERVER” o
it transmits
When FIN pac
he peer
cket is receiv
ct request is
ged to SOCK
used instea
thout discon
ved from a
hanged to SO
h.
to SOCK_CLO
l the data bu
ocket n-th TX
nter Registe
n_TX_RD0).
e only
ion is same
ware Addre
ion Protoco
ware Addre
ough the ARP
e
nection stat
from peers o
the data
D).
please refer
RX Received
egister(Sn_RX
D).
ed.
t received a
d instead of
hanged to SO
or “TCP CLIEN
s disconnec
cket is recei
ved, Sn_SR i
s not receive
K_CLOSED.
ad of DISCO
nnect-proces
a peer dur
OCK_CLOSED
OSED.
uffered in th
X Free Size R
er(Sn_TX_WR
as SEND. N
ess which c
ol) process.
ss(Sn_DHAR0
P process.
us by sendin
or is termina
received b
r to 5.2.1.1
Size Registe
X_WR), and
nd TCPTO(Sn
a SYN/ACK p
OCK_CLOSED
NT”, this dis
ct-request(FI
ived from pe
s changed to
ed, TCPTO o
ON, only Sn
ss(disconnect
ring commu
.
he TX memor
Register (Sn_
R0), and So
Normally SEN
can be retr
SEND_MAC
0) that is c
ng 1byte dat
ated, the Tim
by using a
SERVER mod
er (Sn_RX_RS
Socket n-t
n_IR(3)) is’1’
packet
D.
sconnect the
IN packet)
eer, a FIN p
o SOCK_CLOS
occurs (Sn_IR
n_SR is cha
t-request).
unication, S
ry. For more
_TX_FSR0), S
ocket n-th T
ND operatio
rieved by t
uses Sock
chosen by t
ta. If the con
meout interr
RX read
de Receiving
SR0), Socket
th RX Read
26
’
process
to the
packet is
SED.
R(3)=’1’)
nged to
If a RST
Sn_SR is
e details,
ocket n-
TX Read
on needs
the ARP
ket n-th
the user
nnection
rupt will
pointer
g Process
t n-th RX
Pointer
iEthernet W
5200
© Co
Belo
more
Va
0
0
0
0
0
opyright 201
ow command
e detail refe
alue S
0x23
0x24 P
0x25
0x26
0x27
11WIZnet Co
ds are only
er to the “H
Symbol
PCON
PDISCON
PCR
PCN
PCJ
o., Inc. All rig
valid for SO
How to use A
PPPoE conn
Closes PPPo
In each pha
In each pha
In each pha
ghts reserve
OCKET 0 an
ADSL”.
ection begin
oE connectio
ase, it transm
ase, it transm
ase, it transm
ed.
nd S0_MR(P3
Descrip
ns by transmi
n
mits REQ mes
mits NAK mes
mits REJECT
3:P0) = S0_M
ption
itting PPPoE
ssage.
ssage.
message.
MR_PPPoE.
discovery p
27
For
acket
iEthernet W
5200
© Co
Sn_IR
Sn_IR
recei
Sn_IM
In or
Sn_I
PR
Bi
7
6
5
4
3
2
1
0
opyright 201
R (Socket n-
R register pro
ving data, t
MR is ‘1’, the
rder to clea
R is cleared
7
RECV PF
it Symbo
7 PRECV
6 PFAIL
5 PNEXT
4 SEND_O
3 TIMEO
2 RECV
DISCON
0 CON
11WIZnet Co
th Interrupt
ovides inform
imeout) use
e interrupt b
r the Sn_IR
d (‘0’), IR(n)
6
FAIL PN
ol Descrip
V
Sn_IR(P
Valid on
PPP Re
receive
Sn_IR(P
Valid on
PPP Fai
T
Sn_IR(P
Valid on
PPP Ne
connec
OK Sn_IR(S
SEND O
UT Sn_IR(T
TIMEOU
Sn_IR(R
Receive
N
Sn_IR(D
Disconn
peer
Sn_IR(C
Connec
o., Inc. All rig
t Register) [R
mation such
d in Socket
it of Sn_IR b
bit, the hos
is automat
5
NEXT SEN
ption
PRECV) Inter
nly in case o
eceive Inter
ed
PFAIL) Interr
nly in case o
il Interrupts
PNEXT) Inter
nly in case o
ext Phase In
tion process
SENDOK) Int
K Interrupts
TIMEOUT) In
UT Interrupts
RECV) Interr
e Interrupts w
DISCON) Inte
nect Interrup
CON) Interru
ct Interrupts
ghts reserve
R] [0x4002+
as the type
n-th. When
becomes ‘1’.
st should wr
ically cleare
4
ND_OK TIM
rrupt Mask
of 'SOCKET=0
rrupts when
rupt Mask
of 'SOCKET=0
when PAP Au
rrupt Mask
of 'SOCKET=0
nterrupts w
s
terrupt Mask
s when the SE
nterrupt Mas
s when ARPTO
rupt Mask
whenever da
errupt Mask
pts when FI
upt Mask
when a conn
ed.
+0x0n00] [0
of interrupt
n an interrup
rite the bit a
ed.
3
MEOUT RE
' and 'S0_MR
the option
' & 'S0_MR(P
uthenticatio
' & 'S0_MR(P
hen the ph
k
END comman
sk
O or TCPTO oc
ata packet is
N of FIN/AC
nection is es
0x00]
t (establishm
pt occurs an
as ‘1’. When
2
ECV DIS
(P3:P0)=S0_M
n which is
3:P0)=S0_MR
n is failed
3:P0)=S0_MR
ase is chan
nd is comple
ccurs
s received fro
CK packet is
stablished wi
ment, termin
nd the mask
n all the bit
1
SCON C
MR_PPPoE'
not support
R_PPPoE'
R_PPPoE'
nged during
eted
rom a peer
s received fr
ith a peer
28
ation,
bit of
s of
0
CON
ted is
ADSL
rom a
iEthernet W
5200
© Co
Sn_SR
This
Sn_CR
differ
Va
0x
0x
0x
0x
0x
opyright 201
R (Socket n-
register prov
R register o
rent states o
alue Sym
x00 SOCK
x13 SOCK
x14 SOCK
x17 SOCK
x1C SOCK
11WIZnet Co
-th Status Re
vides the st
or during p
of Socket n-t
bol
K_CLOSED
K_INIT
K_LISTEN
K_ESTABLISH
K_CLOSE_WA
o., Inc. All rig
egister) [R]
atus of Sock
packet trans
th.
Descr
It is th
DISCON
occurs,
previou
It is sh
comma
when S
perform
establi
It is p
SERVER
It is th
waits f
Socket
connec
When t
SOCK_L
Once
change
if the
‘1’) an
HED It is s
change
CLIENT
CONNE
status,
RECV c
AIT It is t
receive
is possi
TCP dis
For SO
comma
ghts reserve
[0x4003+0x
ket n-th. SO
smission/rec
ription
he status tha
N or CLOSE c
, it is cha
us value.
hown in cas
ands are giv
Sn_MR (P3:P
med. It is
shment.
possible to
R" mode and
he status tha
for connect-r
n-th opera
ction-request
the LISTEN
LISTEN
the connec
es from SOCK
connection
d the state c
hown in ca
ed to SOCK_E
T” is success
ECTS comma
DATA packe
command can
the status t
ed from the
ible to trans
sconnection,
OCKETn clos
and should b
ed.
x0n00] [0x0
CKET status
eption. The
at resource o
command is p
anged to S
se that Sn_
en to Sn_CR
P0) is Sn_MR
the initia
perform LIS
CONNECT co
at SOCKETn o
request (SYN
tes in TCP
t (SYN packe
command is
ction is esta
K_LISTEN to
fails, TCPTO
changes to S
se that con
ESTABLISHED
sfully proces
and is succ
et can be t
n be perform
that disconn
peer As TCP
sfer data pac
, DISCON com
e without d
e just perfor
00]
are change
e table belo
of SOCKETn i
performed, o
SOCK_CLOSE
MR is set a
R. It is chan
R_TCP and O
al step of
STEN comma
ommand at t
operates as
N packet) fro
Server Mode
et) from a “T
s used, the
ablished, th
SOCK_ESTAB
O occurs (Sn
OCK_CLOSED
nnection is
D when SYN p
ssed at the
cessfully per
transferred,
med.
nect-request
P connection
cket. In orde
mmand shou
disconnectio
rmed.
ed when usin
ow describe
is released.
or ARPTO, or
ED regardle
as TCP and
ged to SOCK
OPEN comma
TCP conne
and at the
the "TCP CLI
"TCP SERVER
om "TCP CLIE
e and waits
TCP CLIENT”
stage chang
he SOCKET
BLISHED; how
n_IR(TIME_O
D.
established.
packet from
SOCK_LISTE
rformed. At
that is, SE
t (FIN pack
n is half-clos
er to complet
ld be perfor
on-process, C
29
ng the
es the
When
TCPTO
ess of
OPEN
K_INIT
and is
ection
"TCP
ENT".
R" and
ENT".
for a
.
ges to
state
wever,
UT) =
It is
m “TCP
EN, or
t this
ND or
et) is
sed, it
te the
med.
CLOSE
iEthernet W
5200
© Co
0x
0x
0x
0x
Bel
Valu
0x15
0x16
0x18
0x1A
0X1B
0X1D
0x01
opyright 201
x22 SOCK
x32 SOCK
x42 SOCK
x5F SOCK
low is shown
ue Sym
5 SOC
6 SOC
8 SOC
A SOC
B SOC
D SOC
1 SOC
11WIZnet Co
K_UDP
K_IPRAW
K_MACRAW
K_PPPOE
n during chan
mbol
CK_SYNSENT
CK_SYNRECV
CK_FIN_WAIT
CK_CLOSING
CK_TIME_WAI
CK_LAST_ACK
CK_ARP
o., Inc. All rig
It is th
change
and O
transfe
mode S
The so
change
Sn_MR_
transfe
It is ch
S0_MR
frame)
It is th
change
(P3:P0)
connec
nging the sta
Descrip
This sta
sent to
from
comma
packet
change
receive
(Sn_IR(
This st
receive
to SOC
connec
is faile
change
T These s
in the d
is chan
success
=‘1’).
IT
K
This st
order t
ghts reserve
he status th
ed to SOCK_
PEN comma
erred withou
SOCKET.
cket is open
e to SOC
_IPRAW and
erred withou
hanged to SO
(P3:P0)=S0_
can be tran
he status tha
ed to SOCK_
)=S0_MR_PPP
ction.
atus.
ption
atus indicate
o a "TCP SER
SOCK_INIT
and. At thi
t) is received
ed to SOCK_
ed from th
(TIMEOUT)=‘
tatus indicat
ed from a "T
CK_ESTABLIS
ct-accept (SY
ed, TCPTO
ed to SOCK_C
status shows
disconnect-p
nged to SOC
sfully finish
tatus indica
to acquire d
ed.
hat SOCKETn
_UDP when
and is perfo
ut connectio
ned in IPRAW
CK_IPRAW
OPEN comm
ut a connecti
OCK_MACRAW
_MR_MACRAW
nsferred simi
at SOCKET0
PPPoE in cas
PoE . It is te
es that a co
RVER". This s
to SOCK_
is status, i
d from "TCP
_ ESTBLISHE
he "TCP SER
1’), it is cha
te that a co
TCP CLIENT".
HED when W
YN/ACK pack
occurs (Sn_
CLOSED
s that Socket
process of ac
CK_CLOSED,
ed or TCPT
ates that AR
destination h
n is open as
Sn_MR(P3:P
ormed. DATA
on that is n
W mode. The
when Sn_
mand is used.
on similar to
W in case of
W. MACRAW
lar to UDP m
is open as P
se of S0_CR=
emporarily u
nnect-reque
status shows
_ESTABLISHED
if connect-a
P SERVER", it
D. If SYN/A
RVER" befor
anged to SOC
onnect-reque
It is autom
W5200 succe
ket) to the "
_IR(TIMEOUT
t n-th is clos
ctive close o
when disco
TO occurs (
RP-request i
hardware ad
s UDP mode
P0) is Sn_MR
A packet ca
necessary to
e SOCKET sta
_MR (P3:P0
. IP Packet c
o the UDP m
f S0_CR=OPE
packet (Eth
mode.
PPPoE mode
=OPEN and S
used at the
est (SYN pack
s changing pr
D by CON
accept (SYN
t is automat
ACK packet
re TCPTO o
CK_CLOSED.
est(SYN pack
matically ch
essfully tran
"TCP CLIENT"
T)=‘1’), and
sed. It is obs
or passive clo
onnect-proc
(Sn_IR (TIME
is transmitt
dress. This
30
. It is
R_UDP
an be
o TCP
atus is
0) is
can be
ode.
N and
hernet
e. It is
S0_MR
PPPoE
ket) is
rocess
NNECT
N/ACK
tically
is not
occurs
ket) is
anged
nsmits
". If it
it is
served
ose. It
ess is
EOUT)
ted in
status
iEthernet W
5200
© Coopyright 201
11WIZnet Co
Fig
o., Inc. All rig
is obse
SOCK_U
perform
If har
destina
to SOC
and AR
IPRAW
SOCK_U
the SOC
cf> AR
when
differe
same,
hardwa
gure 5 Soc
ghts reserve
erved when
UDP or SO
med at the S
rdware add
ation (when
CK_UDP, SOC
RPTO occurs
mode it
UDP or SOCK
CK_CLOSED.
RP-process op
the previou
ent. If the pr
ARP-process
are address i
cket Statu
ed.
n SEND com
OCK_IPRAW,
SOCK_INIT.
dress is s
ARP-respon
CK_IPRAW or
(Sn_IR(TIME
goes back
K_IPRAW), in
perates at th
us and curr
revious and c
s doesn’t ope
is already ac
us Transiti
mmand is p
or CONNE
successfully
se is receive
SOCK_SYNS
EOUT)=‘1’), i
to the pre
n case of TCP
he SOCK_UD
rent values
current valu
erate becaus
cquired.
on
performed a
ECT comma
acquired
ed), it is ch
SENT. If it's
in case of U
evious statu
P mode it go
DP or SOCK_
of Sn_DIPR
ues of Sn_DIP
se the destin
31
at the
nd is
from
anged
failed
UDP or
us(the
oes to
IPRAW
R are
PR are
nation
iEthernet W
5200
© Co
Sn_PO
[0x000
This
the se
Ex) In
Sn_DH
0x400
It set
PPPoE
When
addre
hardw
can a
CONN
When
Howe
MACR
addre
be se
S0_DH
hardw
comm
comm
Ex)
as
Sn_D
0x40
It set
S0_DI
or PP
CLIEN
opera
estab
opyright 201
ORT (Socket
00]
register sets
et-up needs
n case of Soc
AR (Socket
B+0x0n00]
ts or is set a
E mode, S0_
n using SEND
ess of Socke
ware addres
acquire the d
NET or SEND
n using PPPo
ever, even if
RAW mode,
ess(acquired
et, and MR(P
HAR sets the
ware addres
mand. The
mand.
) In case of
below,
0x4006
0x08
DIPR (Sock
00F+0x0n00
ts or is set a
IPR sets PPP
PPoE mode,
NT" it sets as
ating as "TCP
blishing conn
11WIZnet Co
t n-th Sour
s the Source
to be made
cket 0 Port =
0x
0x
n-th Destina
[0xFFFFFFF
as destinatio
_DHAR sets a
D_MAC comm
et n-th. At
s that is acq
destination h
command.
E-process of
f PPPoE-pro
in order to
by your PPP
PPoE) also sh
e PPPoE ser
ss which is s
configured
Socket 0 Des
0x400
0xDC
ket n-th
] [0x000000
as destinatio
oE server IP
but ignored
s IP address o
P SERVER", it
nection.
o., Inc. All rig
ce Port Re
Port numbe
before exec
= 5000(0x138
4004
13
ation Hardw
FFFFFF]
n hardware
s PPPoE serv
mand at the U
the TCP, UD
quired by AR
hardware ad
W5200, PPP
cess of W52
transmit or
PoE-process)
hould be set
ver hardwar
set by S0_DH
PPPoE info
stination Ha
07 0x
C 0
Destination
000]
on IP address
address tha
d in MACRAW
of "TCP SERV
t is internall
ghts reserve
egister) [R/W
er for each S
cuting the OP
88), configur
0x40
0x88
ware Address
address of S
ver hardware
UDP or IPRAW
DP and IPRA
RP-process o
ddress throug
PoE server ha
200 is not u
r receive th
), PPPoE serv
t as '1'.
re address b
HAR is appli
rmation is
ardware addr
x4008
0x00
n IP Ad
s of Socket
at is already
W mode. At
VER" before
ly set as IP a
ed.
W] [0x4004
Socket when
PEN comman
re as below,
005
8
s Register) [
Socket n-th.
e an address
W mode, it s
AW mode, Sn
of CONNECT
gh Sn_DHAR
ardware add
used, but im
e PPPoE pac
ver IP addre
before the O
ed to PDHA
internally v
ress = 08.DC
0x4009
0x01
ddress Reg
n-th. If SOC
known. It is
the TCP mo
performing C
address of "T
4+0x0n00-0
using TCP o
nd.
R/W] [0x400
Also, if SOC
that is alrea
sets the dest
n_DHAR is s
or SEND co
after succes
ress is not re
mplemented
cket, PPPoE
ess, and PPP
OPEN comma
R after perf
valid even
.00.01.02.10
0x400A
0x02
gister)[R/W]
KET0 is used
valid only in
ode, when o
CONNECT co
TCP CLIENT"
0x4005+0x0
or UDP mode
06+0x0n00-
CKET 0 is use
ady known.
tination hard
set as destin
mmand. The
ssfully perfo
equired to b
by yourself
E server hard
P session ID s
and. PPPoE s
forming the
after the C
0, configurat
0x40
0x0
][0x400C+0x
d as PPPoE m
n TCP, UDP,
operating as
ommand and
after succes
32
0n00]
e, and
-
ed for
dware
nation
e host
orming
be set.
f with
dware
should
server
OPEN
CLOSE
tion is
00B
0A
x0n00
mode,
IPRAW
s "TCP
when
ssfully
iEthernet W
5200
© Co
At th
UDP o
Ex)
Sn_D
[0x00
The d
PPPoE
or PP
At th
SERVE
At th
trans
At th
sessio
E
Sn_M
0x40
This
set b
mode
range
At t
There
divide
At th
opyright 201
e UDP or IPR
or IPRAW DAT
) In case of S
0x400
192 (0x
DPORT (Sock
0]
destination
E mode, S0_
PPoE mode, a
e TCP mode
ER" before p
he UDP mod
mitting UDP
he PPPoE mo
on ID (set by
Ex) In case of
MSS (Socke
013+0x0n00
s register is
by the other
e. When usin
e of MTU of P
Mode
TCP
UDP
IPRAW
MACRA
the IPRAW
efore, when
e the data in
e TCP or UD
11WIZnet Co
RAW mode, S
TA packet be
Socket 0 Des
0C
xC0)
ket n-th Des
port number
_DPORT0 sets
and ignored
e, when oper
performing th
de, the des
DATA packe
ode, the PP
y S0_DPORT0
f Socket 0 De
et n-th M
] [0x0000]
used for MS
r party when
ng PPPoE (M
PPPoE.
e
No
De
M
P
P
W
AW
or MACRAW
transmittin
nto the unit
P mode, if t
o., Inc. All rig
Sn_DIPR sets
efore perform
stination IP a
0x040D
168 (0xA8
tination Por
r is set in th
s PPP session
in other mod
rating as "TC
he CONNECT
tination por
ts before pe
P session ID
) is applied t
estination Po
0x4010
0x13
Maximum
S (Maximum
n TCP is act
MR(PPPoE)=‘1
ormal (MR(P
efault
MTU
1460
1472
1480
W, MTU is n
ng the data
of default M
ransmitting
ghts reserve
s as destinat
ming SEND o
address = 192
8)
rt Register)[
he Sn_DPOR
n ID that is a
des.
CP CLIENT", i
T command.
rt number i
erforming SEN
D that is alre
to PSIDR afte
ort = 5000(0x
Segment
m Segment Si
tivated in Pa
1’), the MTU
PPoE)=‘0’)
Range
1 ~ 1460
1 ~ 1472
0
ot processe
bigger than
MTU.
data is bigge
ed.
ion IP addre
r SEND_MAC
2.168.0.11, c
0x400E
0 (0x00)
[R/W][0x401
RT of Socket
already know
it listens for
is set in th
ND or SEND_
eady known
er performin
x1388), conf
0x4011
0x88
Size Regi
ize) of TCP,
assive Mode.
U of TCP or
PPPoE
Defau
MTU
1452
1464
1514
ed internally
n default MT
er than MTU,
ss to be use
command.
configure as
1
10+0x0n00-
n-th. If SOC
wn. It is valid
r the port nu
e Sn_DPORT
MAC comma
is set in th
ng the OPEN
igure as belo
ister)[R/W][
and the reg
It just sup
UDP mode i
E (MR(PPPoE
ult
U
R
2 1 ~
4 1 ~
1472
y, but defau
TU, the host
, W5200 auto
ed for transm
below.
0x040F
11 (0x0B)
-0x4011+0x0
CKET 0 is us
d only in TCP
umber of the
T to be use
and.
he S0_DPORT
command.
ow,
[0x4012+0x
gister display
ports TCP o
is assigned i
E)=‘1’)
Range
~ 1452
~ 1464
ult MTU is
t should ma
omatically d
33
mitting
0n00]
sed as
P, UDP
e "TCP
ed for
T. PPP
0n00-
ys MSS
or UDP
in the
used.
nually
divides
iEthernet W
5200
© Co
the d
Writt
Ex)
Sn_P
It is a
valid
comm
the p
but W
Proto
to on
Ex)
= 0
Sn_T
It set
the O
Sn_T
It set
OPEN
opyright 201
data into the
ten-Value and
) In case of S
ROTO (Sock
a 1 byte regi
only in IP
mand. When
protocol num
W5200 does n
ocol number
nline docume
) Internet Co
0x02
TOS (Socket n
ts the TOS(Ty
OPEN comma
TTL (Socket n
ts the TTL(Ti
N command.
11WIZnet Co
e unit of MTU
d peer's MSS
Socket 0 MSS
ket n-th IP Pr
ister that se
RAW mode,
Socket n-th
mber set in Sn
not support T
is defined in
ent (Uhttp://w
ontrol Messa
n-th IP Type
Type of Servic
and. Refer to
n-th IP Time
ime To Live)
Refer to Uhtt
o., Inc. All rig
U. MTU is ca
, MSS is set a
S = 1460(0x05
0x4012
0x05
rotocol Regi
ts the proto
and ignore
h is opened i
n_PROTO. Sn
TCP(0x06) an
n IANA(Intern
www.iana.or
age Protocol
e Of Service
ce) field of
o Uhttp://www
e To Live Reg
field of the
p://www.ian
ghts reserve
lled as MSS a
as smaller va
5B4), configu
ister) [R/W]
col number
ed in other
in IPRAW mo
n_PROTO can
nd UDP(0x11
net assigned
rg/assignmen
(ICMP) = 0x
Register) [R
the IP heade
w.iana.org/a
gister) [R/W
e IP header a
na.org/assig
ed.
at the TCP m
alue through
ure as below
0x4013
0xB4
[0x4014+0x
field of the
modes. Sn
ode, it trans
n be assigne
) protocol n
d numbers au
nts/protocol
x01, Internet
R/W] [0x401
er at the IP
assignments/
W] [0x4016+0
at the IP laye
gnments/ip-p
mode. By sel
TCP connec
w,
x0n00] [0x0
IP header at
_PROTO is
mits and rec
d in the rang
umber
uthority). Fo
-numbersU).
t Group Man
5+0x0n00]
layer. It sho
/ip-paramete
0x0n00] [0x
er. It should
parametersU.
lecting from
ction process
00]
t the IP laye
set before
ceives the d
ge of 0x00 ~
r the detail,
agement Pro
[0x00]
ould be set b
ersU.
x80]
be set befo
34
Host-
s.
r. It is
OPEN
ata of
0xFF,
refer
otocol
before
re the
iEthernet W
5200
© Co
Sn_R
It con
confi
Sn_RX
Va
M
Sn_T
It con
confi
Sn_TX
opyright 201
RXMEM_SIZE
nfigures the
gurable in
XMEM_SIZESU
alue
Memory size
Ex1) SOCK
Ex2) SOCK
Ex3) SOCK
Ex4) SOCK
TXMEM_SIZE
nfigures the
gurable in
XMEM_SIZESU
Ex1) SOCK
Ex2) SOCK
Ex3) SOCK
Ex4) SOCK
11WIZnet Co
(Socket n-th
internal RX
the size of
UM(sum of Sn_
0x01
1KB
KET 0 : 8KB,
KET 2 : 1KB,
KET 4 : 1KB,
KET 6 : 1KB,
(Socket n-th
internal TX
the size of
UM(summatio
KET 0 : 4KB,
KET 2 : 2KB,
KET 4 : 2KB,
KET 6 : 2KB,
o., Inc. All rig
h IP Time To
Memory size
1, 2, 4, 8
_RXMEM_SIZ
0x0
2KB
SOCKET 1 :
0xFE401E
0x08
SOCKET 3 :
0xFE421E
0x01
SOCKET 5 :
0xFE441E
0x01
SOCKET 7 :
0xFE461E
0x01
h IP Time To
Memory size
f 1, 2, 4, 8
n of Sn_TXM
SOCKET 1 :
0xFE401F
0x04
SOCKET 3 :
0xFE421F
0x02
SOCKET 5 :
0xFE441F
0x02
SOCKET 7 :
0xFE461F
0x02
ghts reserve
o Live Regist
e of each SO
8, and 16 K
E) of each SO
02
B
2KB
E
1KB
E
1KB
E
1KB
E
o Live Regist
e of each SO
8, and 16Kb
MEM_SIZE) of
1KB
F
1KB
F
2KB
F
2KB
F
ed.
ter) [R/W] [0
OCKET. RX M
Kbytes. 2Kby
OCKET shoul
0x04
4KB
0xFE411E
0x02
0xFE431E
0x01
0xFE451E
0x01
0xFE471E
0x01
ter) [R/W] [0
OCKET. TX M
bytes. 2Kby
each SOCKE
0xFE411F
0x01
0xFE431F
0x01
0xFE451F
0x02
0xFE471F
0x02
0x401E+0x0
emory size o
ytes is assig
ld be 16KB.
0x08
8KB
0x401E+0x0
emory size o
ytes is assig
T should be
0n00] [0x02
of each SOC
gned when
0x0F
16KB
0n00] [0x02
of each SOC
gned when
16KB.
35
]
KET is
reset.
2]
KET is
reset.
iEthernet W
5200
© Co
Sn_T
[0x08
It not
of So
to ch
same
data.
At th
recei
DATA
incre
uppe
byte(
corre
Ex)
Sn_T
[0x00
This
SEND
Sn_TX
There
When
0x442
0x442
Sn_T
0x40
This r
regist
0x462
0x462
Cauti
Sn_CR
Ex)
opyright 201
TX_FSR (Soc
800]
tifies the av
cket n-th. T
heck Sn_TX_
e as Sn_TX_F
.
he TCP mode
ved from the
packet. At
ased by the
r byte(0x402
(0x4021, 0x4
ect value.
) In case of 2
TX_RD (Sock
000]
register show
command
X_RD to th
efore, after
n reading th
22, 0x4522,
23, 0x4523,
TX_WR (So
025+0x0n00
register offe
ter, user sh
24, 0x4724)
25, 0x4725)
ion: This reg
R.
) In case of 2
11WIZnet Co
cket n-th TX
vailable size
The host can’
_FSR before
FSR, transmi
e, if the pe
e peer), Sn_
the other m
size of the
20, 0x4120, 0
4121, 0x422
2048(0x0800
ket n-th TX
ws the addre
of Socket
he Sn_TX_W
transmission
his register,
0x4622, 0x
0x4623, 0x47
cket n-th
] [0x0000]
ers the locati
ould read u
first, and
later to get
gister value
2048(0x0800
o., Inc. All rig
X Free Size
of the inter
’t write data
transmitting
t the data w
eer checks t
_TX_FSR is au
modes, whe
transmitted
0x4220, 0x43
21, 0x4321,
) in S0_TX_F
0x4020
0x08
Read Pointe
ess of the la
n-th Comm
WR and auto
n is finished,
user should
x4722) first,
723) later to
TX Writ
ion informat
upper byte
lower byte
the correct v
is changed
) in S0_TX_W
0x4024
0x08
ghts reserve
e Register)
rnal TX mem
a as a size bi
g data, and
with SEND o
the transmit
utomatically
en Sn_IR(SEN
d data.When
320, 0x4420
0x4421, 0x4
FSR,
er Register)
ast transmiss
mand Registe
omatically
, Sn_TX_RD
read upper
, and lower
o get the cor
te Pointer
tion to write
(0x4024, 0x
(0x4025, 0x
value.
after the se
WR,
ed.
[R] [0x402
mory (the byt
igger than S
if your dat
or SEND_MAC
tted DATA pa
y increased b
NDOK) is ‘1’
n checking th
, 0x4520, 0x
4521, 0x462
0x4021
0x00
) [R] [0x402
sion finishing
er, it transm
updates aft
and Sn_TX_W
r byte (0x40
r byte (0x40
rrect value.
Register)
the transmi
x4124, 0x422
x4125, 0x422
end comman
0x4025
0x00
20+0x0n00-
te size of tra
n_TX_FSR. T
a size is sm
C command
acket (if DAT
by the size of
, Sn_TX_FSR
his register,
x4620, 0x472
21, 0x4721)
22+0x0n00-
g in the TX m
mits data f
ter transmis
WR will have
022, 0x4122,
23, 0x4123,
[R/W] [
ission data. W
24, 0x4324,
25, 0x4325,
nd is success
-0x4021+0x0
ransmittable
Therefore, be
maller than o
after copyin
ATA/ACK pac
f that transm
R is automat
user should
20) first and
later to ge
-0x4023+0x0
memory. Wit
from the cu
ssion is fin
e the same v
, 0x4222, 0x
0x4223, 0x
[0x4024+0x
When readin
0x4424, 0x
0x4425, 0x
sfully execut
36
0n00]
data)
e sure
or the
ng the
cket is
mitted
tically
d read
lower
et the
0n00]
th the
urrent
ished.
value.
x4322,
x4323,
0n00-
ng this
x4524,
x4525,
ted to
iEthernet W
5200
© Co
But
cal
1.
2.
3.
Now,
that
opyright 201
t this value i
lculated as f
Socket n-th
Mask Addre
to the psed
The bitwise
the offset a
Two values
physical ad
write the tr
it exceeds t
11WIZnet Co
Figu
itself is not t
ollow.
h TX Base A
ess (hereafte
do code of th
e-AND opera
address(here
s get_offset
ddress(herea
ransmission
the TX mem
o., Inc. All rig
ure 6 Phys
the physical
ddress (here
er we'll call g
he Initializat
ation of two
eafter we'll c
t and gSn_T
fter, we'll c
data to get_
ory upper-bo
ghts reserve
sical Addre
address to r
eafter we'll c
gSn_TX_MAS
tion if detai
values, Sn_T
call get_offs
TX_BASE are
call get_star
_start_addre
ound of the
ed.
ess Calcula
read. So, the
call gSn_TX
SK) are calcu
l is needed.
TX_WR and g
set) in TX me
e added tog
rt_address).
ess as large a
socket whil
ation
e physical ad
X_BASE) and
ulated on TM
gSn_TX_MAS
emory range
ether to giv
as you want.
le writing. In
ddress should
Socket n-th
MSR value. Re
SK give resul
of the socke
ve result to
. (* There's a
n this case,
37
d be
h TX
efer
t to
et.
othe
a case
write
iEthernet W
5200
© Co
the
gSn_T
the S
give S
Refer
Sn_R
It info
As th
autom
recei
byte(
byte(
corre
Ex)
The t
Sn_R
[0x00
This
regist
0x462
0x462
Cauti
Sn_CR
Ex)
But
cal
1.
2.
3.
opyright 201
transmission
TX_BASE. Ne
Sn_TX_WR va
SEND comma
r to the psed
RX_RSR (RX R
orms the use
his value is
matically ch
ves data fro
(0x4026, 0x4
(0x4027, 0x4
ect value.
) In case of 2
total size of
RX_RD (Socke
000]
register offe
ter, user sh
28, 0x4728)
29, 0x4729)
ion: This reg
R.
) In case of 2
t this value i
lculated as f
Socket n-th
Mask Addre
to the pseu
The bitwise
offset addr
Two values
physical ad
11WIZnet Co
n data to
ext, write th
alue as much
and to Sn_CR
do code of th
Received Siz
er of the byt
internally
hanged by R
om the rem
4126, 0x422
4127, 0x422
2048(0x0800
this value ca
et n-th RX R
ers the loca
ould read u
first, and
later to get
gister value
2048(0x0800
itself is not t
ollow.
h RX Base A
ess (hereafte
udo code of
e-AND opera
ress(hereafte
s get_offset
ddress(herea
o., Inc. All rig
the upper-b
he rest of th
h as the data
R(Socket n-th
he transmiss
ze Register)
te size of the
calculated w
RECV comma
mote peer. W
26, 0x4326,
7, 0x4327,
) in S0_RX_R
0x4026
0x08
an be decide
Read Pointer
ation informa
upper byte
lower byte
the correct v
is changed
) in S0_RX_R
0x4028
0x08
the physical
Address (here
er we'll call g
the 5.1 Initia
ation of two v
er we'll call g
t and gSn_R
fter, we'll c
ghts reserve
bound, and
he transmissi
a size that i
h Command
sion part on
[R] [0x402
e received d
with the va
and of Sock
When readin
0x4426, 0x
0x4427, 0x4
RSR,
ed according
r Register) [
ation to rea
(0x4028, 0x
(0x4029, 0x
value. It has
after the se
RD,
address to r
eafter we'll
gSn_RX_MAS
alization if t
values, Sn_R
get_offset),
RX_BASE ar
call get_star
ed.
d change th
ion data.) Af
ndicates the
Register).
TCP Server m
6+0x0n00-0
ata in Intern
alues of Sn_
ket n-th Com
ng this regis
4526, 0x462
4527, 0x462
0x04027
0x00
to the value
[R/W] [0x40
ad the receiv
x4128, 0x422
x4129, 0x422
s a random v
end comman
0x4029
0x00
read. So, the
call gSn_RX_
SK) are calcu
the detail is
RX_RD and gS
in RX memo
e added to
rt_address).
he physical
fter that, be
e size of wri
mode if deta
0x4027+0x0
nal RX Memo
_RX_RD and
mmand Regi
ster, user sh
26, 0x4726)
27, 0x4727)
e of RX Memo
028+0x0n00
ving data. W
28, 0x4328,
29, 0x4329,
value as its in
nd is success
e physical ad
X_BASE) and
ulated on RM
needed.
Sn_RX_MASK
ory range of
ogether to g
address to
e sure to inc
ting data. F
ail is needed
n00] [0x000
ory of Socket
Sn_RX_WR,
ister (Sn_CR
hould read
first, and
later to ge
ory Size Reg
0-0x4028+0x
When readin
0x4428, 0x
0x4429, 0x
nitial value.
sfully execut
ddress should
Socket n-th
MSR value. Re
K give result
the socket.
give result
38
o the
crease
inally,
d.
00]
t n-th.
, it is
R) and
upper
lower
et the
ister.
x0n00]
ng this
x4528,
x4529,
ted to
d be
h RX
efer
the
the
iEthernet W
5200
© Co
Sn_RX_
(0xFE4
This
regist
0x462
0x462
Sn_IMR
It con
Sn_IM
set a
‘1’, I
signa
7
PRE
Bit
7
6
5
4
3
2
1
0
opyright 201
_WR (Socke
402B + 0xn0
register offe
ter, the user
2A, 0x472A)
2B, 0x472B)
Ex) In cas
R (Socket n-
nfigures the
MR correspon
s ‘1’, its cor
R(n) become
l is asserted
7 6
ECV PF
Symbol
PRECV
PFAIL
PNEXT
SENDOK
TIMEOUT
RECV
DISCON
CON
11WIZnet Co
et n-th RX W
00)][0x0000
ers the loca
r should read
first and lo
later to get
se of 2048(0x
th Interrupt
e interrupt o
nds to interr
rresponding
es ‘1’. At thi
low)
6
FAIL PN
Descript
Sn_IR(PR
Valid on
Sn_IR(PF
Valid on
Sn_IR(PN
Valid on
Sn_IR(SE
T Sn_IR(TI
Sn_IR(RE
Sn_IR(DI
Sn_IR(CO
o., Inc. All rig
rite Pointer
]
ation inform
d upper byte
ower bytes
the correct
x0800) in S0_
0x402A
0x08
t Mask Regis
of Socket n-t
rupt bit of Sn
bit of Sn_IR
s time, if IM
5 4
EXT SEND
tion
RECV) Interru
ly in case of
FAIL) Interru
ly in case of
NEXT) Interru
ly in case of
ENDOK) Inter
MEOUT) Inte
ECV) Interrup
ISCON) Inter
ON) Interrup
ghts reserve
r Register)[R
ation to wr
es (0x402A, 0
(0x402B, 0x
value.
_RX_WR,
ster)[R/W][0
th so as to
n_IR. If inte
R is set as ‘1
MR(n) is ‘1’, t
4
D_OK TIME
upt Mask
f ‘SOCKET = 0
pt Mask
f ‘SOCKET = 0
upt Mask
f ‘SOCKET = 0
rrupt Mask
errupt Mask
pt Mask
rupt Mask
pt Mask
ed.
R/W][(0xFE4
ite the rece
0x412A, 0x42
x412B, 0x422
0x402B
0x00
0x402C+0x0
notify to th
rrupt occurs
’. When the
the interrupt
3 2
EOUT RE
0’ & ‘S0_MR(
0’ & ‘S0_MR(
0’ & ‘S0_MR(
02A + 0xn00
eive data. W
22A, 0x432A,
2B, 0x432B,
n00][0xFF]
e host. Inte
in any SOCK
bits of Sn_I
t is issued to
2
ECV DISC
(P3:P0) = S0_
(P3:P0) = S0_
(P3:P0) = S0_
0) –
When readin
, 0x442A, 0x
0x442B, 0x
errupt mask
KET and the
IMR and Sn_
o the host. (
1
CON CO
_MR_PPPoE’
_MR_PPPoE’
_MR_PPPoE’
39
g this
x452A,
x452B,
bit of
bit is
IR are
‘nINT’
0
ON
iEthernet W
5200
© Co
Sn_FRA
0x0n10
It set
packe
fragm
OPEN
opyright 201
AG (Socket
00][0x4000
ts the Fragm
et fragment
mented, and
N command.
Ex) Sn_FR
11WIZnet Co
n-th Fragme
0]
ment field o
t at the IP
d not recom
.
RAG0 = 0x400
o., Inc. All rig
ent Register
of the IP hea
layer. Even
mmended ei
00 (Don’t Fra
0x402D
0x40
ghts reserve
r)[R/W][0x40
ader at the
n though Sn
ither. It sho
agment)
ed.
02D+0x0n00
IP layer. W5
n_FRAG is c
ould be conf
0x402E
0x00
0-0x402E+
5200 does n
configured,
figured befo
not support
IP data is
ore perform
40
the
not
ming
iEthernet W
5200
© Co
5
By
Thi
5.1
Basic S
For
1.
2.
3.
4.
For
Setting
Basic
It mu
①
②
③
④
opyright 201
Funct
setting some
is chapter de
Initial1
Setting
r the W5200
Mode Regis
Interrupt M
Retry Time
Retry Coun
r more inform
g network in
c network inf
ust be set the
SHAR(Source
It is prescri
hardware ad
the MAC ad
allocates the
Details on M
Uhttp://www
GAR(Gatewa
SUBR(Subnet
SIPR(Source
11WIZnet Co
tional D
e register an
escribes how
lization
operation, s
ster (MR)
Mask Register
e-value Regis
nt Register (R
mation of ab
nformation
formation se
e basic netw
e Hardware A
bed that the
ddresses (Eth
ddress alloc
e MAC addre
MAC address a
w.ieee.org/ U, U
ay Address Re
t Mask Regis
IP Address R
o., Inc. All rig
escripti
nd memory o
w it can be op
select and ut
r (IMR)
ter (RTR)
RCR)
bove register
etting for com
work informa
Address Regi
e source har
hernet MAC a
ation. The
ess to produc
allocation re
http://stand
egister)
ter)
Register)
ghts reserve
ons
operation, W
perated.
tilize approp
rs, refer to t
mmunication
ation.
ister)
rdware addr
address) in t
manufactur
ct.
efer to the w
dards.ieee.o
ed.
W5200 provide
priate registe
the “Register
n:
resses, whic
the Ethernet
rer which p
website as be
org/regauth/
es internet c
ers shown be
r Description
h is set by S
MAC layer. T
roduces the
elow.
oui/index.sh
connectivity.
elow.
ns.”
SHAR, use u
The IEEE ma
e network d
htmlU
41
.
unique
anages
device
iEthernet W
5200
© Co
Set soc
This s
each
In c
{
gS0
bas
Sn_
gS0
me
gS1
gS1
gS2
gS2
gS3
gS3
gS4
gS4
gS5
gS5
gS6
gS6
gS7
gS7
gS0
bas
Sn_
gS0
/*
gS3
gS6
}
opyright 201
cket memor
stage sets th
socket are f
case of, assi
0_RX_BASE =
se address of
_RXMEM_SIZE
0_RX_MASK =
emory
1_RX_BASE =
1_RX_MASK =
2_RX_BASE =
2_RX_MASK =
3_RX_BASE =
3_RX_MASK =
4_RX_BASE =
4_RX_MASK =
5_RX_BASE =
5_RX_MASK =
6_RX_BASE =
6_RX_MASK =
7_RX_BASE =
7_RX_MASK =
0_TX_BASE =
se address of
_TXMEM_SIZE
0_TX_MASK =
Same met
3_TX_BASE,
6_TX_BASE, g
11WIZnet Co
ry informatio
he socket tx/
fixed and sav
gn 2KB rx, tx
= 0x0000(Chi
f RX memory
E(ch) = (uint
= 2K – 1; //
= gS0_RX_BAS
= 2K – 1;
= gS1_RX_BAS
= 2K – 1;
= gS2_RX_BAS
= 2K – 1;
= gS3_RX_BAS
= 2K – 1;
= gS4_RX_BAS
= 2K – 1;
= gS5_RX_BAS
= 2K – 1;
= gS6_RX_BAS
= 2K – 1;
= 0x0000(Ch
f TX memory
E(ch) = (uint
= 2K – 1;
thod, set
gS3_TX_MAS
gS6_tx_MASK
o., Inc. All rig
on
/rx memory
ved in this st
x memory pe
ip base addr
y for SOCKET
t8 *) 2; // A
0x07FF, for g
SE + (gS0_RX
SE + (gS1_RX
SE + (gS2_RX
SE + (gS3_RX
SE + (gS4_RX
SE + (gS5_RX
SE + (gS6_RX
ip base add
y for SOCKET
t8 *) 2; // A
gS1_TX_BAS
SK, gS4_TX_
K, gS7_TX_BA
ghts reserve
information
tage.
er SOCKET
ress) + 0xC0
T 0
Assign 2K rx
getting offse
X_MASK + 1);
X_MASK + 1);
X_MASK + 1);
X_MASK + 1);
X_MASK + 1);
X_MASK + 1);
X_MASK + 1);
dress) + 0x80
T 0
Assign 2K rx
SE, gS1_TX_
BASE, gS4_T
ASE, gS7_TX_
ed.
. The base a
000(Internal
memory per
et address w
000(InternalT
memory per
_MASK, gS2
TX_MASK, gS
_MASK */
address and m
RX buffer a
SOCKET
within assigne
TX buffer ad
SOCKET
2_TX_BASE,
S5_TX_BASE,
mask addres
address); //
ed SOCKET 0
ddress); //
gS2_TX_MA
gS5_TX_MA
42
ss of
Set
0 RX
Set
ASK,
ASK,
iEthernet W
5200
© Coopyright 201
Figur
11WIZnet Co
re 7 Alloca
o., Inc. All rig
ation Inter
ghts reserve
rnal TX/RX
ed.
X memoryy of Socket
t n-th
43
iEthernet W
5200
© Co
5.2Afte
by ‘o
inde
com
5.2.The
using
tran
Meth
is div
The
conn
The
conn
opyright 201
Data C2er the initial
open’ the SO
ependently
munication
.1 TCP TCP is a co
g its own IP
smits and re
hods of mak
vided by tra
“TCP SERVE
nection SOC
“TCP CLIEN
nection (Act
11WIZnet Co
Communlization pro
OCKET of TC
and simu
method for
onnection-o
P address, p
eceives the
king the con
ansmitting t
ER” listens
KET by acce
NT” transmi
tive-open).
Figu
o., Inc. All rig
nicationscess, W5200
CP, UDP, IPR
ultaneously
r each mode
riented prot
port number
data by usin
nnection to
he connect-
to the conn
epting the tr
its the conn
re 8 TCP S
ghts reserve
s 0 can transm
RAW, and MA
usable 8
e will be intr
tocol. The T
r and destin
ng this SOCK
SOCKET are
-request (SY
nect-request
ransmitted
nect-request
SERVER an
ed.
mit and rec
ACRAW mode
SOCKETS.
roduced.
TCP make t
nation IP ad
KET.
e “TCP SERV
YN packet).
t from the
connect-req
t first to “T
nd TCP CL
ceive the da
e. The W520
In this
the connect
ddress, port
VER” and “T
“TCP CLIENT
quest (Passiv
TCP SERVER
IENT
ata with oth
00 supports
section,
tion SOCKET
t number. T
TCP CLIENT”
T”, and ma
ve-open).
R” to make
44
hers
the
the
T by
hen
”. It
akes
the
iEthernet W
5200
© Co
5.2.
SOCKE
SOCK
open
of th
num
exec
to SO
The
CLIE
opyright 201
1.1
ET Initializat
KET initializ
ning the SOC
he W5200, a
mber (Listen
cutes OPEN
OCK_INIT, th
SOCKET in
ENT.”The Ini
11WIZnet Co
TCP SERV
Figu
tion
zation is re
CKET. The S
and sets the
port numb
command.
he SOCKET i
nitialization
tialization p
o., Inc. All rig
VER
ure 9 TCP S
equired for
OCKET open
e protocol m
ber in “TCP
After the O
nitialization
process is
process of So
ghts reserve
SERVER O
TCP data
ning process
mode (Sn_MR
P SERVER”)
OPEN comma
n process is
identically
ocket n-th i
ed.
Operation F
communica
s selects one
R) and Sn_P
) in the se
and, if the s
completed.
y applied in
n TCP mode
Flow
tion. The i
e SOCKET fr
ORT0 which
lected SOC
status of Sn_
n “TCP SEV
e is shown b
initialization
rom 8 SOCK
h is source p
KET, and t
_SR is chan
VER” and “T
below.
45
n is
ETS
port
hen
ged
TCP
iEthernet W
5200
© Co
{
STA
Sn_
Sn_
Sn_
/* w
if (
}
LISTEN
Run
{
/*
Sn_
/* w
if
}
ESTABL
Whe
Sn_S
Sock
enab
Sock
Firs
{
if
/*
}
Sec
{
if
}
opyright 201
ART:
_MR = 0x01;
_PORT0 = sou
_CR = OPEN;
wait until Sn
Sn_SR != SOC
N
as “TCP SER
listen SOCKE
_CR = LISTEN
wait until S
(Sn_SR != SO
LISHMENT
en the statu
SR is change
ket n-th ma
bles the dat
ket n-th.
st method :
(Sn_IR(CON)
* In this case
IMR Sn_IMR
cond method
(Sn_SR == SO
11WIZnet Co
//
urce_port;
n_SR is chang
CK_INIT) Sn_
RVER” by LIS
ET */
N;
Sn_SR is cha
OCK_LISTEN)
us of Sn_SR
ed to SOCK_
akes a conn
ta communic
) == ‘1’) Sn
e, if the inte
and Sn_IR. *
d :
OCK_ESTABL
o., Inc. All rig
sets TCP mo
// se
// set
ged to SOCK_
_CR = CLOSE;
STEN comma
nged to SOC
) Sn_CR = CL
is SOCK_LIS
SYNRECV an
nection. Aft
cation. Ther
n_IR(CON) =
errupt of So
*/
LISHED) goto
ghts reserve
ode
ets source po
ts OPEN com
_INIT */
; goto START
and.
CK_LISTEN */
LOSE; goto ST
STEN, if it
nd transmits
ter it make
re are two m
‘1’; goto EST
ocket n-th is
ESTABLISHE
ed.
ort number
mmand
T;
TART;
receives a S
s the SYN/A
es the conn
methods to
TABLISHED st
activated,
D stage;
SYN packet
CK packet.
nection of S
confirm the
tage;
interrupt oc
, the status
After that,
Socket n-th
e connection
ccurs. Refer
46
s of
the
, it
n of
to IR,
iEthernet W
5200
© Co
ESTABL
Conf
Firs
{
if
/*
}
Sec
{
}
The
the
prior
due
not
Sn_I
ESTABL
In th
mem
data
cond
the R
{
/* f
le
/*
sr
/*
sr
/*
If(
{
opyright 201
LISHMENT :
firm the rec
st method :
(Sn_IR(RECV
* In this case
IMR Sn_IMR
cond Method
if (Sn_RX_R
First metho
host receive
r DATA pack
to the prior
recommend
R(RECV).
LISHMENT :
his process
mory. At the
a is larger
dition is hap
RX memory’
first, get the
n = Sn_RX_R
* calculate of
c_mask = Sn
* calculate st
c_ptr = gSn_
* if overflow
((src_mask +
/* copy upp
upper_size =
memcpy(src
11WIZnet Co
Check recei
ception of th
V) == ‘1’) Sn_
e, if the inte
and Sn_IR. *
d :
RSR0 != 0x000
od: set the
es the next
et, it canno
r Sn_IR(RECV
ded if the
Receiving p
, it process
e TCP mode,
than the R
ppened, the
’s free size i
e received si
RSR; // le
ffset address
_RX_RD&gSn
tart address(
_RX_BASE + s
SOCKET RX
+ len) > (gSn_
per_size byte
= (gSn_RX_M
c_ptr, dst_pt
o., Inc. All rig
ived data
he TCP data
_IR(RECV) =
errupt of So
*/
00) goto Rece
Sn_IR(RECV
t DATA packe
ot recognize
V) and next
host canno
process
ses the TCP
, the W5200
RX memory
W5200 hold
is larger tha
ize */
en is receive
s */
n_RX_MASK;
(physical add
src_mask;
memory */
_RX_MASK +
es of source_
MASK + 1) – sr
tr, upper_size
ghts reserve
a.
‘1’; goto Re
ocket n-th is
eiving Proce
V) to ‘1’ wh
et without
the Sn_IR(R
Sn_IR(RECV
ot perfectly
P data whi
0 cannot rec
free size
ds on to the
an the size o
ed size
// src_m
dress) */
// src_ptr
1))
_ptr to destin
rc_mask;
e);
ed.
ceiving Proc
activated,
ess stage;
enever you
setting the
RECV) of the
V) being ove
y process th
ch was rec
ceive the da
of Socket
e connection
of the receiv
mask is offse
r is physical s
nation_addr
ess stage;
interrupt oc
receive a D
Sn_IR(RECV
e next DATA
rlapped. So
he DATA pa
ceived in th
ata if the si
n-th. If the
n (pauses), a
ved data.
t address
start address
ess */
ccurs. Refer
DATA packet
V) as ‘1’ in
packet. Thi
o this metho
ackets of e
he Internal
ize of recei
e prior sta
and waits u
s
47
to IR,
t. If
the
is is
d is
ach
RX
ved
ated
ntil
iEthernet W
5200
© Co
}
el
{
}
/*
Sn
/*
Sn
}
ESTABL
The
Sock
size
of p
com
com
To c
leng
calc
com
is re
SEND
exam
Ex) Se
1
2
3
Note:
opyright 201
/* update d
dst_address
/* copy left
left_size = l
memcpy(gSn
se
copy len byt
memcpy(src
* increase Sn
n_RX_RD += l
* set RECV co
n_CR = RECV;
LISHMENT: C
size of the
ket n-th. If t
of MSS and
prior SEND c
pletion of
plete the SE
heck the co
gth is equal
ulated by t
mand. If the
etried for s
Dwhen the
mple of the
end Data Le
1) Execute
2) Calculat
If the ac
the left D
3) Retry SE
send dat
: Don’t cop
11WIZnet Co
destination_p
s += upper_si
t_size bytes o
len – upper_s
n_RX_BASE,
tes of source
c_ptr, dst_pt
n_RX_RD as le
len;
ommand */
;
Check send d
e transmit d
the size of
transmits.
command. A
prior SEND
END comma
ompletion of
l with the
he differen
e actual sen
sending the
sum of the
send proces
ngth Size= 1
e SEND Com
te the actua
ctual sent d
Data length=
END Comma
ta length.
py data until
o., Inc. All rig
ptr */
ize;
of gSn_RX_B
size;
dst_address
e_ptr to dest
tr, len);
ength of len
data / Send
data cannot
transmit da
To transmit
An error ma
command.
nd. So the u
f the SEND c
actual sent
ce of the S
nt data is les
left data.
e actual sen
ss is as belo
0,
mand with
al sent data
data length
= 3
and until th
the sum of
ghts reserve
BASE to desti
, left_size);
tination_add
*/
process
be larger t
ata is larger
t the next d
ay occur if
. The large
user should
command, i
t data leng
Sn_TX_RD be
ss than the
The send
nt data is e
ow
send data l
a length
is7 (=Sn_TX
e sum of th
the actual se
ed.
ination_addr
dress */
than assigne
than config
data, user m
the SEND c
er the data
properly div
it should be
gth. The ac
efore and a
send data le
process is
equal the se
length
X_RD_after_S
he actual se
ent data len
ress */
ed internal
gured MSS, i
must check t
command ex
size, the
vide the dat
e check that
ctual sent
after perform
ength, the S
therefore c
end data len
SEND-Sn_TX_
ent data len
gth is the se
TX memory
it is divided
the complet
xecutes bef
more time
ta to transm
t the send d
data length
ming the SE
SEND comm
completed
ngth. A sim
_RD_befor_S
ngth is same
end data leng
48
y of
d by
tion
fore
e to
mit.
data
h is
END
and
the
mple
SEND),
e the
gth.
iEthernet W
5200
© Co
{
/*
FRE
fr
if
/*
ds
/*
ds
/*
if
{
}
el
{
}
/* i
Sn
/* s
Sn_
/*
ret
/* i
re
}
opyright 201
* first, get th
EESIZE:
reesize = Sn_
(freesize<le
* calculate o
st_mask= Sn_
* calculate st
st_ptr = gSn_
* if overflow
( (dst_mask
/* copy up
upper_size
memcpy(sr
/* update
source_add
/* copy lef
left_size =
memecpy(
lse
/* copy len
memcpy(so
increase Sn_
n_TX_WR0 +=
set SEND com
_CR = SEND;
return real p
turn ( read_p
if return val
etry send lef
11WIZnet Co
he free TX m
_TX_FSR;
en) goto FREE
offset addres
_TX_WR0 &g
tart address
_TX_BASE + d
SOCKETTX m
k + len) > (gS
pper_size byt
e = (gSn_TX_
rc_addr, dst_
source_addr
dr += upper_
ft_size bytes
= len – upper_
source_addr
n bytes of so
ource_addr,
_TX_WR as le
= send_size;
mmand */
packet size *
ptr_after_sen
ue is not equ
t data witho
o., Inc. All rig
memory size *
ESIZE; //
s */
gSn_TX_MASK
(physical add
dst_mask;
memory */
n_TX_MASK
tes of source
_MASK + 1) –
_ptr, upper_
r*/
_size;
s of source_a
_size;
r, gSn_TX_BA
ource_addr t
dst_ptr, len)
ength of len
*/
nd - read_pt
ual len (len i
out copying d
ghts reserve
*/
len is send s
K; // dst
dress) */
// destina
+ 1) )
e_addr to de
dst_mask;
_size);
addr to gSn_
ASE, left_size
to destinatio
);
*/
tr_befor_sen
is send size)
data*/
ed.
size
t_mask is off
ation_addres
estination_ad
_TX_BASE */
e);
on_address */
d )
,
fset address
ss is physical
ddress */
/
l start addre
49
ess
iEthernet W
5200
© Co
ESTABL
Chec
rece
Firs
{
if
/*
}
Sec
{
if
}
ESTABL
Whe
pack
{
/* s
Sn_
}
ESTABL
Conf
Firs
{
if
/*
}
Sec
{
if
}
opyright 201
LISHMENT :
ck if the Dis
eption of FIN
st method :
(Sn_IR(DISCO
* In this case
IMR Sn_IMR
cond method
(Sn_SR == SO
LISHMENT :
en the user
ket, disconn
set DISCON c
_CR = DISCON
LISHMENT :
firm that th
st method :
(Sn_IR(DISCO
* In this case
IMR Sn_IMR
cond method
(Sn_SR == SO
11WIZnet Co
Check disco
sconnect-re
N packet as
ON) == ‘1’) S
e, if the inte
and Sn_IR. *
d :
OCK_CLOSE_
Check disco
does not
nect the con
command */
N;
Check close
e Socket n-t
ON) == ‘1’) g
e, if the inte
and Sn_IR. *
d :
OCK_CLOSED
o., Inc. All rig
onnect-requ
equest(FIN p
below.
Sn_IR(DISCON
errupt of So
*/
_WAIT) goto
onnect / disc
need data
nection SOC
ed
th is disconn
goto CLOSED
errupt of So
*/
D) goto CLOS
ghts reserve
uest(FIN pack
packet) has
N)=‘1’; goto
ocket n-th is
CLOSED stag
connecting p
communica
CKET.
nected or cl
D stage;
ocket n-th is
SED stage;
ed.
ket)
been receiv
CLOSED stag
activated,
ge;
process
ation with o
losed by DIS
activated,
ved. User ca
ge;
interrupt oc
others, or r
CON or clos
interrupt oc
an confirm
ccurs. Refer
receives a
se command
ccurs. Refer
50
the
to IR,
FIN
d.
to IR,
iEthernet W
5200
© Co
ESTABL
The
pack
requ
If it
and
SOCK
Firs
{
if
/*
}
Sec
{
if
}
SOCKE
It ca
close
{
/*
Sn_
/*
Sn_
}
opyright 201
LISHMENT: T
timeout c
ket), the
uest(FIN pac
cannot tra
RCR, the
K_CLOSED. C
st method :
(Sn_IR(TIME
* In this case
IMR Sn_IMR
cond method
(Sn_SR == SO
ET Close
an be used t
ed by TCPTO
* clear the re
_IR = 0xFF;
IR(n) = ‘1’;
* set CLOSE c
_CR = CLOSE
11WIZnet Co
Timeout
an occur b
DATA packe
cket) or its
ansmit the a
TCP final
Confirming
EOUT bit) ==
e, if the inte
and Sn_IR. *
d :
OCK_CLOSED
to close the
O or closed b
emained inte
command */
E;
o., Inc. All rig
by Connect
et or its
response(FI
above packe
timeout(TC
method of t
‘1’) Sn_IR(T
errupt of So
*/
D) goto CLOS
e Socket n-t
by host’s nee
errupts of So
ghts reserve
-request(SY
response(D
N/ACK pack
ets within ‘
PTO) occurs
the TCPTO is
TIMEOUT)=‘1
ocket n-th is
SED stage;
h, which dis
ed without d
ocket n-th*/
ed.
YN packet)
DATA/ACK p
ket) and tra
‘timeout’ w
s and the s
as below:
’; goto CLOS
activated,
sconnected
disconnect-p
or its resp
packet), th
ansmission a
which is conf
state of Sn
SED stage;
interrupt oc
by disconne
process.
ponse(SYN/A
he Disconne
all TCP pack
figured at R
n_SR is set
ccurs. Refer
ect-process
51
ACK
ect-
ket.
RTR
to
to IR,
, or
iEthernet W
5200
© Co
5.2.It is
SERV
CONNE
Tran
time
{
Sn_
S
Sn_
}
opyright 201
1.2 same as TC
VER”.
ECT
nsmit the c
eout such as
_DIPR0 = serv
Sn_DPORT0 =
_CR = CONNE
11WIZnet Co
TCP CLIECP server ex
Figu
connect-requ
s ARPTO, TCP
ver_ip;
= server_port
ECT;
o., Inc. All rig
ENT xcept ‘CONN
re 10 TCP
uest (SYN
PTO when ma
/* set
t; /* set
/* set
ghts reserve
NECT’ state
P CLIENT O
packet) to
ake the “con
t TCP SERVER
t TCP SERVER
t CONNECT c
ed.
e. User can
Operation
“TCP SERV
nnection SOC
R IP address*
R listen port
command */
refer to the
Flow
VER”. It m
CKET” with
*/
number*/
e “5.2.1.1 T
may occurs
“TCP SERVE
52
TCP
the
ER”
iEthernet W
5200
© Co
5.2.The
The
data
the
devi
com
prob
To a
or i
supp
com
5.2.The
at o
rece
supp
com
ARPT
dest
The
and
opyright 201
.2 UDP UDP is a Co
TCP protoc
agram comm
UDP does n
ces with th
munication
blems such a
void these
gnores the
ports unicas
munication
2.1 unicast is o
one time. O
eivable desti
pose that t
munication
TO can also
tinations A,
broadcast
C at one ti
11WIZnet Co
onnection-le
col guarante
munication w
not use “co
he known ho
with many
as loss of tr
problems an
unwanted
st, broadca
flow.
F
Unicast aone method
n the other
inations by
the user tr
transmits e
o occur wh
B and C. Use
communica
me by using
o., Inc. All rig
ess protocol.
ees reliable
which has n
onnection S
ost IP addre
y others by
ransmitted d
nd guarante
data whic
ast, and m
Figure 11
and Broad of UDP com
r hand, the
using ‘broad
ransmits da
each destina
hen the us
er cannot tr
tion can sim
g “255.255.
ghts reserve
. It commun
data comm
no guarante
SOCKET,” it
ess and por
y using just
data, unwa
ee reliability
ch is receiv
multicast co
UDP Oper
dcast mmunication
broadcast
dcast IP add
ata to dest
ation A, B, a
ser gets th
ransmit data
multaneous
255.255” or
ed.
nicates with
munication, b
ees of data
can comm
t number. T
t one SOCK
nted data r
y, the host r
ved from o
mmunicatio
ration Flow
n. It transmi
communica
dress (255.25
tination A,
and C at ea
he destinati
a to destina
ly transmit
r “local add
out “connec
but the UDP
communica
municate wit
This is a gre
ET, but also
received fro
retransmits
thers. The
on. It follow
w
ts data to o
tion transm
55.255.255)
B, and C
ch time. At
ion hardwa
tions which
data to de
dress | (~su
ction SOCKE
P protocol u
ation. Beca
th many ot
eat advanta
o it has m
om others, e
damaged d
UDP proto
ows the be
one destinat
mits data to
)’. For exam
C. The unic
t this time,
are address
have ARPTO
estination A
bnet addres
53
ET.”
uses
ause
ther
age;
any
etc.
data
ocol
low
tion
all
mple,
cast
the
of
O.
A, B
ss)”
iEthernet W
5200
© Co
IP a
abou
Note
=> T
oper
ex>
“222
Descr
HOST
Bit Co
Bitwi
Broad
SOCKE
For
SOCK
the
SOCK
the
SOCK
{
STA
Sn_
Sn_
Sn_
/* w
if (
}
Check
Chec
data
beca
Firs
{
if
opyright 201
ddress. At
ut destinatio
e: Broadcast
The Broadca
ration betwe
If IP:”222.
2.98.173.255
ription
T IP
omplement S
se OR
dcast IP
ET Initializat
the UDP d
KET. The SO
8 SOCKETS
KET and set
OPEN comm
K_UDP. Then
ART:
_MR = 0x02;
_PORT0 = sou
_CR = OPEN;
wait until Sn
Sn_SR != SOC
received da
ck the rece
a via TCP co
ause of the s
st method :
(Sn_IR(RECV
11WIZnet Co
this time, t
on A, B and
t IP
ast IP addr
een the bit
.98.173.123
5”
Subnet mask
tion
data commu
OCKET open
of W5200,
t the source
mand. Afte
n the SOCKE
urce_port;
n_SR is chang
CK_UDP) Sn_
ata
ption of UD
ommunicati
same reason
V) == ‘1’) Sn_
o., Inc. All rig
there is no
C, and also
ess can be
complemen
” and the
Decima
222.098
k 000.000
-
222.098
unication, S
process is
then set th
port numbe
r the OPEN
ET initializat
/* set
/* set
/* set
ged to SOCK_
_CR = CLOSE
DP data from
on. It is str
ning from TC
_IR(RECV) =
ghts reserve
need to ge
ARPTOis not
obtained
nt of the sub
subnet ma
al
8.173.123
0.000.255
8.173.255
SOCKET init
as followed
he protocol
er Sn_PORT0
N command
tion is comp
ts UDP mode
ts source por
ts OPEN com
_UDP */
; goto START
m destinatio
rongly recom
CP. Please re
‘1’; goto Re
ed.
et the dest
t occurred.
by perform
bnet mask a
ask:“255.255
Binary
11011110.01
00000000.00
-
11011110.01
tialization i
. At first, c
mode (Sn_
0 for commu
d, the state
plete.
e */
rt number */
mmand */
T;
on. User ca
mmended t
efer to the
ceiving Proc
tination har
ing a bit-w
nd the host’
5.255.0”, b
1100010.101
0000000.000
1100010.101
s required;
choose one S
_MR(P3:P0))
unication. F
e of Sn_SR
an also chec
o use the s
“5.2.1.1 TC
ess stage;
rdware addr
wise logical
’s IP address
broadcast IP
01101.01111
000000.11111
01101.11111
; it opens
SOCKET am
of the cho
Finally, exec
is changed
ck for recei
second met
CP SERVER”.
54
ress
OR
s.
P is
1011
1111
1111
the
ong
osen
cute
d to
ved
hod
iEthernet W
5200
© Co
/*
}
Sec
{
}
Receiv
Proc
The
The
INFO
DATA
tran
SOCK
rece
If th
rece
{
/*
sr
/*
sr
/*
he
/*
if
{
opyright 201
* In this case
IMR Sn_IMR
cond Method
if (Sn_RX_R
ving process
cess the rece
structure of
received UD
O contains t
A packet. Th
smitter by
KET by usin
eption by an
e DATA size
eive that DAT
* calculate o
rc_mask = Sn
* calculate st
rc_ptr = gSn_
* read head i
eader_size =
* if overflow
( (src_mask
/* copy up
upper_size
memcpy(sr
11WIZnet Co
e, if the inte
and Sn_IR. *
d :
RSR0 != 0x000
eived UDP d
f received U
Figure
DP data con
transmitter’
he UDP can
transmitter
ng “255.255
alysis of tra
of Socket n
TA and also
offset addres
n_RX_RD &g S
tart address
_RX_BASE + s
information
= 8;
SOCKET RX
+ header_si
pper_size byt
e = (gSn_RX_
rc_ptr, head
o., Inc. All rig
errupt of So
*/
00) goto Rece
data in Inter
UDP data is a
e 12 The R
nsists of 8by
s informatio
receive UD
r’s informat
.255.255” I
ansmitter’s i
n-th is large
cannot rece
s */
Sn_RX_MASK
(physical add
src_mask;
(8 bytes) */
memory */
ze) > (gSn_R
tes of src_pt
_MASK + 1) –
er, upper_siz
ghts reserve
ocket n-th is
eiving Proce
rnal RX mem
as below.
Received U
ytes PACKET
on (IP addr
DP data from
tion of PACK
IP address.
information
r than Inter
eive fragme
K; // src_
dress) */
// src_ptr
RX_MASK + 1
tr to header_
src_mask;
ze);
ed.
activated,
ess stage;
mory.
UDP data F
-INFO, and
ress, Port nu
m many oth
KET-INFO. I
So the hos
.
rnal RX mem
nted DATA.
_mask is offs
r is physical s
) )
_addr*/
interrupt oc
Format
DATA packet
umber) and
hers. User c
t also rece
t should ign
mory free siz
set address
start address
ccurs. Refer
t. The PACK
d the length
can classify
eives broadc
nore unwan
ze, user can
s
55
to IR,
KET-
h of
the
cast
nted
nnot
iEthernet W
5200
© Co
}
el
{
}
/*
sr
/*
pe
pe
ge
/*
if
{
}
el
{
opyright 201
/* update
header_ad
/* copy lef
left_size =
memcpy(g
/* update
src_mask =
lse
/* copy he
memcpy(sr
/* update
src_mask +
* update src_
rc_ptr = gSn_
* save remot
eer_ip = hea
eer_port = h
et_size = hea
* if overflow
( (src_mask
/* copy up
upper_size
memcpy(sr
/* update
destination
/* copy lef
left_size =
memcpy(g
lse
/* copy len
memcpy(sr
11WIZnet Co
header_addr
ddr += upper_
ft_size bytes
= header_size
Sn_RX_BASE
src_mask */
= left_size;
eader_size by
rc_ptr, head
src_mask */
+= header_si
_ptr */
_RX_BASE + s
te peer infor
der[0 to 3];
eader[4 to 5
ader[6 to 7];
SOCKET RX
+ get_size)
pper_size byt
e = (gSn_RX_
rc_ptr, desti
destination_
n_addr += up
ft_size bytes
= get_size – u
Sn_RX_BASE
n bytes of sr
rc_ptr, desti
o., Inc. All rig
r*/
_size;
s of gSn_RX_
e – upper_siz
, header, lef
ytes of get_s
er, header_s
ze;
src_mask;
mation & rec
5];
memory */
> (gSn_RX_M
tes of src_pt
_MASK + 1) –
nation_addr,
_addr*/
pper_size;
s of gSn_RX_
upper_size;
, destination
rc_ptr to des
nation_addr,
ghts reserve
_BASE to hea
ze;
ft_size);
start_addres
size);
ceived data
MASK + 1) )
tr to destina
src_mask;
r, upper_size
_BASE to des
n_addr, left_
stination_add
r, get_size);
ed.
ader_address
ss to header_
size */
tion_address
);
tination_add
_size);
dress */
s */
_address */
s */
dress */
56
iEthernet W
5200
© Co
}
/* i
Sn
/* s
Sn_
}
opyright 201
increase Sn_
n_RX_RD = Sn
set RECV com
_CR = RECV;
11WIZnet Co
_RX_RD as le
n_RX_RD + h
mmand */
o., Inc. All rig
ngth of len+
header_size +
ghts reserve
+ header_size
+ get_size;
ed.
e */
57
iEthernet W
5200
© Co
Check
The
mem
tran
{
/*
FRE
fr
if
/*
/*
ds
/*
ds
/*
if
{
el
{
}
/* i
Sn
opyright 201
send data /
size of DAT
mory. If it
smitted. Th
* first, get th
EESIZE:
reesize = Sn_
(freesize<le
* Write the v
Register(Sn_
Sn_DIPR0 =
Sn_DPORT0
* calculate o
st_mask = Sn
* calculate st
st_ptr = gSn_
* if overflow
( (dst_mask
/* copy up
upper_size
memcpy(sr
/* update
source_add
/* copy lef
left_size =
memcpy(sr
lse
/* copy len
memcpy(sr
increase Sn_
n_TX_WR0 +=
11WIZnet Co
/ sending pro
TA that the
is larger t
he Sn_DIPR0
he free TX m
_TX_FSR0;
en) goto FREE
value of rem
_DIPR), Sock
remote_ip;
= remote_p
offset addres
n_TX_WR0 &
tart address
_TX_BASE + d
SOCKETTX m
k + len) > (gS
pper_size byt
e = (gSn_TX_
rc_ptr, desti
source_addr
dress += upp
ft_size bytes
= send_size –
rc_ptr, desti
n bytes of so
rc_ptr, desti
_TX_WR0 as
= len;
o., Inc. All rig
ocess
user wants
than MTU,
is set “255.
memory size *
ESIZE; //
mote_ip, rem
ket n-th Dest
ort;
s */
gSn_TX_MAS
(physical add
dst_mask;
memory */
n_TX_MASK
tes of source
_MASK + 1) –
nation_addr,
ress*/
per_size;
s of source_a
upper_size;
nation_addr,
ource_addres
nation_addr,
length of len
ghts reserve
s to transm
it is autom
.255.255.25
*/
/ len is send
mote_port t
tination Port
SK; // ds
dress) */
// dst_ptr
+ 1) )
e_address to
dst_mask;
r, upper_size
address to gS
r, left_size);
ss to dst_ptr
r, len);
n */
ed.
it cannot b
matically d
5” when use
size
to the Socke
Register(Sn_
st_mask is of
r is physical
dst_ptr */
);
Sn_TX_BASE
r */
be larger th
ivided by M
er wants to
et n-th Desti
_DPORT). */
ffset address
start addres
*/
han Internal
MTU unit
broadcast.
ination IP Ad
s
ss
58
TX
and
ddress
iEthernet W
5200
© Co
/*
Sn_
}
Check
To tr
The
the
tran
Firs
{
/* c
whi
{
/
if
}
Sn_
}
Sec
{
If (
If (
/*
Interr
(Sn_I
}
Check
If us
{
/*
Sn_
/*
Sn_
}
opyright 201
* set SEND co
_CR = SEND;
complete se
ransmit the
larger the
user must p
smits UDP d
st method :
check SEND c
ile(Sn_IR(SEN
/* check ARP
f (Sn_IR(TIM
_IR(SENDOK)
cond method
(Sn_CR == 0x
(Sn_IR(TIMEO
In this case
rupt Registe
R). */
Finished / S
ser doesn’t n
* clear remai
_IR = 0x00FF
IR(n) = ‘1’;
* set CLOSE c
_CR = CLOSE
11WIZnet Co
ommand */
ending / Tim
next data,
data size, t
properly div
data. If ARPT
command co
NDOK)==‘0’)
PTO */
EOUT)==‘1’)
= ‘1’; /* cle
d :
x00) transmis
OUT bit) == ‘
e, if the int
er(IR), Inter
SOCKET clos
need the co
ined interrup
F;
command */
E;
o., Inc. All rig
meout
user must c
the more tim
vide the da
TO occurs, th
ompletion */
/* wait int
Sn_IR(TIMEO
ear previous
ssion is comp
1’) goto nex
terrupt of S
rrupt Mask
se
mmunicatio
pts */
ghts reserve
check that t
me to comp
ata to transm
he UDP data
terrupt of SE
OUT)=‘1’; go
interrupt of
pleted.
xt stage;
Socket n-th
Register (IM
on any more
ed.
the prior SEN
plete the SE
mit. The AR
transmissio
END complet
oto Next stag
SEND compl
is activated
MR) and Soc
e, close the
ND comman
END comma
RPTO can oc
on has failed
tion */
ge;
letion */
d, interrupt
cket n-th I
Socket n-th
nd is comple
and. Therefo
ccur when u
d.
occurs. Ref
nterrupt Re
.
59
eted.
ore,
user
fer to
egister
iEthernet W
5200
© Co
5.2.The
the
regis
mult
rece
to m
hard
the
be c
The
“01:
class
http
Whe
‘Gro
addr
“01:
In t
(auto
the
mess
perio
The
versi
SOCKE
Choo
Sn_D
grou
num
exec
com
{
STA
/*
Sn
Sn
Sn
opyright 201
2.2 broadcast
multicast
stered at a
ticast-group
eive the DAT
multicast-gro
dware addre
‘Group hard
changed.
‘Group h
00:5e:00:00
s IP address
p://www.ian
en selecting
oup IP addre
ress’ to
00:5e:01:01
the W5200
omatically)
“Join” me
sage is inte
odically and
W5200 sup
ion, the hos
ET Initializat
ose one SOC
DHAR0 to ‘M
up IP addres
mber.’ Set t
cute OPEN c
mand, the S
ART:
* set Multica
n_DHAR0 = 0
n_DHAR1 = 0
n_DHAR2 = 0
11WIZnet Co
Multicastcommunica
communica
multicast-g
p. If user tra
TA for A. To
oup by usin
ess,’ ‘Group
dware addre
hardware
0:00”to “01
(From “224
na.org/assig
, the upper
ess’ must be
“244.1.1.11
1:0b.” Pleas
0, IGMP pr
processed.
essage is in
ernally trans
d internally
port IGMP v
st processes
tion
CKET for mu
Multicast-gro
ss.’ Then s
he Sn_MR(P
command. If
SOCKET initi
st-Group inf
0x01; /*
0x00;
0x5E;
o., Inc. All rig
t tion commu
ation comm
roup. Suppo
ansmits dat
use multica
ng IGMP pro
IP address,
ess’ and ‘Gro
address’ i
:00:5e:7f:ff
4.0.0.0” to “
nments/mu
r 23bit of 6
e the same.
,” the ‘
se refer to t
rocessing t
When the u
nternally tra
smitted. Aft
transmitted
version 1 an
IGMP direc
ulticast com
oup hardwa
et the Sn_P
P3:P0) to U
f the state o
ialization is
ormation */
set Multicas
ghts reserve
unicates wit
municates
ose that A, B
ta to multic
ast commun
otocol. The
,’ and ‘Grou
oup IP addre
is selected
f:ff”) and th
“239.255.25
ulticast-addr
6bytes ‘Grou
. For examp
‘Group ha
the “RFC111
to register
user opens t
ansmitted.
ter the SOC
d when the u
nd version 2
tly by using
mmunication
are address’
PORT0 and
UDP and se
of Sn_SR is c
completed
st-Group H/W
ed.
th many an
with many
B, and C are
cast-group (
nication, the
e multicast-
up port num
ess.’ But the
d at the
he ‘Group IP
55.255”, ple
resses U).
up hardware
ple, if the u
rdware ad
2” (Uhttp://
the mult
the Socket n
If the use
CKET opens,
user commu
2 only. If us
the IPRAW
among 8 SO
’ and set th
Sn_DPORT0
et the Sn_M
changed to
.
W address(01
d unspecifie
y specified
e registered
contains A)
e destinatio
-group cons
mber.’ User
e ‘Group po
assigned
P address’ is
ase refer to
e address’ a
user selects
ddress’ is
www.ietf.or
icast-group
n-th with m
r closes it,
the “Repo
unicates.
ser wants u
mode SOCK
OCKETS of W
he Sn_DIPR0
0 to ‘Multic
MR(MULTI) t
SOCK_UDP a
1:00:5e:01:0
ed others.
d others w
d at a specif
), B and C a
on list regist
sists of ‘Gro
cannot cha
rt number’
range (Fr
s selected in
o the websit
and the 4by
s the ‘Group
selected
rg/rfc.htmlU)
is intern
multicast mo
, the “Lea
ort” message
use an upda
KET.
W5200. Set
0 to ‘Multica
cast-group p
to ‘1.’ Fina
after the OP
01:0b) */
60
But
who
fied
also
ters
oup
nge
can
rom
n D-
te;
ytes
p IP
to
).
ally
ode,
ve”
e is
ated
the
ast-
port
ally,
PEN
iEthernet W
5200
© Co
Sn
Sn
Sn
Sn
Sn
Sn
Sn
Sn
Sn
Sn
Sn
/*
if
}
Check
Refe
Receiv
Refe
Check
Since
user
Ther
com
{
/*
FRE
fr
if
/*
ds
/*
ds
/*
opyright 201
n_DHAR3 = 0
n_DHAR4 = 0
n_DHAR5 = 0
n_DIPR0 = 21
n_DIPR1 = 1;
n_DIPR2 = 1;
n_DIRP3 = 11
n_DPORT0 =
n_PORT0 = 0x
n_MR = 0x02
n_CR = OPEN
* wait until S
(Sn_SR != SO
received da
er to the “5.
ving process
er to the “5.
send data /
e the user
r does not
refore, copy
mand.
* first, get th
EESIZE:
reesize = Sn_
(freesize<le
* calculate o
st_mask = Sn
* calculate st
st_ptr = gSn_
* if overflow
11WIZnet Co
0x01;
0x01;
0x0B;
1; /*
;
0x0BB8; /*
x0BB8; /*
| 0x80; /* s
N; /*
Sn_SR is chan
OCK_UDP) Sn
ata
.2.2.1 Unica
.2.2.1 Unica
/ Sending Pro
sets the in
need to se
y the trans
he free TX m
_TX_FSR;
en) goto FREE
offset addres
n_TX_WR0 &
tart address
_TX_BASE + d
SOCKETTX m
o., Inc. All rig
set Multicas
set Multicas
set SourcePo
et UDP mode
set OPEN co
nged to SOCK
n_CR = CLOSE
ast & Broadc
ast & Broadc
ocess
nformation
et IP addres
smission da
memory size *
ESIZE; //
s */
gSn_TX_MAS
(physical add
dst_mask;
memory */
ghts reserve
st-Group IP a
st-GroupPort
Port number(
e & Multicas
ommand */
K_UDP */
E; goto STAR
cast.”
cast.”
about mult
ss and port
ata to inter
*/
/ len is send
SK; // ds
dress) */
// dst_ptr
ed.
address(211.
t number(300
3000) */
st on Socket
RT;
ticast-group
t number f
rnal TX me
size
t_mask is of
r is physical
1.1.11) */
00) */
n-th Mode Re
at SOCKET
or destinati
mory and e
fset address
start addres
Register */
T initializati
ion any mo
executes SE
s
ss
61
ion,
ore.
END
iEthernet W
5200
© Co
if
{
}
el
{
}
/* i
Sn
/* s
Sn_
}
Check
Since
occu
{
/* c
whi
S0_
}
Check
Refe
opyright 201
( (dst_mask
/* copy up
upper_size
wizmemcp
/* update
source_add
/* copy lef
left_size =
wizmemcp
lse
/* copy len
wizmemcp
increase Sn_
n_TX_WR0 +=
set SEND com
_CR = SEND;
complete se
e the host
ur.
check SEND c
ile(S0_IR(SEN
_IR(SENDOK)
finished / S
er to the “5.
11WIZnet Co
k + len) > (gS
pper_size byt
e = (gSn_TX_
py((0x000000
source_addr
dr += upper_
ft_size bytes
= len – upper_
py( source_ad
n bytes of so
py( source_ad
_TX_WR as le
= send_size;
mmand */
ending / Tim
manages all
command co
NDOK)==‘0’)
= ‘1’;
SOCKET close
.2.2.1 Unica
o., Inc. All rig
n_TX_MASK
tes of source
_MASK + 1) –
0 + source_ad
r*/
_size;
s of source_a
_size;
ddr, gSn_TX_
ource_addr t
ddr, dst_ptr,
ength of len
meout
l protocol p
ompletion */
; /* wait in
/* clear p
e
ast & Broadc
ghts reserve
+ 1) )
e_addr to de
dst_mask;
ddr), (0xFE0
addr to gSn_
_BASE, left_s
to dst_ptr */
len);
*/
process for d
nterrupt of S
previous inte
cast.”
ed.
estination_ad
0000 + dst_pt
_TX_BASE */
size);
data commu
SEND comple
errupt of SEN
ddress */
tr), upper_si
unication, t
etion */
ND completio
ize);
timeout can
on */
62
nnot
iEthernet W
5200
© Co
5.2.IPRA
prot
acco
in W
IPRA
must
prot
(Uhttp
conf
supp
IPRA
SOCK
IGMP
SOCKE
Sele
mod
‘OPE
{
STA
/* s
/*
opyright 201
.3 IPRAWAW is data
ocol layers.
ording to the
W5200 by ha
AW by openi
t set the pro
ocol num
p://www.ia
figured to S
port TCP (0
AW mode on
KET cannot
P.
ET Initializat
ct the SOCK
e and execu
EN’ comman
ART:
sets Protoco
* The protoco
11WIZnet Co
W communica
. IPRAW sup
e protocol n
ardware logi
ing the Soc
otocol numb
mber is
ana.org/assi
Sn_PROTO
x06) or UD
nly allows th
receive una
Fi
tion
KET and set
ute ‘OPEN’
nd, the SOCK
ol number */
ol number is
o., Inc. All rig
ation using
ports IP lay
number. The
ic. But if th
ket n-th to
ber field of
defined
gnments/pr
before ‘SOC
P (0x11) pr
he communic
assigned pro
gure 13 IP
t the protoc
command. I
KET initializ
s used in Prot
ghts reserve
TCP, UDP,
yer protocol
e ‘ping’ of IC
he user nee
o IPRAW. In
the IP head
by I
rotocol-num
CKET open.
rotocol num
cation of an
otocol data e
PRAW Ope
col number.
If the Sn_SR
zation is com
tocol Field o
ed.
and IP laye
such as ICM
CMP or IGMP
ds, the hos
the case of
er to what t
IANA. Re
mbersU). The
.’ In IPRAW
mber. The S
n assigned p
except assig
eration Flo
Then set th
R is changed
mpleted.
of IP Header.
ers, which
MP (0x01) an
P v1/v2 is al
t can direct
f using IPRA
the user wa
efer to
protocol nu
W mode, W5
SOCKET com
rotocol num
gned protoco
ow
he Sn_MR(P3
d to SOCK_IP
*/
are the low
nd IGMP (0x
lready includ
tly process
AW mode, u
nts to use. T
the w
umber must
5200 does
mmunication
mber. The IC
ol data such
3:P0) to IPR
PRAW after
63
wer
x02)
ded
the
user
The
web
t be
not
n of
CMP
h as
RAW
the
iEthernet W
5200
© Co
Sn
/*
Sn
/* s
Sn
/*
if
}
Check
Refe
Receiv
Proc
rece
The
cont
pack
proc
“5.2
free
fragm
Chec
The
mem
of U
Broa
Comple
Same
Check
Same
opyright 201
n_PROTO = p
* sets IP raw
n_MR = 0x03
sets OPEN co
n_CR = OPEN
* wait until S
(Sn_SR != SO
received da
er to the “5.
ving process
cess the IPR
eived IPRAW
IPRAW dat
tains inform
ket. The da
cessing the
2.2.1 Unicas
size of So
mented DAT
cks send data
size of DA
mory and de
DP data exc
adcast.”
ete sending
e as UDP, pl
finished / S
e as UDP, pl
11WIZnet Co
protocol_num
mode */
;
ommand */
N;
Sn_SR is chan
OCK_IPRAW)
ata
.2.2.1 Unica
RAW data w
data is as b
Figure
ta consists
mation about
ata receptio
port numb
st & Broadca
ocket n-th,
TA.
a / Sending
ATA which u
efault MTU.
cept setting
/ Timeout
lease refer t
SOCKET close
lease refer t
o., Inc. All rig
m;
nged to SOCK
Sn_CR = CLO
ast & Broadc
which is rec
below.
14 The re
6 bytes PAC
t the transm
on of IPRAW
ber of the t
ast.” If the
user canno
process
user wants
The transm
g ‘Destinatio
to the “5.2.
ed
to the “5.2.
ghts reserve
K_IPRAW */
OSE; goto ST
cast.”
ceived in in
eceive IPR
CKET-INFO
mitter (IP a
AW is the s
transmitter
transmitted
ot receive
to transmit
mission of IPR
on port num
2 UDP.”
2 UDP.”
ed.
TART;
ternal RX m
RAW data
and DATA p
address) and
ame as UD
in UDP PA
d DATA size
that DATA
t cannot be
RAW data is
mber’. Refer
memory. Th
Format
packet. The
d the length
DP data rec
ACKET-INFO.
is larger th
and also c
e larger tha
s the same a
to the “5.2
he structure
e PACKET-IN
h of the DA
ception exc
. Refer to
han RX mem
cannot rece
an Internal
as transmiss
2.2.1 Unicas
64
e of
NFO
ATA-
cept
the
mory
eive
TX
sion
st &
iEthernet W
5200
© Co
5.2.The
laye
The
MAC
but
SOCK
‘Har
user
user
the o
the
prot
Ethe
shou
shou
‘des
Ethe
opyright 201
.4 MACRA MACRAW co
r protocol t
MACRAW m
RAW mode,
it can also
KET1~7 can
rdwired TCP
r wants mor
r wants high
others shou
limited cap
ocols excep
ernet packet
uld use the
uld basicall
tination har
ernet MAC.
11WIZnet Co
AW ommunicatio
o suit the h
mode can on
not only c
o be used
n be used
P/IP stack’ a
re SOCKETs
h performan
ld be using
pacity of 8
pt using in
t communic
‘Software
ly contain
rdware add
Fig
o., Inc. All rig
on is based
ost’s needs.
nly be used
can it use th
as a NIC (
with ‘Softw
and ‘Softwar
beyond the
nce should
‘Software T
SOCKETS.
n SOCKET1~
cation (ther
TCP/IP stac
the 6byte
ress’ and 2
ure 15 MA
ghts reserve
on Etherne
.
with a SOC
he SOCKET1
(Network In
ware TCP/IP
re TCP/IP st
supported
be utilizing
TCP/IP stack
The SOCKE
~7. Since th
re is no othe
ck’ to proc
es of ‘Sou
bytes of ‘E
ACRAW Op
ed.
et MAC, and
CKET. If the
1~7 in the ‘
nterface Co
P stack’. Si
tack’, it call
8 SOCKETS,
g the ‘‘Hard
k’ by MACRA
T of MACRA
he MACRAW
er processin
ess the pro
rce hardwa
thernet typ
peration F
d it can flex
e user uses
‘Hardwired
ontroller). T
ince the W
ls ‘Hybrid TC
the SOCKE
dwired TCP/
AW mode. S
AW mode c
W communic
ng), the MAC
otocol. The
are addres
pe’ because
low
xibly use up
the SOCKET
TCP/IP stac
Therefore,
W5200 suppo
CP/IP stack
ET in which
/IP stack’,
So it overcom
can process
cation is p
ACRAW desig
MACRAW d
ss’, 6bytes
it is based
65
pper
T in
ck’,
any
orts
’. If
the
and
mes
all
pure
gner
data
of
on
iEthernet W
5200
© Co
SOCKE
Sele
‘OPE
‘SOC
com
Dest
Proto
{
STA
/*
S0
/* s
S0
/*
if
}
Check
Ref
Receiv
Pro
The
The
‘PA
‘De
‘Pa
acc
(Uht
{
/*
sr
/*
opyright 201
ET Initializat
ct the SOC
EN’ comman
CK_MACRAW
munication
tination har
ocol header
ART:
* sets MAC ra
0_MR = 0x04;
sets OPEN co
0_CR = OPEN
* wait until S
(Sn_SR != SO
received da
fer to the “5
ving process
ocess the MA
e structure o
e MACRAW
ACKET-INFO’
estination MA
ayload.’ The
cording to th
ttp://www.ia
* calculate of
c_mask = Sn
* calculate st
11WIZnet Co
tion
KET and se
nd. After th
W’, the SOCK
(Source ha
rdware add
r, etc.) is in
aw mode */
;
ommand */
N;
Sn_SR is chan
OCK_MACRAW
ata
5.2.2.1 Unica
ACRAW data o
of the MACRA
Figure 16
data consis
is the leng
AC address,’
e ‘Payload’ o
he ‘Type.’ Th
ana.org/assi
ffset address
_RX_RD & gS
tart address(
o., Inc. All rig
et the SN_M
e ‘OPEN’ co
KET initializ
ardware add
dress, Dest
the ‘MACRA
nged to SOCK
W) S0_CR = C
ast & Broadc
of the SOCKE
AW data is as
6 The rec
sts of ‘PAC
th of the D
6bytes ‘Sou
of DATA pac
he details of
gnments/eth
s */
Sn_RX_MASK
(physical add
ghts reserve
MR(P3:P0) to
ommand, if
zation is com
dress, Sour
tination IP
AW data’, th
K_MACRAW *
CLOSE; goto
cast.”
ET which rec
s below:
ceived MA
KET-INFO,’
DATA packet.
urce MAC add
cket consists
‘Type’ pleas
hernet-numb
K; // src_
dress) */
ed.
o MACRAW
the Sn_SR
mpleted. Si
rce IP addre
address, D
here is no m
*/
START;
ceived it in in
CRAW dat
‘DATA pack
The ‘DATA
dress’ and 2b
s of Interne
se refer to th
bersU)
_mask is offs
mode. The
is successfu
nce all info
ess, Source
Destination
ore register
nternal RX m
ta Format
et’ and 4by
packet’ con
bytes ‘Type,
t protocol s
he web:
set address
en execute
ully changed
ormation ab
e port numb
port numb
r setting.
memory.
bytes CRC.
nsists of 6by
’ 46~1500 by
such as ARP
66
the
d to
bout
ber,
ber,
The
ytes
ytes
P, IP
iEthernet W
5200
© Co
sr
/*
le
/*
If(
{
/*
up
/*
ds
/*
le
m
}
el
{
/*
m
}
/*
Sn
/*
m
/*
Sn
}
<Notic
If the
occas
the in
canno
full, t
allow
The s
▪ Proc
▪ Red
bit
opyright 201
c_ptr = gSn_
* get the rec
n = get_Byte
* if overflow
((src_mask +
* copy upper
pper_size = (
memcpy(src
* update des
st_addr += up
* copy left_s
ft_size = len
memcpy(src_
se
* copy len by
emcpy(src_p
* increase S
n_RX_RD += l
* extract 4 by
emcpy(src_p
* set RECV co
n_CR = RECV;
ce>
e free size of
sionally occu
nternal RX m
ot process t
the higher t
ws some loss
solution is as
cess the inte
duce the rece
of S0_MR in
11WIZnet Co
_RX_BASE + s
ceived size */
e_Size_Of_Da
SOCKET RX
+ len) > (gSn_
r_size bytes o
(gSn_RX_MAS
c_ptr, dst_ad
tination_add
pper_size;
ize bytes of
n – upper_siz
_ptr, dst_add
ytes of src_p
ptr, dst_addr
Sn_RX_RD as
len;
ytes CRC fro
ptr, dst_addr
ommand */
;
f the interna
ur where so
memory. Sinc
he MACRAW
he probabili
of the MACR
s follows:
ernal RX mem
eiving load b
sample code
o., Inc. All rig
src_mask;
/
ata_packet /
memory */
_RX_MASK +
of get_start_
SK + 1) – src_
ddr, upper_si
dress */
gSn_RX_BAS
e;
dr, left_size)
tr to destina
r, len);
length of le
om internal R
r, len);
al RX memor
me parts of
ce the probl
data correc
ty is for an e
RAW data.
mory as fast
by reception
e of SOCKET
ghts reserve
// src_ptr
// get Byte s
1))
_address to
_mask;
ize);
SE to destina
;
ation_addres
en */
RX memory a
ry is smaller
f that PACKE
lem occurs a
ctly. The clos
error to occu
as possible t
n only its MA
initializatio
ed.
r is physical s
size of DATA
destination_
ation_addres
ss */
and then igno
than the MA
ET-INFO and
as an analysi
ser the inte
ur. This prob
to prevent th
CRAW data b
n.
start address
packet from
_address */
ss */
ore it */
ACRAW data,
DATA packe
is error for P
rnal RX mem
blem can be
hat it closes
by setting th
s
m Packet-INF
a problem m
et are stored
PACKET-INFO
mory is to be
resolved if u
to full.
he MF (MAC F
67
FO
may
d to
O, it
eing
user
Filter)
iEthernet W
5200
© Co
{
ST
/*
S0
/*
S0
/*
if
}
▪If th
INFO
reo
can
{
/*
if(
opyright 201
TART:
* sets MAC ra
0_MR = 0x44;
* sets OPEN c
0_CR = OPEN
* wait until S
(Sn_SR != SO
e free size o
O(2) + DATA
pen the SOC
be lost.
* check the f
((Sn_RXMEM_
{
recved_siz
Sn_CR0
while(Sn_S
/* process
while(recve
{/* calcu
src_ma
/* calc
src_pt
/* if ov
If((src_
{
/* cop
uppe
mem
/* u
dst_
/* c
left_
mem
}
11WIZnet Co
aw mode wit
;
command */
N;
Sn_SR is chan
OCK_MACRAW
of the intern
packet(8) +
CKET. After c
free size of in
_SIZE(0) * 10
ze = Sn_RX_R
= CLOSE;
SR != SOCK_C
all data rem
ed_size> 0)
ulate offset a
ask = Sn_RX_
culate start a
tr = gSn_RX_B
verflow SOC
_mask + len)
py upper_size
er_size = (gS
mcpy(src_ptr
pdate destin
_address += u
opy left_size
_size = len –
mcpy(src_ptr
o., Inc. All rig
th enabling M
nged to SOCK
W) S0_CR = C
nal RX memo
+ CRC(4)’, cl
closing the S
nternal RX m
024) - Sn_RX_
RSR0(0);
/* SO
CLOSED);
mained in int
address */
_RD&gSn_RX
address(phys
BASE + src_m
KET RX mem
) > (gSn_RX_
e bytes of ge
Sn_RX_MASK
r, dst_addr, u
nation_addre
upper_size;
e bytes of gS
upper_size;
r, dst_addr, l
ghts reserve
MAC filter */
K_MACRAW *
CLOSE; goto
ory is smalle
lose the SOC
SOCKET, the
memory */
_RSR0(0) < 1
/* back
OCKET Close
/* wait
ternal RX me
X_MASK; /
sical address
mask; // sr
mory */
_MASK + 1))
et_start_add
+ 1) – src_m
upper_size);
ess */
Sn_RX_BASE
left_size);
ed.
*/
START;
r than ‘1528
CKET and pro
received MA
528)
kup Sn_RX_RS
ed */
until SOCKE
emory */
/ src_mask i
s) */
rc_ptr is phys
dress to dest
mask;
to destinatio
8 - Default M
ocess all rec
ACRAW data
SR */
T is closed *
s offset addr
sical start ad
ination_addr
on_address *
MTU(1514)+PA
ceived data.
from closing
*/
ress
ddress
dress */
*/
68
ACKET
Then
g time
iEthernet W
5200
© Co
re
/
/*
el
}
Check
The
inter
same
the
pack
{
/*
FRE
fr
if
/*
ds
/*
opyright 201
else
{ /* c
mem
}
/* incr
Sn_RX_
/* extr
memc
/* calc
ecved_size =
}
/* Reopen t
/* sets MAC r
S0_MR = 0x
* sets OPEN c
S0_CR = OP
/* wait unt
while (Sn_
}
se /* proces
{/* This blo
}
send data /
size of the
rnal TX me
e format as
size of the
ket internall
* first, get th
EESIZE:
reesize = S0_
(freesize<se
* calculate o
st_mask = Sn
* calculate st
11WIZnet Co
copy len byt
mcpy(src_ptr
rease Sn_RX_
_RD += len;
ract 4 bytes
py(src_ptr, d
culate the si
recved_size
the SOCKET *
raw mode wi
x44; /* or S0
command */
PEN;
til Sn_SR is c
_SR != SOCK_
s normally th
ck is same a
/ sending pro
e data whic
mory and d
the “Recei
e generated
ly fills to 60
he free TX m
_TX_FSR;
end_size) got
offset addres
n_TX_WR0 &
tart address
o., Inc. All rig
es of src_ptr
r, dst_addr, l
_RD as lengt
CRC from in
dst_addr, len
ze of remain
e – 2 – len – 4
*/
ith enabling
0_MR = 0x04
changed to S
_MACRAW);
he DATA pack
s the code o
ocess
ch the user
default MTU
ving proces
d data is sm
0bytes by “Z
memory size *
to FREESIZE;
s */
gSn_TX_MAS
(physical add
ghts reserve
r to destinat
len);
h of len */
nternal RX m
n);
ned data in i
4;
MAC filter *
*/
SOCK_MACRA
ket from int
of “Receiving
r wants to
U. The host
s” data pac
maller than
Zero padding
*/
;
SK; // ds
dress) */
ed.
tion_address
emory and t
nternal RX m
/
AW */
ernal RX me
g process” st
transmit ca
t generates
cket, and tra
n 60bytes,
g” and then
t_mask is of
s */
then ignore i
memory*/
mory */
age*/
annot be la
the MACRA
ansmits it. A
the transm
it is transm
fset address
t */
arger than
AW data in
At this time
mitted Ether
mitted.
s
69
the
the
e, if
rnet
iEthernet W
5200
© Co
ds
/*
if
{/
}
el
{/
}
/* i
Sn
/* s
}
Check
Since
noto
{
/* c
whi
S0_
}
Check
Refe
opyright 201
st_ptr = gSn_
* if overflow
( (dst_mask
/* copy uppe
upper_size
memcpy(sr
/* update
source_add
/* copy lef
left_size =
memcpy(sr
lse
/* copy len b
memcpy(sr
increase Sn_
n_TX_WR +=
set SEND com
S0_CR = SEN
complete se
e the host
occur.
check SEND c
ile(S0_IR(SEN
_IR(SENDOK)
finished / S
er to the “5.
11WIZnet Co
_TX_BASE + d
SOCKETTX m
k + len) > (gS
er_size bytes
e = (gSn_TX_
rc_ptr, dst_a
source_addr
dr += upper_
ft_size bytes
= len – upper_
rc_ptr, dst_a
bytes of sour
rc_ptr, dst_a
_TX_WR as le
send_size;
mmand */
ND;
ending
manages a
command co
NDOK)==‘0’)
= ‘1’;
SOCKET close
.2.2.1 Unica
o., Inc. All rig
dst_mask;
memory */
n_TX_MASK
of source_a
_MASK + 1) –
addr, upper_
r*/
_size;
s of source_a
_size;
addr, left_siz
ce_addr to d
addr, len);
ength of len
all protocol
ompletion */
; /* wait in
/* clear p
e
ast & Broadc
ghts reserve
// dst_ptr
+ 1) )
addr to desti
dst_mask;
_size);
addr to gSn_
ze);
destination_
*/
l processors
nterrupt of S
previous inte
cast.”
ed.
r is physical
ination_addr
_TX_BASE */
address */
s to commu
SEND comple
errupt of SEN
start addres
ress */
unicate, the
etion */
ND completio
ss
e timeout
on */
70
can
iEthernet W
5200
© Co
6
For
wit
6.1Ser
Fou
6.2W5
ref
wh
(Ma
The
acc
dat
com
The
ina
and
opyright 201
Exter
r the commu
th Ethernet P
SPI (S1rial Peripher
ur pins are n
Devic25200 is contr
ferred to as
ich is compo
aster Out Sla
e SPI protoc
cording to th
ta on the S
mmon modes
e only differ
active state.
d always out
11WIZnet Co
rnal Inte
unication wit
PHY, MII is us
Serial Peral Interface
nSCS, SCLK, M
e Operarolled by a s
the SPI Mast
osed of four
ave In) and M
col defines
he SCLK pola
PI bus. The
s - SPI Mode
rence betwe
With SPI Mo
tput on the f
o., Inc. All rig
erface
th MCU, W52
sed.
ripheral Mode uses o
MOSI, and MI
Figure
tions set of instruc
ter. The SPI
signal lines:
MISO (Master
four modes
arity and pha
W5200 ope
0 and 3.
een SPI Mode
de 0 and 3,
falling edge o
ghts reserve
200 provides
Interfaconly four pins
ISO.
17 SPI In
ction that is
Master com
Slave Chip S
r In Slave Ou
for its ope
ase - how the
erates as SP
e 0 and 3 is
data is alwa
of SCLK.
ed.
s SPI I/F mod
ce) modes for data co
nterface
s sent from a
mmunicates w
Select (nSCS
t).
eration (Mod
e polarity an
PI Slave dev
s the polarity
ays latched in
des. For the
e ommunicatio
a external h
with W5200 v
), Serial Cloc
de 0-3). Eac
nd phase con
ice and sup
y of the SCL
n on the risin
communicat
on.
ost , commo
via the SPI b
ck (SCLK), M
ch mode dif
ntrol the flow
pports the m
LK signal at
ng edge of S
71
tion
only
bus,
MOSI
fers
w of
most
the
CLK
iEthernet W
5200
© Co
6.31
2
3
4
5
6
7
8
opyright 201
Proce31. Configu
2. Configu
3. Write ta
4. Write O
5. Write d
6. Configu
7. Wait for
8. If all da
Figure
11WIZnet Co
ess of usiure Input/Ou
ure nSCS as
arget addre
OP code and
esired data
ure nSCS as
r reception
ata transmis
e 19 Addre
o., Inc. All rig
ng generutput direct
‘High’ on in
ess for trans
d data lengt
a for transm
‘Low’ (data
complete
ssion ends, c
Figure 1
ess and O
ghts reserve
ral SPI Mtion on SPI
nactive
smission on
h for transm
mission on SP
a transfer st
configure n
18 W5200 S
P/DATA L
ed.
Master de Master Dev
SPDR regis
mission on S
PDR registe
tart)
nSCS as ‘Hig
PI Frame Fo
Length Seq
evice vice pins.
ter (SPI Dat
SPDR regist
er.
gh’
ormat
quence Dia
ta Register)
ter.
agram
72
).
iEthernet W
5200
© Co
READ P
The
ent
the
are
On
sel
In W
The
1-b
pro
To
use
REA
be
/*
#de
uin
int
uin
Spi
Spi
{
ISR
opyright 201
Processing
e READ Proc
tered by driv
e Data byte o
e shown in F
OP = 0, the
ected.
W5200 SPI m
e Byte READ
bit OP code(0
ocessing only
distinguish b
ed. If the Da
AD Processin
selected by
Pseudo Code
efine data_r
nt16 addr;
16 data_len;
nt8 data_buf
iSendData();
iRecvData();
R_DISABLE();
11WIZnet Co
cessing Sequ
ving nSCS low
on MOSI. The
Figure 19. Th
e read opera
mode, the By
processing t
0x0), the 15-
y takes the D
between the
ta length is
ng is operate
driving MISO
e for Read da
ead_comma
// Addres
; // Data
[]; // Array
// Send d
// Receiv
// Interru
o., Inc. All rig
uence Diagra
w, followed
e Address, th
he OP code (
ation is selec
yte READ pro
takes 4 instr
-bit Data len
Data instruct
Byte READ a
‘1,’ the Byte
d when the
O low after t
Figure 2
ata of 8bit p
nd 0x00
ss : 16bits
length :15bi
y for data
data from MC
ve data from
pt Service Ro
ghts reserve
am is shown
by the Addr
he OP/Data
(OP) is defin
cted. Otherw
ocessing and
ructions whic
ngth and 8-bi
tion after the
and the burs
e READ proce
Data length
the falling ed
20 READ S
per packet */
its
CU to W5200
m W5200 to M
Routine disab
ed.
n in Figure
ress, the OP
Length Sequ
ned type of t
wise, On OP
the burst RE
ch is consist
it Data. Othe
e setting of t
st READ proc
essing is ope
is more than
dge of the nS
Sequence
/
0
MCU
ble
20.The REA
code, the D
uence Diagra
the READ OP
= 1, the wr
EAD processi
of the 16-bit
erwise, The
the burst rea
essing, the D
rated. Other
n two. The M
SCS.
AD processin
Data Length
am and the D
P and WIRTE
rite operatio
ng are provi
t Address, th
Burst READ
ad processin
Data length i
rwise, the B
MISO pin shou
73
g is
and
Data
OP.
on is
ded.
he
g.
is
urst
uld
iEthernet W
5200
© Co
CSo
//
Spi
Spi
//
Spi
//
Spi
//
for
{
}
CSo
ISR
}
opyright 201
off(); // CS
SpiSendData
iSendData(((
iSendData((a
Data write c
iSendData((d
Data length
iSendData((d
Read data:O
r(int idx = 0;
SpiSendData
data_buf[id
on(); // CS
R_ENABLE();
11WIZnet Co
S=0, SPI start
a
addr+idx) &
addr+idx) & 0
command + D
data_read_co
bottom 8bit
data_len& 0x
On data_len>
idx<data_le
a(0); // Du
dx] = SpiRecv
S=1, SPI end
// Interrup
o., Inc. All rig
t
0xFF00) >> 8
0x00FF);
Data length u
ommand| ((d
ts
x00FF));
> 1, Burst Rea
en; idx++)
ummy data
vData(idx);
pt Service Ro
ghts reserve
8); // Add
// Address
upper 7bits
data_len& 0x
ad Processin
// Read dat
outine disabl
ed.
dress byte 1
byte 2
x7F00) >> 8)
ng Mode.
ta
le
));
74
iEthernet W
5200
© Co
WRITE
The
ent
the
In
pro
Add
Bur
WR
the
Oth
two
nSC
/* P
#de
uin
int
uin
{
Spi
ISR
opyright 201
Processing
e WRITE Pro
tered by driv
e Data byte o
W5200 SPI
ovided. The
dress, the 1
rst WRITE p
RITE processi
e Data length
herwise, the
o. The MOSI
CS.
Pseudo Code
efine data_w
nt16 addr;
16 data_len;
nt8 data_buf
iSendData();
R_DISABLE();
11WIZnet Co
ocessing Seq
ving nSCS low
on MISO.
mode, the
Byte WRITE
-bit OP code
processing on
ing. To distin
h is used. If
e Burst WRIT
pin should
e for Write d
write_comma
// Address
; // Data
[]; // Array
//Send d
// Interrupt
o., Inc. All rig
uence Diagr
w, followed
Byte WRITE
E processing
e(0x1), the
nly takes th
nguish betwe
the Data le
TE Processin
be selected
Figure 2
data of 8bit
and 0x80
s : 16bits
a length :15b
y for data
data from MC
Service Rou
ghts reserve
ram is shown
by the Addr
E processing
takes 4 inst
15-bit Data
he Data inst
een the Byte
ngth is ‘1,’ t
ng is operate
d by driving
21 Write S
per packet
0
bits
CU to W5200
tine disable
ed.
n in Figure 2
ess, the OP
g and the B
tructions wh
length and
truction afte
e WRITE and
the Byte WR
ed when the
MOSI low af
Sequence
*/
0
21.The WRIT
code, the Da
urst WRITE
hich is consis
8-bit Data.
er the settin
the Burst W
RITE processi
e Data lengt
fter the falli
TE processin
ata Length,
processing
st of the 16
Otherwise,
ng of the B
WRITE process
ing is operat
th is more t
ing edge of
75
g is
and
are
6-bit
The
urst
sing,
ted.
than
the
iEthernet W
5200
© Co
CSo
Spi
Spi
//
Spi
//
Spi
//
for
CSo
IINC
}
opyright 201
off();// CS=0
iSendData(((
iSendData((a
Data write c
iSendData((d
Data length
iSendData((d
Write data:
r(int idx = 0;
SpiSendData
on(); // CS
CHIP_ISR_EN
11WIZnet Co
0, SPI start
addr+idx) &
addr+idx) & 0
command + D
data_write_c
bottom 8bit
data_len& 0x
On data_len
idx<data_le
a(data_buf[i
S=1, SPI end
NABLE(); //
o., Inc. All rig
0xFF00) >> 8
0x00FF); //
Data length u
command | (
ts
x00FF));
n> 1, Burst W
en; idx++)
dx]);
/ Interrupt Se
ghts reserve
8); // Addr
/ Address by
upper 7bits
((data_len&
Write Process
ervice Routi
ed.
ress byte 1
yte 2
0x7F00) >> 8
sing Mode.
ne disable
8)));
76
iEthernet W
5200
© Co
7
7.1
*CO
dam
7.2Sym
VDD
VIH
VIL
VOH
VOL
II
7.3
opyright 201
Elect
Absol1Symbol
VDD
VIN
IIN
TOP
TSTG
OMMENT: Stre
mage.
DC Ch2bol Para
D DC S
High
Low
H High
L Low
Inpu
POWE3Condi
100M Link
10M Link
Loss Link
100M Trans
10M Transm
Power Dow
11WIZnet Co
rical Sp
ute MaxiPar
DC Supply
DC input v
DC input c
Operating
Storage te
essing the de
haracteriameter
Supply voltag
h level input
w level input
h level outpu
w level outpu
ut Current
ER DISSIPition
smitting
mitting
wn mode
o., Inc. All rig
ecificat
imum Rarameter
y voltage
voltage
current
g temperatur
emperature
vice beyond t
istics
ge
voltage
voltage
ut voltage
t voltage
PATION(VMin
-
-
-
-
-
-
ghts reserve
tions
atings
-0.5
-0.5
5
re -40
-55
the “Absolute
Test Cond
Junction
temperatu
-55°C to 1
IOH = 4 ~8
IOL = 4 ~8
VIN = VDD
Vcc 3.3V T
1
1
1
1
1
ed.
Rati
5 to 3.63
5 to 5.5 (5V
to 85
to 125
e Maximum R
ition
ure is from
125°C
8 mA
8mA
D
TemperTyp
160
110
125
160
110
2
ng
tolerant)
atings” may c
Min Typ
2.97
2.0
- 0.3
2.4
ature 25Max
175
125
140
175
125
4
Unit
V
V
mA
C
C
cause perman
p Max
3.63
5.5
0.8
0.4
5
5°C) Unit
mA
mA
mA
mA
mA
mA
77
t
A
nent
Unit
V
V
V
V
V
A
iEthernet W
5200
© Co
7.47.4.
7.4.
Freq
Freq
Shun
Driv
Load
Agin
opyright 201
AC Ch.1 Reset
Symbol
TRC
TPL
.2 CrystaPa
quency
quency Toler
nt Capacitan
ve Level
d Capacitanc
ng (at 25℃)
11WIZnet Co
haracteri Timing
Descriptio
Reset Cycl
nRST inter
al Characarameter
rance (at 25℃
nce
ce
o., Inc. All rig
istics
Figure
n
le Time
rnal PLOCK
cteristics
℃)
ghts reserve
22 Reset
25 MHz
±30 ppm
7pF Max
59.12uW/MH
27pF
±3ppm / ye
ed.
Timing
Mi
2
-
Ra
Hz
ar Max
in M
us -
1
ange
Max
-
150 ms
78
iEthernet W
5200
© Co
7.4.
opyright 201
.3 SPI Tim
Symbol
FSCK
TWH
TWL
TCS
TCSS
TCSH
TDS
TDH
TOV
TOH
TCHZ
11WIZnet Co
ming
De
SCK Clock
SCK High T
SCK Low T
nSCS High
nSCS Hold
nSCS Hold
Data In Se
Data In Ho
Output Va
Output Ho
nSCS High
o., Inc. All rig
Figure
escription
Frequency
Time
Time
Time
Time
Time
etup Time
old Time
alid Time
old Time
to Output H
ghts reserve
e 23 SPI T
Hi-Z
ed.
Timing
Min
6
6
5
5
5
3
3
0
Max
80
-
5
5
Uni
MH
ns
ns
ns
ns
ns
ns
ns
ns
ns
ns
79
its
Hz
s
s
s
s
s
s
s
s
s
s
iEthernet W
5200
© Co
7.4.
Tu
In
In
sup
opyright 201
.4 TransfParame
urn Ratio
nductance
case of usin
pport Auto M
11WIZnet Co
former Cheter
ng internal P
MDI/MDIX(Cro
o., Inc. All rig
haracteriTr
1:1
350 uH
Figure 24
PHY mode, b
ossover).
ghts reserve
istics Transmit End
H
4 Transfor
be sure to u
ed.
d
rmer Type
use symmet
Receiv
1:1
350 uH
ric transform
ve End
mer in order
80
r to
iEthernet W
5200
© Co
8
Mo
Dry
Ave
(T
Pre
Tim
Pea
Tim
Ram
Tim
opyright 201
IR Re
isture Sensit
y Pack Requi
erage Ramp-
Tsmax to Tp)
eheat
– Temperat
– Temperat
– Time (tsm
me maintaine
– Temperat
– Time (tL)
ak/Classifica
me within 5 °
mp-Down Ra
me 25 °C to
11WIZnet Co
flow Tem
tivity Level :
red: Yes
-Up Rate
ture Min (Tsm
ture Max (Tsm
min to tsmax)
ed above:
ture (TL)
ation Temper
°C of actual
ate
Peak Temper
Fig
o., Inc. All rig
mperatu
3
min)
max)
rature (Tp)
Peak Tempe
rature
gure 25 IR
ghts reserve
ure Prof
erature (tp)
R Reflow T
ed.
ile (Lea
3
1
20
60
2
60
26
30
6
8
Temperatu
d-Free)
° C/second m
50 °C
00 °C
0-120 second
17 °C
0-150 second
65 + 0/-5°C
0 seconds
°C/second m
minutes ma
ure
max.
ds
ds
max.
ax.
81
iEthernet W
5200
© Co
9
Note:
1
2
3
4
5
6
opyright 201
Packa
:
1. All dime
2. Die thic
3. Dimensi
4. Dimensi
0.25mm
5. The pin
indentat
6. Exact sh
11WIZnet Co
age Desc
F
ensions are
kness allow
on & tolera
on applies
m from term
#1 identifi
tion mark o
hape and siz
o., Inc. All rig
cription
Figure 26
in millimet
wable is 0.03
ances confo
to plated te
minal tip.
er must be
or other fea
ze of this fe
ghts reserve
s
Package D
ters.
304 mm MA
orm to same
erminal and
placed on t
ature of pac
eature is op
ed.
Dimension
AXMUM (0.0
e Y14.5M. -
d is measure
the top surf
ckage body.
ptional.
ns
012 Inches M
1994.
ed between
face of the
MAXIMUM)
n 0.20 and
package by
82
y using
iEthernet W
5200
© Co
7
8
9
1
opyright 201
7. Package
8. Applied
from me
9. Applied
10. Packag
11WIZnet Co
e warpage m
for expose
easuring
only to ter
e corners u
o., Inc. All rig
max 0.08 mm
d pad and t
rminals
unless other
ghts reserve
m.
terminals. E
rwise specif
ed.
Exclude em
fied are R0
bedding pa
.175+/- 0.0
art of expos
025mm
83
ed pad
iEthernet W
5200
© Co
Doc
Ve
Ve
Ve
Ve
Ve
CoCopyrTechnSales For m
opyright 201
cument
ersion
er. 1.0
er. 1.1
er. 1.2
er. 1.2.1
opyrighright 2011WIZnical Support & Distributio
more informat
11WIZnet Co
History
Date
Mar2011
13MAR2011
22APR2011
2AUG2011
ht NotiZnet, Inc. Allt: support@won: sales@wiztion, visit ou
o., Inc. All rig
y Informa
Desc
Release
Change
Change
Fixed th
Fixed th
Added t
Fixed t
(remove
Fixed t
using ge
ice l Rights Reseriznet.co.kr znet.co.kr r website at
ghts reserve
ation
criptions
ed with W5200
d IMR address
d IMR2 addres
he description
he values of ty
the values of
the descriptio
ed PIN 31, P.1
the descriptio
eneral SPI Mas
rved.
http://www.
ed.
0 Launching
s (0x16 to 0x3
ss (0x36 to 0x
n of RSV at 1.3
ypical at 7.3 p
maximum at 7
on of RSV at
0)
on of READ p
ster device (P.
.wiznet.co.kr
6) (P.14, P.18)
16) (P.14, P.22
3 Miscellaneou
power dissipa
7.3 power diss
t 1.3 Miscella
processing at
.73)
r
)
2)
us Signals (P.1
ation (P.77)
sipation (P.77
aneous Signa
6.3 Processin
84
0)
)
ls
ng of
iEthernet W
5200
Mouser Electronics
Authorized Distributor
Click to View Pricing, Inventory, Delivery & Lifecycle Information: WIZnet:
W5200