8
© Copyright 2012 WIZnet Co., Inc. All rights reserved. Ver. 1.1 1 WIZnet W5200 Ethernet PICtail(Plus) Quick Start Guide W5200 Ethernet PICtail TM Quick Start Guide with WIZnet hardware TCPIP Library Plus Version 1.1 © 2012 WIZnet Co., Inc. All Rights Reserved. For more information, visit our website at http://www.wiznet.co.kr

Quick Start Guide With HW TCPIP Library v1.1

Embed Size (px)

DESCRIPTION

Hw TCPIP

Citation preview

Page 1: Quick Start Guide With HW TCPIP Library v1.1

© Copyright 2012 WIZnet Co., Inc. All rights reserved. Ver. 1.1 1

WIZnet W

5200 Ethernet P

ICtail™

(Plus) Q

uick Start G

uide

W5200 Ethernet PICtailTM

Quick Start Guide with WIZnet

hardware TCPIP Library

Plus

Version 1.1

© 2012 WIZnet Co., Inc. All Rights Reserved. For more information, visit our website at http://www.wiznet.co.kr

Page 2: Quick Start Guide With HW TCPIP Library v1.1

© Copyright 2012 WIZnet Co., Inc. All rights reserved. Ver. 1.1 2

WIZnet W

5200 Ethernet P

ICtail™

(Plus) Q

uick Start G

uide

1 Hardware TCPIP stack mode

MCU User application or Microchip application library

W5200 driver files

W5200 WIZnet HW TCPIP Stack

Hardware MAC & PHY

The TWIZ5200 has two operation modes; the software TCPIP stack mode and hardware TCPIP stack mode.

The software TCPIP stack mode didn’t use the hardwired TCPIP engine but the hardware TCPIP stack mode

uses the hardwired TCPIP engine, so we don’t need Microchip software TCPIP stack because the W5200

already has hardware TCPIP stack (worldwide patent). So user can save the memory and MCU resource

using this mode. WIZnet supports driver files to use the Microchip Application Library as usual.

*Note: hardware TCPIP stack v1.1 supports SSL only one socket now. So you cannot use more than 2

sockets for SSL simultaneously.

Below table is example project environment.

Environment Description

Microchip Application Library Ver. 2012-02-15-windows-installer

TCPIP\Demo App

MPLAB tool Ver. 8.83

Compiler C30 v3.3

Ethernet connectivity W5200 Ethernet PICtailTM

Plus

2 Quick Start with W5200 Ethernet PICtailTM

2.1 Step1; Copy the necessary files

Plus

The locations (directory path) of W5200 driver files and other necessary files for HW TCPIP library are,

Microchip Solutions\ TCPIP\ Demo App\ Configs\ HWP EX16_W5200_Cxx.h

TCPIP W5200.h

Cxx-xxx_W5200.mcp

Cxx-xxx_W5200.mcw

HardwareProfile.h

TCPIPConfig.h

Microchip\ Include\ TCPIP Stack\ W5200.h

MAC.h

TCP_W5200.h

Page 3: Quick Start Guide With HW TCPIP Library v1.1

© Copyright 2012 WIZnet Co., Inc. All rights reserved. Ver. 1.1 3

WIZnet W

5200 Ethernet P

ICtail™

(Plus) Q

uick Start G

uide

UDP_W5200.h

TCPIP.h

TCPIP Stack\ W5200.c

TCP_W5200.c

UDP_W5200.c

IP.c

ARP.c

ICMP.c

Each files must be copied to exact directory before using the W5200 Ethernet PICtail™(Plus) board.

Especially the MAC.h , HardwareProfile.h and TCPIPConfig.h files may already placed specified

directory so you should overwrite it. The TCP_W5200.c/h files substitute TCP.c/h and UDP_W5200.c/h files

substitute UDP.c/h to use hardware TCPIP stack.

File Name Descriptions

HWP xxx_W5200_Cxx.h Defines I/O including SPI to use W5200 and your board

TCPIP W5200.h Defines network settings and others for applications

Cxx-xxx_W5200.mcp MPLAB project file for xxx board

Cxx-xxx_W5200.mcw MPLAB workspace file xxx board

HardwareProfile.h Defines file link for “HWP EX16_W5200_C30.h”

TCPIPConfig.h Defines file link for “TCPIP W5200.h”

W5200.h Defines registers and address for W5200

MAC.h Defines memory map, size and others for W5200

TCP_W5200.h Header file for TCP_W5200.c

UDP_W5200.h Header file for UDP_W5200.c

TCPIP.h Includes modified header file TCP_W5200.h and UDP_W5200.h

W5200.c W5200 driver file for hardware TCPIP stack

TCP_W5200.c Hardware TCP driver file

UDP_W5200.c Hardware UDP driver file

IP.c, ARP.c, ICMP.c Empty functions because the W5200 has IP, ARP and ICMP HW logic

2.2 Step2; Open the project file and use as usual

After copying these files, open the project file using the MPLAB IDE and use the Microchip Application

Libraries as usual.

Page 4: Quick Start Guide With HW TCPIP Library v1.1

© Copyright 2012 WIZnet Co., Inc. All rights reserved. Ver. 1.1 4

WIZnet W

5200 Ethernet P

ICtail™

(Plus) Q

uick Start G

uide

2.3 Step3; Make a new project (Optional)

If you don’t use attachded project file, you can make your own new project, the easiest way is modifying

existing project. For example using Explorer 16 board, open the C30-EX16_ENC28.mcp project file and

replace or add driver files (W5200.c/h, TCP_W5200.c/h, UDP_W5200.c/h, HWP EX16_W5200_C30.h, TCPIP

W5200.h, MAC.h, HardwareProfile.h, TCPIPConfig.h) files above. Then define the Preprocessor Macros

‘CFG_INCLUDE_EX16_W5200’ in the build options.

1. Add W5200.c and W5200.h files to the project

2. Delete TCP.c/h, UDP.c/h and add the TCP_W5200.c/h, UDP_W5200.c/h.

Page 5: Quick Start Guide With HW TCPIP Library v1.1

© Copyright 2012 WIZnet Co., Inc. All rights reserved. Ver. 1.1 5

WIZnet W

5200 Ethernet P

ICtail™

(Plus) Q

uick Start G

uide

3. Delete HWP EX16_ENC28_C30.h to and add HWP EX16_W5200_C30.h, also delete TCPIP ENC28.h and

add TCPIP W5200.h. Then replace MAC.h file.

4. Remove the Preprocessor Macros ‘CFG_INCLUDE_EX16_ENC28’ and add new Preprocessor Macros

‘CFG_INCLUDE_EX16_W5200’.

Page 6: Quick Start Guide With HW TCPIP Library v1.1

© Copyright 2012 WIZnet Co., Inc. All rights reserved. Ver. 1.1 6

WIZnet W

5200 Ethernet P

ICtail™

(Plus) Q

uick Start G

uide

Then set the library and including path. And configure other settings (memory model, optimization level and

others) properly. MAC.h, HardwareProfile.h, TCPIPConfig.h files are must be replaced with modified file ( as

in the step 2).

3 TCPIP Stack and App. Configuration; TCPIP W5200.h In the hardware TCPIP stack mode, we cannot use the “TCPIP Configuration Wizard” because it is only

available for software TCPIP stack mode. So we should modify the TCPIP W5200.h file directly.

Don’t use this tool under the HW TCPIP stack mode!!

Page 7: Quick Start Guide With HW TCPIP Library v1.1

© Copyright 2012 WIZnet Co., Inc. All rights reserved. Ver. 1.1 7

WIZnet W

5200 Ethernet P

ICtail™

(Plus) Q

uick Start G

uide

3.1 Step 1; Select Application

User can select the application what they want to run with HW TCPIP stack. Open the TCPIP W5200.h and

uncomment the definition. For example, if you want HTTP server and telnet server, just uncomment the

definition line.

#define STACK_USE_HTTP2_SERVER

#define STACK_USE_TELNET_SERVER

Note: The SSL protocol (Server or Client) can support only one socket with HW TCPIP stack version

1.1 now.

3.2 Step 2; Make TCPSockInitializer (Only for TCP App.)

After step 1, we must make TCPSocketInitializer if we use TCP application. The structure of

TCPSocketInitializer is as below,

{Socket Purpose, Memory Medium, TX memory size, RX memory size }

Under the HW TCPIP stack version, the “Memory Medium and TX/RX memory size” are already fixed because

of the W5200. So the TCPSocketInitializer example for HTTP server is,

{TCP_PURPOSE_HTTP_SERVER, TCP_ETH_RAM, W5200_TX_RAM_SIZE, W5200_RX_RAM_SIZE}

And the TCPSocketInitializer example for telnet server is,

{TCP_PURPOSE_TELNET, TCP_ETH_RAM, W5200_TX_RAM_SIZE, W5200_RX_RAM_SIZE}

For more detail information, please refer to the TCPIP W5200.h file.

The UDP application doesn’t need above definition.

Note: the W5200 has 8 HW sockets, so user cannot use more than 8 sockets simultaneously. I f you

assign 5 sockets for TCP, other 3 sockets are automatically assigned for UDP.

Page 8: Quick Start Guide With HW TCPIP Library v1.1

© Copyright 2012 WIZnet Co., Inc. All rights reserved. Ver. 1.1 8

WIZnet W

5200 Ethernet P

ICtail™

(Plus) Q

uick Start G

uide

Document History Information

Version Data Description

Ver.1.0 Jan. 2012 Release with W5200 Ethernet PICtailTM

Apr.1.1

Plus launching

May. 2012 Add the SSL function so that we can support all protocols in Microchip App. Lib.

Copyright Notice Copyright 2011 WIZnet, Inc. All Rights Reserved. Technical Support: [email protected] [email protected] (Directly) Sales & Distribution: [email protected] For more information, visit our website. http://www.wiznet.co.kr/microchip http://www.wiznettechnology.com/microchip