Home

W5100E01-AVR User Manual

image

Contents

1. N Check timeout END dhcp_state check_DHCP_Timeout STATE_DHCP_REQUEST Reset timeout amp retry_count Check IP Conflict reset_DHCP_time i check leasedlP Y TP Conflict 7 N Reset timeout amp retry count dhcp_state Update the Network Information reset_DHCP_time STATE DHCP DISCOVER set DHCP network Check timeout END dhcp state gt check_DHCP_Timeout STATE_DHCP_LEASED ATE DHCP LEASED ai dp T BEEN Broadcast DHCP REQUEST A i dhe DHCP XID send_DHCP_REQUEST N Reset timeout amp retry_count dhcp_state reset_DHCP_time STATE DHCP REREQUEST STATE DHCP REREQU Y DHCP_ACK Y D_sIP GET_Sip N N Y Update the N M k Inf ti uy N pdate the Network Information Beo NA set DHCP network v Y Reset timeout amp retry count Reset timeout amp retry count reset DHCP time reset DHCP time Y Y dhcp_state dhcp_state STATE_DHCP_DISCOVER STATE_DHCP_LEASED Check timeout END check DHCP Timeout lt Fig 3 31 check DHCP state gt check DHCP state processes correspondingly with DHCP client state through the series of processes shown in lt Fig 3 31 gt If we take a
2. onf i DHCP CL sock_flag 0x00 Y Y Sock flag 0x80 jJenue y S Jesf HAV L03001GA i20 me ChConffil type NOTUS Y Unregister i th Channel Apps Handle MM gn un unregister channel handle Get MAC Addr from EEPROM get netconf amp NetConf Y Set theMAC Addr to DHCP Cleint memcpy SRC MAC ADDR NetConf mac 6 ChConf i J type NOTUSE Register i th Channel Apps register channel handle check DHCP state Y Register i th Channel Apps Handle Conf i type LB TCP E RR ster channel handle loopback tcps N Register i th Channel Apps Handle register channel handle loopback tcpc Conf i type LB TCP N Register i th Channel Apps Handle register channel handle loopback udp hConf i type LB UD Ps N uum onf i type Y Register i th Channel Apps Hand A VEB_SERVE register_channel_handle web_server N N lt MAX SOCK NUN Y y Network Configruation net_init Call i th Channel Apps Handle lt Fig 3 3 EVB B D s main gt 32 Copyright 2007 WIZnet Co Ltd All rights reserved WiZnet 3 2 5 Manage Program Manage P
3. lt c socket ch SOCK_STREAM any port flag Y NBconnect ch destip destport Wait a connetion with a client vM e RETURN y lt Fig 3 15 loopback_tcpc gt lt Table 3 24 Reference Functions in loopback_tcpc gt Function Name Description Location void loopback_tcpc u_char ch Loopback TCP Client Program app loopback c uint8 getSn_SR SOCKET s Get the socket status iinChip w5100 c uint16 getSn RX RSR SOCKET size of data transmittable and received iinChip w5100 c S data u_char socket SOCKET s Related socket can be created as iinChip socket c u_char protocol u int port TCP UDP IP u char flag u char connect SOCKET s u_char addr u_int port Attempts to connect to the specific server with related socket iinChip socket c u int send SOCKET s constu char buf u int len Sends the data to related socket that is in connection iinChip socket c u int recv SOCKET s u_char buf u int len Receives the data to related socket that is in connection iinChip socket c void disconnect SOCKET s Close the related socket iinChip socket c u int get system any port void Get any port number evb config c Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN HAV L0300L6M 52 Wiznet 3 2 6 3 Loopback UDP Loopback UDP Program is a program that uses
4. ES O I x 4 1 Block Diagram WiZnet Address Bust Dey LED E i CS_IINCHIP e pan Busio lt Fig 4 1 EVB B D Block Diagram gt 22 Copyright 2007 WIZnet Co Ltd All rights reserved WiZnet 4 2 Block Description EVB B D is composed of W5100E01 AVR EVB Base Board and PM A1 AVR MODULE Following 9 blocks are components of EVB B D PM A1 LCD PAL SRAM RS232 Port Expanded Board Interface Power Regulator 3 3V Power On System Reset 4 2 1 PM A1 PM A1 AVR MODULE is composed of Atmega128 Processor 74HC573 for address latch 8MHz external crystal and header for interfacing to Base board JP4 JP5 and ISP JP3 amp JTAG JP1 Interface 50 00mm Sc Ww OIM bn woo OF lt Fig 4 2 PM A1 MODULE Dimension gt For easy development using EVB Board all the port pin except for ALE PG2 are connected to MB EVB X2 through module Interface JP4 JP5 Pin description of Interface is shown in lt Table 4 1 PM A1 MODULE Pin Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN YAV 1030015M 93 VIZnet Description gt lt Table 4 1 PM A1 MODULE Pin Description gt PM A1 MODULE Pin Pin Name Dir Description Header JP4 25 DO PAO I O Databus 0 7 or PA 0 7 32 D7 PA7 JP5 26 PBO lO PB 0 7 33 PB7 JP4 3 AO I O Address bus 0 7 10 A7 JP4 11 A8 PCO I O Address bus 8 15 PC 0 7 18 A15 PC7 JP5 42 PDO SCL lO
5. Mini Term File E Configure C Transfer T Help H zB an atx Y n count Number of echo requests to send 1 size Send buffer size w timeout Timeout in milliseconds to wait for each reply PING ping www yahoo co kr DNS SERVER 164 124 101 2 Ping Request to 202 43 214 151 www yahoo co kr Pinging 202 43 214 151 with 32 bytes of data Reply from 202 43 214 151 bytes 32 time lt 2ms Reply from 202 43 214 151 bytes 32 time lt 2ms Reply from 202 43 214 151 bytes 32 time lt 2ms Reply from 202 43 214 151 bytes 32 time lt 2ms Ping statistics Packets Sent 4 Received 4 Lost O Ping Reply Packets 4 Connected 57600 8 None 1 None Capture OFF lt Fig 2 13 Ping Application Test gt To terminate the Ping Application type type exit at the PING gt prompt 2 4 2 EVB B D Test Applications 2 4 2 1 DHCP Client DHCP Client Application is an application that dynamically assigns network information for EVB B D from DHCP Server To test DHCP Client first of all W5100 1 channel application type must be set up as DHCP Client using Manager gt gt Channel Config gt gt 0th Channel Menu Refer to Chapter 2 4 1 2 lt Fig 2 14 gt is the screen that DHCP Client successfully obtains network information Note that DHCP Client will be set with default network information if DHCP Server does not exist or is not able to obtain network information from DHCP
6. SMM MA A 16 50818 EEE A A 16 lt FIG 2 19 DEFAULT WEB PAGE OF EVB B D gt W c cccccccescesecocsssesseseseesssessssesesersesarseseseeensecaraeseeens 17 lt FIG 2 20 WEB PAGE OF EVB B D CONTROL 00 cscccscssssssssesesesesecsenescseseeccsesesesesesesesesnsneseseseseseeeeesees 13 lt FIG 3 1 EVB B D MEMORY MAP gt ccccccescecseseeseesecseeceaeeseaecaessecaessecaaeeecsaecaeseesaesseceaeeeseaesaesaeeaeeaees 19 lt FIG 3 2 AVR INTERNAL EEPROM MAP eene eene nennen nennen nennen nennen nennen nennen 20 FiG 3 3 EVB B D S MAIN gt ttt ttt ttt ttt ttt noctis 32 lt FiG 3 4 CHECK NE 33 lt FIG 3 5 MANAGE_CONFIG gt id 34 FG 3 6 MANAGE NETW RK nai iaa 36 lt FIG 3 7 MANAGE CHANNELS ria A oon ens a das 38 FE PING REQUEST Sa 40 lt FIG 3 9 PING REQUEST CONTINUE A dedi 41 lt FIG 3 10 ICMP MESSAGE VS PING MESSAGE teen teens 42 SFIGS ERIN se 45 lt FIG 3 12 DISPLAY PINES TATISNES Pee 46 lt FIG 3 13 SENDPINGREPLY eese esses seen nennen there tese trennen tenente retener 47 FEL LOOPBACK a eese onu UR Ge 49 W5100E01 AVR User s Manual vii VIZnet FIG 3 15 LOOPBACK TCPC s iin eene pee en eer e ee e EET ee cias 52 Fia 3 16 LOOPBACK UDP O gt ei e tee il 53 lt FIG 3 17 HTTP MESSAGE FLOWS eerte tete tenete tette tinent eter te tete te tens 55 lt FIG 3 18 WEB_SERVER gt cccccccccssssssssesesesescscsesesesescsesesesesesesessssseseses
7. gethostbyaddr Declare Local Variables SOCKET s Y Get the network information of EVB get_netconf amp NetConf Y __NetConf dns 0 aa fir NetConf dns OxFEFFFFFF N Y Find a Free channel getSocket SOCK_CLOSED Found Y Y Communicate with the DNS Server dns query s amp hostip BYIP Success Y y communicate with the Server NS Server IPN Addessisnot Configued RETURN 0 Not found a Free Socket Fail to RETURN 1 C RETURN 0 a Fig 3 38 gethostbyaddr 8 gethostbyname gt the Domain Name with IP Address Domain Name can be used as QNAME without transformation When Query Type is BYIP that is when querying the Domain Name with IP Address change IP Address to IP Address String and QNAME is used after adding in addr arpa to the changed IP Address String After the creation of QNAME UDP Socket is created for DNS inter working and DNS Request Message is created by calling dns_make_query If DNS Request Message is created successfully DNS Request Message is sent to DNS Name Server through UDP Socket After sending DNS Request Message it receives DNS Response Message or waits until the waiting time is expired If DNS response message is received from DNS name server during the waiting time it analyzes received DNS response message using dns_parse_response dns_query returns I
8. lt Table 2 2 EVB B D Default Network Information gt Network Information Default Value MAC Address 00 08 DC 00 00 00 Source IP Address 192 168 0 2 Gateway IP Address 192 168 0 1 Subnet Mask 255 255 255 0 DNS Server IP Address 0 0 0 0 If Network Config menu is selected on Manage Program menu shown in lt Fig 2 7 gt can be displayed and each function is described in lt Table 2 3 gt Copyright 2007 WIZnet Co Ltd All rights reserved jenuew S 19SN HAV LO3I00 LSM VIZnet Select 1 D Display config 1 Source IP 2 Gateway IP 3 Subnet Mask 4 DNS Server IP M MAC address A memory Allocation F Factory reset E Exit lt Fig 2 7 Network Config gt lt Table 2 3 Menu of Network Config gt Menu Description D Display Config Display current Network Information 1 Source IP Address Sets up Source IP Address Gateway IP Address Sets up Gateway IP Address Sets up Subnet Mask 2 3 Subnet Mask 4 DNS Server IP Sets up DNS Server IP Address lt Warning gt DNS Server is information needed for Ping Request test and transformation of Domain Name into IP address Therefore it must be set up as Static IP Address Nor a Sets up Memory Allocation W5100 Memory Size Register RMSR TMSR Refer to W5100 Datasheet pdf F Factory Reset Initialization of the system with the defa
9. Get a Value Verify the Value VerifiylPAddress erifty OK y Y Update c IP Address Conf sip htonl inet_addr Get a Value Verify the Value VerifiylPAddress e erifty OK Update G W IP Address etConf gwip htonl inet addr Get a Value Verify the Value VerifiylPAddress erifty OK Update S N Mask etConf sn htonl inet_addr Get a Value Verify the Value VerifiylPAddress Update DNS IP Address etConf dns htonl inet_addr Get a Value Verify the Value ValidATOI uart0_gets Factory Reset load_factory_netconf Update MAC Address Update Network set netconf amp NetConf Information zd END lt Fig 3 6 manage network gt Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN HAV LOI00 LSM 36 VIZnet lt Table 3 17 Reference Functions in manage_config gt Function Name Description Location u_char manage_network void Configure Network Information evb manage C void get netconf NETCONF pNetConf Get the Network Information that is previously set evb config c void set netconf NETCONF pNetConf Update the Netwo
10. nRAMCS 0x0000 Ox7fff process Addr begin if Addr 100000 then nRAMCS lt 0 else nRAMCS lt 1 end if end process The following is a CUPL Source Code that makes SRAM CS 0x8000 InCS RAM A15 4 4 3 LCD Area LCD is ranged 0x9000 0x9400 WR and RD Signal are used together to control the timing Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN HAV LO300LSM 103 VIZnet LCDCS 0x9000 0x93ff process Addr nRD nWR begin if Addr gt 100100 and Addr lt 100101 and nRD 0 or nWR 0 then LCDCS lt 1 else LCDCS lt 0 end if jenueN S 19SN HAV L0300L6M end process 0x9000 lt 0x9400 LCD E A15 amp A14 amp IA13 amp A12 amp A11 amp A10 amp InRD nWR LCD is High Active Enable Signal 4 4 4 W5100 Area In case of W5100 the address is divided into 2 parts about same Chip For more details refer to W5100 Datasheet 104 Copyright 2007 WIZnet Co Ltd All rights reserved VIZnet IINCHIP 0x8000 0x8800 0xC000 OxFFFF process Addr begin if Addr gt 100000 and Addr 100010 or Addr gt 110000 then nCS IINCHIP lt 0 else nCS IINCHIP lt 1 end if jenueW S 19SN HAV L0300L6M end process 0x8000 lt 0x8800 OR gt O0xC000 InCS_IINCHIP A15 amp 1414 amp A13 8 A12 amp A11 A15 amp
11. If Channel Config menu is selected in manage program lt Fig 2 10 gt is displayed and the functionality of each menu is described in lt Table 2 5 gt Copyright 2007 WIZnet Co Ltd All rights reserved jenueWw S 19SN HAV LO3I00 LSM VIZnet Select 2 O Display Config 1 ist Channel 2 2nd Channel 3 3rd Channel 4 4th Channel F Factory Reset E Exit lt Fig 2 10 Menu of Channel Config gt lt Table 2 5 Menu of Channel Config gt Menu Description D Display Config Displays current set up Test Application type of each W5100 channel 0 1 Channel Sets up test application type at W5100 No 0 channel lt Warning gt As developing EVB B D DHCP Client application setup is possible only at no O channel 1 2 Channel Sets up test application type at W5100 no 1 channel 3 Channel Sets up test application type at W5100 no 2 channel 4 Channel Sets up test application type at W5100 no 3 channel Initialize into original setup status Refer to Table 2 4 gt 2 3 F Factory Reset E Exit Exits Channel Config Available test application of each W5100 channel is shown as lt Table 2 6 gt lt Table 2 6 W5100 Channel Application Type gt Application Type Description No Use Not used DHCP Client Receiving Network Information of EVB B D from DHCP Server dynamically lt Warning gt If DHCP Ser
12. define TYPE SOA 6 marks the start of a zone of authority define TYPE MB 7 a mailbox domain name define TYPE MG 8 a mail group member define TYPE MR 9 a mail rename domain name define TYPE NULL 10 a null RR define TYPE WKS 11 a well known service description define TYPE PTR 12 a domain name pointer define TYPE HINFO 13 host information define TYPE MINFO 14 mailbox or mail list information define TYPE MX 15 mail exchange define TYPE TXT 16 text strings define QTYPE AXFR 252 A request for a transfer of an entire zone define QTYPE MAILB 253 A request for mailbox related records define QTYPE MAILA 254 A request for mail agent RRs define QTYPE TYPE ALL 255 A request for all records define CLASS IN 1 Internet define CLASS CS 2 CSNET class define CLASS CH 3 CHAOS class define CLASS HS 4 Hesiod Dyer 87 define QCLASS ANY 255 Any class Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN HAV LO300LSM 84 LZnet dns parse response Declare amp Initialize Local Variables u inti DHDR dhdr char cur ptr dns buf dhdrid u intfjcur ptr dns id cur ptr 2 dhdrflagO cur p r dhdrflag1 cur p r dhdr qdcountz u int cur ptr dhdrancount u_intcur_ptr 2 dhdrnscount u_intcur_ptr 4 dhdrarcount u_intcur_ptr 6 cur_ptr 8 Parse the Question Section dns parse question cur ptr RETURN 1 Fig 3 42 dns parse response Copyright 2007 WIZnet
13. for more information 2 2 1 1 Compile Tool Chain For installation and usage of WinAVR refer to the related manual Firmware of EVB B D is currently using AVR GCC Version 3 4 6 Compiler and can be changed with compiler version upgrade 2 2 1 2 ICE Programs EVB B D supports JTAG amp ISP ICE for development and debugging For ISP Program AVRStudio program is used Please refer to AVR Tool Guide Vx x pdf for installation and usage of AVR Studio and ISP GENDER User s Guide Vx x pdf for usage of ISP GENDER 2 2 1 3 ROM File Maker Program ROM File Maker Program is a utility program that provides convenience in using simple ROM File System for EVB B D The reason that ROM File Maker Program is used in EVB B D is to access Web Pages for Web Server Test Application as ROM File System Refer to ROM File Maker Manual Vx x pdf for further instruction on installation and ROM File Maker Program 2 2 2 EVB B D Test PC Program Install 2 2 2 1 Loopback Test Program AX1 Install Loopback Test Program referred to as AX1 from here on is a program to evaluate the performance of W5100 and does the Loopback the file and packet data in connection with EVB B D channel applications such as Loopback TCP Server Client and Loopback UDP Please refer to AX1 Manual Vx x pdf for installation and usage O Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN HAV LO300LSM VI
14. lt tr gt lt td width 110 height 22 gt lt font color F EFEEF gt lt font gt Gateway IP lt td gt lt td height 27 gt lt input name gwip type text size 20 value GW_IP_ADDRESS gt lt td gt lt tr gt lt tr gt lt td width 110 height 22 gt lt font color F EFEEF gt lt font gt Subnet Mask lt td gt td height 27 gt lt input name sn type text size 20 value SUB NET MASK gt lt td gt lt tr gt lt tr gt lt td width 110 height 22 gt lt font color 4FEFEEF gt lt font gt DNS Server IP lt td gt lt td height 27 gt lt input name dns type text size 20 value DNS_SERVER_IP gt lt td gt lt tr gt lt tr gt lt td width 110 height 22 gt lt font color 4FEFEEF gt lt font gt MAG Address lt td gt lt td height 27 gt SRC_MAC_ADDRESS lt td gt lt tr gt Table 3 30 gt is a part of evbctrl html in ROM File Image of EVB B D The length of the system environment variables is defined to fit the length of system environment value to be replaced For example if Source IP Address of EVB is expressed in string the maximum is 16 Hence the length of SRC_IP_ADDRESS is 16 as well ROM File System of EVB B D can be created with 60 Copyright 2007 WIZnet Co Ltd All rights reserved VIZnet ROMFileMaker exe provided by WIZnet Refer to ROM File Maker Manual Vx x pdf for further information HTTP Request m
15. qname domain_len 1 query domain_len E query 10 u inf query qtype query 2 u int query qclass query 2 RETURN Query Size Fig 3 40 dns makequery gt Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S Jesf HAV L0300LGA 82 VIZnet dns_makequery creates DNS Request message to be sent to DNS Name Server Since DNS Request Message can query only with Header Question Section RRs Sections is not needed to be created If you examine the header section creation at dns_makequery first it sets ID Field values as any value in DNS Message inter working On here ID is set with 0x1122 and for further inter working the value is incremented by 1 QR Opcode AA TC RD Field are set as QR_QUERY OP_QUERY OP_IQUERY 0 0 1 respectively through MAKE FLAGO and RA Z RCODE Field are set as 0 0 0 respectively through MAKE_FLAG1 lt Table 3 39 Constants and MACRO used in Header Section gt define QR QUERY 0 define QR RESPONSE 1 define OP QUERY 0 a standard query QUERY define OP IQUREY 1 an inverse query IQUERY define OP STATUS 2 a server status request STATUS define MAKE FLAGO qr op aa tc rd gr amp 0x01 lt lt 7 op amp OxOF lt lt 3 aa amp 0x01 lt lt 2 tc amp 0x01 lt lt 1 rd amp 0x01 define MAKE FLAG 1 ra z rcode ra amp 0x01 lt lt 7 z amp 0x07 lt lt
16. 0 gt qname I qnamer clen slen gname cp gnamet nseg lt Fig 3 44 parse_name gt 88 Copyright 2007 WIZnet Co Ltd All rights reserved WiZnet parse_name processes QNAME Field of Question Section or NAME RDDATA Field of RRs Section QNAME NAME RDDATA Field are mostly composed as in lt Fig 3 41 Example of QNAME Field transformation of Question Section gt However it can be compressed to reduce DNS Message Size Compression scheme is expressed in 2 Byte If the first byte the upper 2 bits are 11 it means the Label is Byte excluding upper 2 bits and B Byte compressed It has the offset that is composed of This offset is Offset of DNS Message and means the actual value of Label is located by the offset from the starting point of DNS message When Compress Scheme tries to reuse Domain Name that was already used in DNS Message relevant Domain Name sets the offset that is located in DNS Message as Indirect so that it can reduce the size of DNS Message Fig 3 45 is an example of Compress Scheme of DNS Message and its application D Tq 2 7 8 15 tet lt Fig 3 45 DNS Message Compression Scheme gt The example of Compression Scheme of lt Fig 3 45 gt shows DNS Message in case of F ISI ARPA FOO F ISI ARPA ARPA and ROOT F ISI ARPA is processed in the format of Fig 3 41 Example of Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S
17. 4 rcode amp OxOF Since the count fields ADCOUNT ANCOUNT NSCOUNT and ARCOUNT have only one question each is set as 1 0 0 O respectively Let s look at Question Section QNAME Field is the field that sets IP Address string Domain Name and IP Address string are composed of label length of 1 byte and label of MAX 63 Byte The end of QNAME is always set with 0 to find out the variable length of QNAME Fig 3 41 is actual example of transformation of Domain Name www wiznet co kr in QNAME field o t A A8 Bytes a os w Tw Tw ToS w O oui T OO K T 00 Label Length Label Zero Terminated Fig 3 41 Example of QNAME Field transformation of Question Section gt Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S JeSf HAV L0300L6M VIZnet QTYPE Field of Question Section is set TYPE_PTR when it holds Domain Name as QNAME When it s IP address it s set as TYPE A and QCLASS field is set as CLASS IN since it is included in Internet Table 3 41 is definition of constants that are used in QTYPE 8 QCLASS Fields lt Table 3 40 Constants Definition at QTYPE 8 QCLASS Field gt Definition Description define TYPE_A 1 The ARPA Internet define TYPE_NS 2 an authoritative name server define TYPE_MD 3 a mail destination Obsolete use MX define TYPE MF 4 a mail forwarder Obsolete use MX define TYPE CNAME 5 the canonical name for an alias
18. A14 For VHDL Source Code refer to EVB_PAL VHD in the official website of WIZnet www wiznet co kr For CUPL Source Code refer to EVB_PAL PLD in the official website of WIZnet www wiznet co kr Please refer to AVR Tool Guide pdf for compiling 105 Copyright 2007 WIZnet Co Ltd All rights reserved WiZnet 4 5 Parts List 4 5 1 W5100E01 AVR Parts List Please refer to W5100E01 AVR PARTLIST PDF in the official website of WIZnet www wiznet co kr 4 5 2 PM A1 Parts List Please refer to PM A1_PARTLIST PDF in the official website of WIZnet www wiznet co kr Jenue y S 19SN HAV LOI00 LSM 106 Copyright 2007 WIZnet Co Ltd All rights reserved VIZnet 4 6 Physical Specification 4 6 1 Power Consumption Power consumption of each component of EVB B D is as in the following table lt Table 4 5 EVB B D Power Consumption gt Jenue y S 19SN YAV 1030015M Power Level MIN TYP MAX 5V 243 3 3V 198 Total Power consumption is 243mA X 5V 1215mW 107 Copyright 2007 WIZnet Co Ltd All rights reserved Mouser Electronics Authorized Distributor Click to View Pricing Inventory Delivery amp Lifecycle Information WIZnet W5100E01 AVR
19. CH PORT 3 2 Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN HAV L0300L6M 21 VIZnet 3 1 2 1 System Information System Information area is used in recording System Information such as Firmware Version of EVB B D lt Table 3 3 System Information gt Name Description Default Value SYS_TEST Valid Check of System Information OxA5A5 Valid Others Invalid SYS_VER F W Version OxAABBCCDD AA BB CC DD SYS_AUTORESET any environmental variable Auto reset check in case of setting up 0x01 System Auto Reset Others No Reset SYS_ANY_PORT creation Using Any Port Number at Socket 1000 65535 System Information is accessed as SYSINFO Data Type lt Table 3 4 SYSINFO Data Type Definition gt Type Definition Instance typedef struct SYSINFO u_int test u long ver u char auto reset u int any port SYSINFO SYSINFO Syslnfo lt Table 3 5 System Information Access Functions gt Function Description void set sysinfo SYSINFO pSysInfo Save the System Information void get sysinfo SYSINFO pSysInfo Get the System Information Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN HAV LO300LSM 22 VIZnet 3 1 2 2 Network Information Network Information is used in recording Network Configuration information to be used for EVB B D lt Table 3
20. Function Name Description Location void web server u char ch Web Server Program app webserver c void proc http SOCKET s Processes HTTP Message using related app webserver c u char buf int length Socket u int replace sys env value Change Pre defined System app webserver c u_char base u int len Environment Variables in HTTP Response Message to Real Values void parse_http_request Analyzes and processes HTTP Request inet httpd c st_http_request u_char Message and saves it in st_http_request structure void find_http_uri_type Gets MIME Type of HTTP Request inet httpd c u_char char Message char get_http_uri_name Gets Request URI Name of HTTP inet httpd c char uri Request Message char get_http_param_value Gets Relevant Parameter Value in inet httpd c char uri char param_name Query String of Request URI void unescape_http_uri char Transforms Escape Character inet httpd c url void make http response head Creates header of HTTP Response inet httpd c char char u long Message uint8 getSn_SR SOCKET s Informs the socket status iinChip w5100 c uint16 getSn_RX_RSR SOCKET size of data transmittable and received iinChip w5100 c s data u_char socket SOCKET s Creates related socket as TCP UDP IP iinChip socket c u_char protocol u_int port u_char flag void listen SOCKET s Puts the related socket in Server Mode iinChip socket c u_int send SOCKET s const u_char buf
21. Get the channel information 25 Copyright 2007 WIZnet Co Ltd All rights reserved WiZnet 3 2 EVB B D Firmware EVB B D Firmware EVB main can be divided into two parts Manage Program that sets up various environments for running EVB B D and Loopback Programs that tests W5100 performance There are Internet Application using Internet Protocols such as DHCP HTTP DNS and ICMP Let s look at the source list of which EVB B D is composed and then look at each application source Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN YAV 1030015M 26 VIZnet 3 2 1 Sources lt Table 3 13 EVB B D Sources gt Classification Discos Files Description app ping_app h ping_app c Ping Request App implementation loopback h loopback c TCP UDP Loopback Apps implementation webserver h webserver c Webserver App implementation mcu delay h delay c Delay Function wait_xxx serial h serial c AVR UART control timer h timer c AVR Timer enable amp disable types h AVR Data Type Definition amp Global Difinition evb channel h channel c Channel App Handler registration amp cancellation config h config c EVB B D Environment evb h evb c EVB B D initialization Icd h Icd c EVB B D Text LCD control led h led c EVB B D LED D3 D4 control manage h manage c Manage App inet dhcp h dch
22. H BAY After about7 seconds Press M to enter the manager mode File E Configure C Transfer D Help H SE Y 2 tx Press M to enter the manager mode EE EEE W510BE81 AVR Test in Direct Mode PEPE SESE EE HEHE AEE AE SE ESE EEE EEE Copyright WIZnet Inc 2887 Homepage http www wiznet co kr Support support wiznet co kr Sales salesQuiznet co kr F W Version 1 8 8 8 H W Version 1 8 8 8 MAC Addr 66 68 DC 66 66 66 Source IP 192 168 0 2 Gateway IP 192 168 8 1 Subnet Mask z 255 255 255 0 DNS Server IP 6 6 6 6 Mem alloc 25 EEE EEE HEHEHE Loop Back TCP Server Started Loop Back TCP Server Started Loop Back TCP Server Started Loop Back TCP Server Started Q NSG lt Fig 2 4 Output of Terminal Program gt Execute Ping test with EVB B D C W gt ping 192 168 0 2 Pinging 192 168 0 2 with 32 bytes of data from 192 168 8 2 bytes 32 time lt iGms from 192 168 0 2 bytes 32 time lt i nms from 192 168 8 2 bytes 32 time lt iGms from 192 168 8 2 bytes 32 time 1 ms Ping statistics for 192 168 0 2 Sent 4 Received Approximate round trip times in milli seconds Minimum ms Maximum 18ms Average 4 Lost z loss lt Fig 2 5 EVB B D Ping Reply Test gt Execute AX1 program Refer to AX1 Manaul Vx x pdf Test the operation of AX1 program with TCP Client Refer to AX1 Manaul Vx x pdf After setting
23. 1030015M 62 WiZnet based on OS Web Server Program which is based on OS creates separate process to take case of communication between processes independently However Web Server of EVB B D is OS less so instead of making independent process it calls relevant functions to deal directly with CGI processing EVB B D supports NETCONF CGI which updates Network Information and LCDNLED CGI which controls text LCD D1 D2 LED of EVB B D Fig 3 23 and Fig 3 24 shows both CGI processing Processing NETCONF EGI Extract the value of sip param ge http param value hitp request gt uri sip ram NOL Update Source IP Address sili NetConf sip htonlfinet addriparam Extract the value of gwip param get_http_param_value http_request gt uri gwip z Y Update Gateway IP Address eram NULL NetConf gwip htonl inet addr param N Extract the value of sn param get_hitp_param_value hitp_request gt uri sn lt param NUL Update Sbunet Mask Value NetConf sn htonl inet addi param N Extract the value of dns param ge hitp param value hitp request uri dng Update DNS Server IP Address RENEI NetC onf dns htonl inet addr param Save the Network Information to EEPROM set_netconf amp NetConf Send a CGI Success Page send EVB B D Auto Reset evb soft rese END Fig 3 23 NETCONF CGI Processing Copyright 2007 WIZnet Co Ltd All righ
24. Channel Information evb config c u_int uart_keyhit u_char uart Checking the Input from UART 0 1 mcu serial c char uartO getchar void Read one character from UARTO mcu serial c void wait_1ms u_int cnt Delay Function mcu delay c void ping_request void Ping Request Test Program app ping_app c 3 2 5 1 Network Configuration Network Configuration is a sub program of Manage Program and built with manage_network And it s the program that sets up Network Information of EVB B D In general MAC Address of Network Information is hardly updated after the initial setup Accordingly MAC Address setup does not provide Configuration Menu such as Source IP Gateway IP or Subnet Mask but it provides hidden menu Also MAC Address is not changed at the time of Factory Reset MAC Address is updated using M or m Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN YAV 103001S5M 85 WiZnet START manage_network Y S Get the Network Information get_netconf amp NetConf S da Y y Display gt Network Config Menu Y Get the pressed Key sel uart0 get char uartO gets uart0_gets uart0_gets uart0_gets Display Config ource IP Gateway IP ubnet Mask DNS Server IP actory Reset Display Ne display 1 work Information netconf KS N
25. IP Update dhcp_ip_update set DHCP network Assign the User Handler for IP Conflict dhcp_ip_update proc ip conflict Assign the Default Handler for IP Conflict dhcp ip conflict ip conflict Fig 3 28 init dhcp client gt When network information is renewed or IP collision occurs register evb soft reset to run auto reset for EVB B D Second Network Information acquirement can be done through getIP_DHCPS 69 Copyright 2007 WIZnet Co Ltd All rights reserved VIZnet getlP DHCPS Y Find a DHCP Server send DHCP DISCOVER Y dhcp state STATE DHCP DISCOVER Y Reset timeout value amp retry count reset_DHCP_time Y Set Timer for DHCP Client set timer 1s Y DHCP Timeout 0 Y dhcp State l STATE DHCP LEASED lt a Y Kill Timer for DHCP Client kill_timer lt HCP_Timeout gt N Check _ dhcp_state check DHCP state Vv RETURN Success RETURN Fail Fig 3 29 getlP_DHCPS gt getIP_DHCPS initializes W5100 using setIP setMACAddr and etc and it initializes dhcp_state variable as DHCP client program state to STATE DHCP DISCOVER After the initialization it calls send_DHCP_DISCOVER to transfer a DHCP DISCOVERY message to DHCP server After transmitting DISCOVERY DHCP message it initializes timer
26. LCD_BASEADDR 0x9000 evb lcd h 3 1 2 AVR Internal EEPROM MAP lt Fig 3 2 gt lt Table 3 2 gt are representations of AVR Internal EEPROM Map Refer to evb config h and evb config c Addr 0 1 2 3 4 5 7 8 Bios SYS_TEST SYS VER AUTO SYS ANYPORT RESET NET TEST NET MAC NET SIP NET SN NET_DNS NET MEMALLOC lt Fig 3 2 AVR Internal EEPROM Map gt Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN HAV LOI00 LEM 20 VIZnet lt Table 3 2 AVR Internal EEPROM MAP Definition gt define SYS_ INFO 0x00 Sen define SYS_TEST SYS_INFO VE define SYS VER SYS TEST 2 define SYS AUTORESET SYS VER 4 define SYS ANY PORT SYS AUTORESET 1 define NET CONF 0x20 define NET TEST NET CONF define NET MAC NET TEST 2 Network define NET SIP NET MAC 6 Information define NET GWIP NET SIP 4 define NET SN NET GWIP 4 define NET DNS NET SN 4 define NET MEMALLOC NET DNS 4 define CH CONF 0x50 define CH TEST CH CONF define CH TYPE 0 CH TEST 2 define CH PORT 0 CH TYPE 0 1 define CH DESTIP 0 CH PORT 0 2 define CH TYPE 1 CH DESTIP 0 4 Channel define CH PORT 1 CH TYPE 1 1 Information define CH DESTIP 1 CH PORT 1 2 define CH TYPE 2 CH DESTIP 1 4 define CH PORT 2 CH TYPE 2 1 define CH DESTIP 2 CH PORT 2 2 define CH TYPE 3 CH DESTIP 2 4 define CH PORT 3 CH TYPE 3 1 define CH DESTIP 3
27. O Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN YAV 103001S5M 49 VIZnet lt Table 3 23 Reference Functions in loopback_tcps gt Function Name Description Location void loopback_tcps u_char ch Loopback TCP Server program app loopback c uint8 getSn_SR SOCKET s Get the socket status iinChip w5100 c uint16 size of data transmittable and received iinChip w5100 c getSn RX RSR SOCKET s data u_char socket SOCKET s Create the socket iinChip socket c u_char protocol u_int port u_char flag u_char listen SOCKET s It sets related socket as server mode iinChip socket c u_int send SOCKET s Transfer the data to the connected socket iinChip socket c const u_char buf u_int len u_int recv SOCKET s Receive the data to the connected socket iinChip socket c u_char buf u_int len void disconnect SOCKET s Close the connection of the socket iinChip socket c If the server socket is in SOCK_CLOSED status loopback_tcps calls socket with the elements of SOCK_STREAM Listen Port Number and Option Flag to create TCP server socket The socket function changes the socket status to SOCK_INIT regardless of the previous socket status If the server socket is created successfully it s put in TCP Server mode after calling listen with the server socket as the parameter listen makes the server socket status as SOCK_LISTEN status and maintains SOCK_LIST
28. cable is working properly 2 5 2 Misc When the serial terminal screen remains blank with the power on after a connection is made Step 1 Check the connection condition of the serial cable Step 2 Check the COM Port numbers of the PC and terminal coincide Step 3 Check the terminal s baud rate 57600 Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN YAV 103001S5M VIZnet 3 Programmer s Guide 3 1 Memory Map 3 1 1 Code amp Data Memory Map Memory Map of EVB B D is composed of code memory 128 Kbytes and data memory 64Kbytes Data memory is divided into SRAM W5100 and Text LCD Area Other than these there is 4Kbytes AVR Internal EEPROM Various types of environmental variables are recorded on this EEPROM lt Fig 3 1 gt lt Table 3 1 gt are representations of System Memory Map of EVB B D Ox1FFFF Not Used __ NotUsed EA 0x00000 lt Fig 3 1 EVB B D Memory Map gt Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y 43SN HAV LOI00 LEM WiZnet lt Table 3 1 Device MAP Definition gt Device Map Define Source Code W5100 define DEF IINCHIP MAP BASE 0x8000 if DEF IINCHIP BUS DEF IINCHIP DIRECT MODE define COMMON BASE DEF IINCHIP MAP BASE else define COMMON_BASE 0x0000 endif define DEF IINCHIP MAP TXBUF COMMON BASE 0x4000 define DEF IINCHIP MAP RXBUF COMMON BASE 0x6000 mcu types h Text LCD define
29. lt lt Ten U gt Neen Sst lt Fig 3 43 dns_parse_question amp dns_answer gt dns_parse_question analyses and processes Question Section There is no information that actually used in the Question Section of DNS Request Message but it must be processed to get the starting position of Answer Section Since QNAME Field of Question Section gets variable length parse_name processes 87 Copyright 2007 WIZnet Co Ltd All rights reserved WiZnet QNAME Field to process the variable length processes and QTYPE and QCLASS Field are skipped dns_answer analyzes and processes Answer Section Answer Section is a section where transformation actually takes effects and it performs appropriate process to TYPE Field of Answer Section TYPE of Answer Section has one of values from lt Table 3 41 Constants Definition at QTYPE amp QCLASS Field gt and the value comes from either TYPE_A or TYPE_PTR In case that the Domain Name is changed to IP Address it can get the changed IP Address from TYPE_A and if the IP Address is changed to Domain Name Domain Name can be obtained from TYPE_PTR Changed Domain Name or IP Address are also Jenue y S 19SN YAV 1030015M processed and extracted by parse_name parse_name Declare amp Initialize Local Variableg u int slen int clen Z0 int indirect 0 int nseg 0 slen cp N qname NULL qname_maxlen slen 1 ot Enough RETURN clen RETURN 0 N C N hseg
30. rnt enne nennen nennen nennen 93 W5100E01 AVR User s Manual viii Wiznet Tables TABLE 1 1 LIST OF ITEMS CONTAINED IN THE EVB B D gt cccccccssssessssssesesceeeceeeeeseseseseseseeeneseneacseeeesees 1 lt TABLE 1 2 CONTENTS OF SOFTWARE eerte tette tenete tette treten tetti tete teens 1 TABLE 2 1 TERMINAL PROPERTIES SETTING tette tete 5 lt TABLE 2 2 EVB B D DEFAULT NETWORK INFORMATION eese tnter tenete 7 TABLE 2 3 MENU OF NETWORK CONFIG gt cccsessssescsescscssssescsesesesesueuescseseseseeseseseseseseaesesesesneneneneasseesesees 8 lt TABLE 2 4 EVB B D DEFAULT CHANNEL INFORMATION tette tette 9 TABLE 2 5 MENU OF CHANNEL CONFIG essere tete tete tereti narrar 10 TABLE 2 6 W5100 CHANNEL APPLICATION TYPE tetris 10 lt TABLE 2 7 APPLICATION DEFAULT VALUE gt ssssscscsesssssssssesesesesucucneseseseseccsesesesesesesesesneneneneneseeeeceesees 11 lt TABLE 3 1 DEVICE MAP DEFINITION sesenta tnter tenete 20 TABLE 3 2 AVR INTERNAL EEPROM MAP DEFINITION esee tete 21 TABLE 3 3 SYSTEM INFORMATION gt c scsssesessssssescscscsssssesssuencsssssucecssseseseececesessssseseneaeaesucecessesenenceceseses 22 lt TABLE 3 4 SYSINFO DATA TYPE DEFINITION essere nnne trennen enne 22 TABLE 3 5 SYSTEM INFORMATION ACCESS FUNCTIONS sss nens 22 TABLE 3 6 NETWORK INFORMATION sees tete ttt te tete te tete tette te
31. s padding Table 3 34 is defined as enumeration data type in inet dhcp h and shows most common Option Codes that are used in DHCP Client Program Other codes that are not defined in Table 3 34 are skipped from DHCP Client Program Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN HAV L0300L6M 68 WiZnet The operation of DHCP Client Program is displayed in EVB B D s main Refer to lt Fig 3 3 gt First set up the MAC address to be used by DHCP Client at the initialization MAC address is unique address for all the devices in the network MAC address is most basic address in Network communication and necessary information to recognize DHCP Clients in DHCP Server For MAC Address of DHCP Client program it sets up SRC_MAC_ADDR which is global variable of DHCP client using the MAC Address of EVB B D By calling init dhcp client after setup of SRC_MAC_ADDR it can register two functions to be Jenue y S 19SN YAV 1030015M called in case of collision of the IP received from DHCP Server and in case of renewal the IP from DHCP Server When calling init_dhcp_client if each function is not specified set_DHCP_network and proc ip conflict of DHCP Client Program respectively init dhcp client param s ip update ip conflict Assign the Socket for DHCP Client DHCPC SOCK s Assign the User Handler for IP Update p update NULI dhcp ip update ip_update Assign the Default Handler for
32. the Server IP Address as 192 168 0 2 and port Number as 5000 by clicking TCP gt gt Connect Menu then click TCP gt gt Send Menu or Ts Tr cc Icons 9 Test the loopback with any file or packet between AX1 Program and EVB B D 2 4 EVB B D Test The firmware of EVB B D can be divided into Manage Program and EVB B D Test Application Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN YAV 103001S5M VIZnet Manage Program performs system configuration to run EVB B D and EVB B D Test Application is Network Application Program for W5100 Test 2 4 1 Manage Program Manage Program is a program that is executed upon receiving character M or m from the terminal program within 7 seconds when doing the manual reset of EVB B D and EVB B D power on This program sets up the channel application of W5100 to be tested and perform certain ping request test with DNS server File E Configure C Transfer T Help H SAY Press M to enter the manager mode 1 Network Config 2 Channel Config 3 Ping App Test F Factory Reset E Exit lt Fig 2 6 Manage Program Execution gt 2 4 1 1 Network Configuration It selects Network Information that is used in EVB B D When choosing 1 at terminal Program of lt Fig 2 6 gt Network Information of EVB B D can be set as desired The default Network Information of EVB B D is shown in lt Table 2 2 gt
33. value 5000 Refer to Chapter 2 4 1 2 After the setup of EVB B D is complete run AX1 at Test PC then try the connection to the IP Address When the connection between EVB B D and AX1 is successful loop back the data Refer to AX1 Manual Vx x pdf Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y s Jesf YAV 1030015M WiZnet Source IP 192 168 0 2 Gateway IP 192 168 0 1 Subnet Mask 255 255 255 0 DNS Server IP 0 0 0 0 MAC Addr 0x00 0x08 0xDC 0x00 0x00 0x35 HHHHHHHHSHHHHHSHHHHHHHHHSHHHSHHSHHSHHSHHHHHHHEH O Loop Back TCP Server Started 1 Loop Back TCP Server Started Loop Back TCP Server Started 2 3 Loop Back TCP Server Started g Connected by 192 168 0 30 2313 Peer Connection Information in O channel of W5100 lt Fig 2 15 Loopback TCP Server Test gt 2 4 2 3 Loopback TCP Client Loopback TCP Client Application is an application that loops back any file and packet data through TCP channel connected with AX1 Program of Test PC After running the AX1 on the server set any channel of W5100 as Loopback TCP Client application type using Manager gt gt Channel Config menu of EVB B D When setting up the Loopback TCP Client Application type of EVB B D set the Server IP as the IP Address of the Test PC and set Server Port as the waiting Server Port Number 3000 Refer to Chapter 2 4 1 2 After setting up EVB B D is complete exit from the manager prog
34. 0 Web Server HTTP Port Number 80 Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN HAV L0300L6M WiZnet 2 4 1 3 Ping Application Test Ping Application Test is a program created for IP RAW channel evaluation of W5100 and sends Ping request to certain peer and receives Ping Reply This program is set up identically with the ping command in the DOS prompt It s executed when 3 is chosen lt Fig 2 6 Manage Program Execution gt 7 Mini Term File E Configure C Transfer T Help H sg gM t LX Channel Config Ping App Test Factory Reset Ping Reqeust program started ping t a n count 1 size w timeout destination list Ping the specified host until stopped To see statistics and continue type Control Break To stop type Control C Resolve addresses to hostnames Number of echo requests to send l size Send buffer size w timeout Timeout in milliseconds to wait for each reply Connected 57600 8 None 1 None Capture OFF lt Fig 2 12 Usage of Ping Application gt lt Fig 2 12 gt displays the execution screen of Ping Application and shows how to use the Ping Application Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN YAV 1030015M WiZnet lt Fig 2 13 gt shows the real example of sending the Ping Request to the destination and receiving the Ping Reply
35. 015M 30 VIZnet lt Table 3 15 Reference Functions in EVB B D s main gt Function Name Description Location int main void EVB B D main main main c void evb_init void AVR Text LCD evb evb c UART initialization void net_init void EVB B D Network initialization evb evb c void check_manage void Manage Program action wait and evb manage c execution void register_channel_handler Channel Application Handler evb channel c u_char ch void registration handler u_char void unregister_channel_handler Channel Application Handler evb channel c u_char ch cancellation void init_dhcp_client SOCKET s DHCP Client Program initialization inet dhcp c void ip_update void void ip_conflict void u_int getIP_DHCPS void Network Information acquisition from inet dhcp c DHCP Server void check_DHCP_state SOCKET Check to expire the leased time from inet dhcp c S DHCP server void loopback tcps u char ch Loopback TCP Server app loopback c void loopback tcpc u char ch Loopback TCP Client app loopback c void loopback udp u char ch Loopback UDP app loopback c void web server u char ch Web Server Program app webserver c Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S JeSf HAV L0300L6M 31 LZnet START main Y Initialize EVB B D evb_init Y Check to enter the manage mode check_manage
36. 19SN YAV 1030015M 89 WiZnet QNAME Field transformation of Question Section gt with Offset 20 of DNS Message without compression In FOO F ISI ARPA since the rest except for FOO is same as Name which is previously processed FOO is processed with lt Fig 3 41 Example of QNAME Field transformation of Question Section gt Format without compression and the rest of names is processed by Offset 26 ROOT is the highest Domain and it s processed with Label Length Field of 0 parse_name before analysis of Name checks if upper 2 bits of Label Length Byte are 11 if it s 11 the related Label analyzes the Label at the offset of DNS Message where the Label is located If it s no 11 then the Label is analyzed and processed like as lt Fig 3 41 Example of QNAME Field transformation of Question Section gt Copyright 2007 WIZnet Co Ltd All rights reserved jenue N S 19SN YAV 103001S5M 90 VIZnet lt Table 3 42 Reference Functions in DNS Client gt Function Name Description Location int gethostbyaddr Changes IP Address to Domain Name inet dns c u_long ipaddr char domain u_long gethostbyname Changes Domain Name to IP Address inet dns c char hostname u_char dns_query DNS Message Processing inet dns c SOCKET s u long dnsip u_char domain name u long domain ip QUERYDATA querydata u int elapse int dns make query Creates DNS Re
37. 3 13 SendPingReply gt Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN HAV 1030019M 47 VIZnet lt Table 3 22 Reference Functions in ping_request gt Function Name Description Location void ping_request void Ping Request program app ping_app c void ping_usage void Outputs the instruction of Ping Request app ping_app c program char ping Sends Ping Request to specific inet ping c int count u int size u int destination and processes ICMP time u char addr PINGLOG message received from any destination log void DisplayPingStatistics Outputs the results from ping calling inet ping c PINGLOG log void setlPprotocol Assigns IP protocol of the related socket iinChip w5100 c SOCKET s u_char ipprotocol char socket SOCKET S u_char protocol u_int port Creates sockets related to as TCP UDP IP iinChip socket c u_char flag void close SOCKET s Closes the related socket iinChip socket c int sendto SOCKET s Sends Datagram packet to specific iinChip socket c const u_char buf u_int len destination u_char addr u_int port int recvfrom SOCKET s u_char buf u_int len u_char addr u int port Receives Datagram packet from any destination iinChip socket c SOCKET getSocket unsigned char status SOCKET start Searches for socket has the designated status util sockutil
38. 3 28 HTTP MESSAGE BETWEEN EVB B D AND WEB BROWSER gt HTTP Request Message Ex1 gt GET wiz_log gif HTTP 1 1CRCF Accept image gif image x xbitmap image jpeg image pjpeg application vnd ms powerpoint application vnd ms excel application ms word CRCF Accept Language koCRCF Accept Encoding gzip deflateCRCF User Agent Mozilla 4 0 compatible MSIE 5 01 Windows NT 5 0 NET CLR 1 3705 CRCF Host 192 168 0 2CRCF Connection Keep AliveCRCF CRCF GET http 192 168 0 2 LCDNLED CGI Icd hi EVB B D amp led0 on HTTP 1 1CRCF Accept image gif image x xbitmap image jpeg image pjpeg application vnd ms powerpoint application vnd ms excel application ms word CRCF Accept Language koCRCF Accept Encoding gzip deflateCRCF User Agent Mozilla 4 0 compatible MSIE 5 01 Windows NT 5 0 NET CLR 1 3705 CRCF Host 192 168 0 2CRCF Connection Keep AliveCRCF CRCF HTTP Response Message Ex1 gt HTTP 1 1 200 OK CRCF Content Type text htmICRCF Content Length 1451 CRCFCRCF Html Document HTTP 1 1 200 OKCRCF Content Type gif imageCRCF Content Length 613CRCFCRCF GIF IMAGE Web Server program is composed of web server to manage HTTP server socket and proc http to manage HTTP message Fig 3 18 is processing procedure Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y s Jesf YAV 1030015M WwW IZnet C web server L Declare amp Initialize Local Variables u_char http_re
39. 30015M WiZnet Silicon Proven TCPAP Technology WiZnet provides the simplest Internet connectivity using memory like hardware TCP IP chips and Component modules lt Fig 2 19 Default Web Page of EVB B D gt If Control button on the Web Page in lt Fig 2 19 gt is clicked it can set the network information or show the web page that can turn on or off LEDs D3 D4 and display rows of text on Text LCD display Source IP fi 92 168 000 002 Gateway IP 192 168 000 001 Subnet Mask 255 255 255 000 DNS Server IP 000 000 000 000 MAC Address 00 08 DC 00 00 35 Network Config T LEDO Q 182 168 000 002 fF LEDI X LCD amp LED Config lt Fig 2 20 Web Page of EVB B D Control gt Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN HAV 1030019M WiZnet 2 5 Troubleshooting Guide 2 5 1 Ping When you can not reach EVB B D by Ping commana Step 1 Check if you connect correctly test PC and EVB B D with UTP cable Step 2 Check if interface jumper of JP3 is correctly set JP3 SPI mode pin2 3 should be connected Bus mode pin1 2 should be connected Step 3 Check if you correctly change your test PC s network environment IP address Gateway Subnet If not you should change it as follows IP address 192 168 0 3 Gateway address 192 168 0 1 Subnet Mask 255 255 255 0 Step 4 Check if link LED of MAGJACK left LED from rear view is on If it is off check UTP
40. 6 WIZnet byte decided Request Reply and fields after ciaddr is used to deliver network information and options field of 312 byte is used to transmit message type or the information such as Client Identifier o 15 16 31 op 1 htype 1 hlen 1 haps 1 xid 4 secs 2 flags 2 ciaddr 4 siaddr 4 giaddr 4 jenuew S 19SN HAV LO300 LSM If this bit is setto 1 the DHCP Message SHOULD be sent as using an IP Broadcast address preferably 255 255 255 255 as the IP destination address B Leftmost Bit chaddr 15 MBZ Must Be ZERO Reserved for future use sname 64 go DM OT file 128 options 312 lt Fig 3 26 DHCP Message Format gt lt Table 3 32 DHCP Message Data Type gt typedef struct RIP MSG u_char op DHCP_BOOTREQEUST or DHCP_BOOTREPLY u char htype DHCP HTYPE10MB u char hlen DHCP HLENETHERNET u_char hops DHCP_HOPS u long xid DHCP XID u int secs DHCP SECS u int flags DHCP FLAGSBROADCAST u_char ciaddr 4 u char yiaddr 4 u_char siaddr 4 u_char giaddr 4 u char chaddr 16 u char sname 64 u_char file 128 u_char OPT 312 RIP_MSG DHCP Message of lt Fig 3 26 gt is managed by RIP_MSG Data Type defined in lt Table 3 33 gt Refer to inet dhcp h To take a brief look at the Option Field of DHCP Message Option Field has the form
41. 6 Network Information gt Name Description Default Value NET_TEST Valid check of Network OXA5A5 Valid Information Others Invalid NET_SIP Source IP Address 0xC0A80002 192 168 0 2 NET_GWIP Gateway IP Address 0xC0A80001 192 168 0 1 NET SN Subnet Mask OxFFFFFFOO 255 255 255 0 NET_DNS DNS Server IP Address 0x00000000 0 0 0 0 NET_MEMALLOC W5100 Memory Allocation 0x55 Network Information is accessed as NETCONF Data Type lt Table 3 7 NETCONF Data Type Definition gt Type Definition Global Instance typedef struct _NETCONF NETCONF NetConf 3 u_int test u_char mac 6 u long sip u_long gwip u_long sn u_long dns u_char mem_alloc NETCONF lt Table 3 8 Network Information Access Functions gt Function Description void set_netconf NETCONF pNetConf Save the Network Information void get_netconf NETCONF pNetConf Get the Network Information Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN HAV LO300LSM 23 VIZnet 3 1 2 3 Channel Information Following table introduces applications to be used in 4 channels of W5100 lt Table 3 9 Channel Information gt jenueN S 19SN HAV LOI300LSM Name Description Default Value CH TEST Valid check of channel 0xA5A5 Valid Information Others Invalid CH TYPE X Application type of Default LB TCPS No X Channel NOTUSE Not Us
42. 8 Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN YAV 1030015M VIZnet lt Table 3 14 W5100 s DEFINE Option types h gt define _ENDIAN_ LITTLE 0 define _ENDIAN_BIG_ 1 define SYSTEM ENDIAN _ENDIAN LITTLE define DEF IINCHIP DIRECT MODE 1 define DEF IINCHIP INDIRECT MODE 2 define DEF IINCHIP SPI MODE 3 tidefine DEF IINCHIP BUS DEF IINCHIP DIRECT MODE itdefine DEF IINCHIP BUS DEF IINCHIP INDIRECT MODE i define DEF IINCHIP BUS DEF IINCHIP SPI MODE Since EVB B D is Little Endian system SYSTEM ENDIAN should be defined ENDIAN LITTLE and used If the target system is Big Endian the defined items should be defined ENDIAN BIG If W5100 is intended to be used as different mode other than Direct Bus Mode use desired Bus Mode defined as DEF IINCHIP BUS instead of DEF IINCHIP DIRECT MODE If DEFINE OPTION of W5100 is changed the sources must Re Build To Re Build project do make clean then make In case of SPI mode be sure to change the configuration of JP3 in the W5100E01 AVR board For more detail refer to Chapter 2 1 1 EVB B D Layout Configuration 3 2 3 How to download For downloading the hex file we use AVRStudio and AVRISP Cable 1 Connect AVRISP Cable to JP3 at the PM A1 Supply the power to EVB B D Run AVRStudio exe BR oO IM Select ATmega128 in Device section 5 Select the HEX file in
43. AGE FORMATS eterne tete tenete tette eerte tete teens 77 lt FIG 3 35 HEADER SECTION FORMAT nnne nenne tete nennen rrt nennen rennen 77 lt FIG 3 36 QUESTION SECTION FORMAT ccsessssssssssescssssssseseseseseucseneseseseeesesesesesesesesessneseseseseeeeceeesees 77 lt FIG 3 37 RECODE RESOURCES FORMAT eterne tenete tentent eterne tete 78 lt FIG 3 38 GETHOSTBYADDR amp GETHOSTBYNAME gt cccssssesesesesesscsescsesesceceescsesesesesessneneseseaeeeeceesees 80 lt FIG 3 39 DNS QUERY c O OE E PO SO nu TEONE TEATE ETE 81 FIG 3 40 DNS_MAKEQUERY gt c cscssssssssesesecessesescsescessssesesesesessssssseseseseecesesssssesesesesessaececssseseneaeecessees 82 lt FIG 3 41 EXAMPLE OF QNAME FIELD TRANSFORMATION OF QUESTION SECTION sss 83 lt FIG 3 42 DNS_PARSE_RESPONSE gt ccccsssssessssesesescscesesesesesesesesueseseneseseseeseseseseaesesesesesusueseseseseseeeeeesees 85 lt FIG 3 43 DNS_PARSE_QUESTION 8 DNS_ANSWER gt ccccsscsesessssssssesceceeecesseesesesesesesnenssescseseseecesesees 87 FIG 3 44 PARSE_NAME gt cccccccssssssssssesssesesessssesescscesssssscsesesesusscsssessseseececesessseseseseseaeecesssseseneneecesssees 88 lt FIG 3 45 DNS MESSAGE COMPRESSION SCHEME teens 89 lt FIG 4 1 EVB B D BLOCK DIAGRAM gt c cccsesessssssesesesesceesesesesesesusneseneseseseesesesesesesesesesessseseseseseseeceeesees 92 lt FIG 4 2 PM A1 MODULE DIMENSION eere enne nennen
44. BASE 08000 baie if _DEF_I INCHIP_BUS__ DEF I INCHIP_DIRECT_MODE__ loopback h detine COMMON_BASE _DEF_11NCHIP_MAP_BASE__ manage h Helse T md5h def ine COMON BASE 0x0000 endi myprintf h define _DEF_IINCHIP_MAP_TXBUF__ COMMON BASE Ox4000 Internal Tx buffer address of the iinchip pgmspace h define DEF IINCHIP MAP RXBUF COMMON_BASE 0x6000 Internal Rx buffer address of the inchip ping h ping_app h Ei portpins h BBD WWIZNET Wey WWS1LO0E01 AVRWWSL00EVB_FW Wmaintmain c EI DZWWIZNETWMYWWS100EO1 AVRWWS5100EVB FWWmcuWtypes h E romfs h searchfile h Build serial h avr objcopy 0 ihex R eeprom WS5100E01 AVR elf W5100E01 AVR hex sfr defs h avr objcopy j eeprom set section flags eepron alloc load change section lma eeprom 0 0 ihex U5100EOl AVR elf W5100E01 AVR eep 5 socket h sockutil h AVR Menory Usage stdarg h stddef h Device atnegal28 t stdint h E stdio h h string h 5 timer h E types h 73 util h Data 2154 bytes 52 6 Full data bss noinit Program 82334 bytes 62 8 Full text data bootloader version h 5 w5100 h b webserver h amp Other Files a Build succeeded with 0 Warnings Ba El GL Ou AF Me lt ATmega128 nas Coli After compile is completed a hex file will be created in the folder that user defined before This file will be programmed in Atmega12
45. Co Ltd All rights reserved Jenue y S Jesf HAV 1030019M 85 VIZnet dns_parse_response of lt Fig 3 42 gt analyzes Response Message received by DNS Name Server dns_parse_response checks if it s same as Request Message ID that was sent to DNS Name Server and it also checks if the message received is a response message by checking QR Field of Header Section If the received message is response from DNS Name Server the success of change is decided by checking the RCODE Field value of Header Section lt Table 3 42 gt is definition of constants that are used in RCODE Field jenueW S 19SN HAV LO300LSM lt Table 3 41 Constant Definition at Header Section s RCODE Field gt Definition Description define RC NO ERROR 0 No error condition define RC FORMAT ERROR 1 Format error The name server was unable to interpret the query define RC SERVER FAIL 2 Server failure The name server was unable to process this query due to a problem with the name server define RC NAME ERROR 3 Name Error Meaningful only for responses from an authoritative name server this code signifies that the domain name referenced in the query does not exist define RC NOT IMPL 4 Not Implemented The name server does not support the requested kind of query define RC REFUSED 5 Refused The name server refuses to perform the specified operation for policy reasons If the RCODE is RC NO ERROR var
46. EN status until any client s connection At this point when any client tries to connect to the server socket the server socket status is changed from SOCK_LISTEN to SOCK_ESTABLISHED This is when the connection between Client and Server is complete and data transfer is possible in SOCK_ESTABLISHED status Data is transferred using recv and send at the SOCK_ESTABLISHED The data transfer here is 1 on 1 transfer between EVB B D The server and AX1 The client In the SOCK_ESTABLISHED status if the client requests closing of the connection the server socket status is changed from SOCK_ESTABLISHED to SOCK_CLOSE_WAIT In SOCK_CLOSE_WAIT status data communication is not available and the server socket must be closed In SOCK_CLOSE_WAIT status disconnect is called to close socket disconnect changes the socket status to SOCK_CLOSED regardless of previous socket status Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN YAV LOSOOLSM 50 VIZnet 3 2 6 2 Loopback TCP Client At Loopback TCP Client program EVB B D works in client mode and AX1 PC test program works in server mode EVB B D tries to connect to AX1 which is waiting as the server if the connection is successful EVB B D receives data stream through TCP channel and then EVB B D sends back the received data stream to AX1 Loopback TCP client program is created with loopback_tcpc and lt Fig 3 15 gt is processing procedure of loopback_tcpc If
47. ERARERERRRRAREARRRRRRRERRRERAARRRERRAA AT Hinclude ncu def ine h define MCULAVR 1 define MCULTVPE NCU_AVR__ Refer Rom File Maker Manual Vx x pdf include avr pgmspace h socket c define ENDIAN LITTLE O lt This must be defined if system is little endian alignment sockutil c define ENDIAN_BIG_ i timer c define SYSTEM_END AN ENDI AN_LITTLE_ ude define MAX_SOCK_NUM 4 Maxmium number of socket zl wole define CLK_CPU 8000000 BMhz for serial S webserver c J Header Files sl INC s denne oe len f r taco EIE n n AA i efine DEF DBG involve debug code in driver socket c nel pelts define DEF_IINCHIP_INT__ lt involve interrupt service routine socket c e channel def ine DEF I INCHIP PPP involve pppoe routine socket c config h f it is defined the source files md5 h md5 c must be included in your project delay h Otherwize the source files must be removed in your project dhep h den det ine _DEF_I INCHIP DIRECT NODE 1 define DEF I INCHIP INDIRECT MODE 2 eprom h stdefi DEF I INCHI OD vb h vde e Li NCHI P_DI RECT MODE httpd h ine DEF FI INCHIP_INDI RECT HODE interrupt h def ine DEF_ NCHIP_BUS_ DEF I INCHIP SPI MODE Enable SPI_mode inttypes h io h te iom128 h brief __DEF_IINCHIP_MAP_xxx__ define memory map for iinchip ee define DEF I INCHIP MAP
48. FLASH section 6 Click Program button Please refer to AVR Tool Guide pdf for more information 3 2 4 EVB B D s main If we take closer look at main for certain amount of time we wait for Manage Program from RS232 Terminal after initialization of board with board reset At this point if RS232 terminal displays the Manage Program entering command EVB B D environment such as network information and channel Information can be set and ping request program can be run If Manage Program is done or there is no entering command from RS232 terminal the application for each of 4 channels of W5100 is executed and initialized using previously set network information lt Fig 3 3 gt process procedure of EVB B D main Refer to main main c Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN HAV LO300LSM 29 WiZnet If DHCP client exists in the application the DHCP client obtains the network information from DHCP server by calling get IP DHCPS function If DHCP client application does not exist or fails to obtain network information from DHCP server the EVB B D is initialized with previously set network information After the initialization it runs test applications of EVB B D by calling each registered application handler For further details on DHCP client program refer to Chapter 3 2 6 5 DHCP Client Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN YAV 1030
49. Fig 3 9 gt are processing procedures of ping request lt Fig 3 8 gt describes how tokens of inputs of Command Option and Option Value are created and the related Bit of Argument Flag PingArgsFlags is decided lt Fig 3 9 gt calls ping based on relevant option and option after checking the validity of command option and option value with bits of argument flag ping sends Ping request message to a certain destination and processes the ICMP message which is received from any destination Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN YAV 103001S5M 39 LZnet ping request Declare amp Initialize Local variables PINGLOG PingLog char command 81 char qname MAX GNAME LEN gt char NextTok Usage ping 4 3 n count 4 size wtimeout destination list A Options cher Peerlpl 50 Ping the specified host until stopped uJong peerip To see statistics and continue type Control Break char Ping rgsFlags t To stop type Control C int pingent pingsize pingtimeout a Resolve addresses to hostnames ncount Number of echo requeststo send size Send buffer size Display the Usage of Ping wtimeout Timeout in milliseconds to wait for each reply Call ping usage pingent pingsize pingimeout 0 Ping rgsFlags 0 Jenue y S Jesf HAV LOI00 LEM Get command from RS232 Console program pingent 1 Y C Ping rgsFlags 001 Get the value of n o
50. Finmwate LE 26 3 2 1 SOUMCOS NG ee 27 3 2 2 How to Compile ann 28 3 2 3 How to download sssssssse emere 29 3 2 4 EVB B D s main coccion pt 29 3 2 5 Manage Progr AM rrr tere robe 33 3 2 6 ADDIICATIONS m m 49 4 Hardware Designer s Guide sssssssssseeeeeeene nennen errem nennen nnne 92 4 1 Block Diagr ERR 92 4 2 Block DescriplliON cct er eee recen heec tenella exe e e a 93 4 2 1 gg 93 W5100E01 AVR User s Manual V Wiznet 4 3 4 4 4 5 4 6 4 2 2 LCD npare TEE ET EE ia 97 4 2 3 PAL EE NN 98 4 2 4 SRAM DM 98 4 2 5 A NS 98 4 2 6 Expanded Board Interface sssssssssse e 98 4 2 7 Power Regulator Ine e esee messes senes 100 4 2 8 3 3V Power On System Reset ararararanananavananananananenanenenenanenenenene 100 A a oaii aanhin aaaea aiaa aaa Eia 101 4 3 1 MAITE 2 gt 030520000000 EE ae 101 4 3 2 PAT O A 101 PALM ic O cose ceee 102 4 4 1 IDefine s Bees te Meee H R 102 4 4 2 External SRAM Area 1 A occ Rees 103 4 4 3 LCD Area O RB eee eee 103 4 4 4 W5100 Areagtff M aeaea Eee BR 104 Parts List A BE ED EA 106 4 5 1 W5100E01 AVR Parts List sss me 106 4 5 2 EMMA Paris Liste ER Ness 106 PhysicallSpecification Memes ic 107 4 6 1 Poweneonsumption SEMR iseesssssssssssseee nenne eene nnne 107 W5100E01 AVR User
51. G The saved Ping log can be output with RS232 terminal through DisplayPingStatistics function lt Fig 3 12 gt shows the process procedures of DisplayPingStatistics CheckSumErr field is incremented by 1 whenever the checksum of Ping Reply from peer is not correctly received Unreachable MSG field and TimeExceedMSG field are incremented by 1 in case of receiving Unreachable Message or Time Exceeded Message from peer or gateway UnknownMSG field is incremented by 1 when the unknown message is received Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN HAV LO300LSM 43 WiZnet ARPErr field is incremented by 1 whenever ARP reply is not received upon ARP request to get the Hardware address MAC Address of the peer PingRequest field is incremented by 1 whenever ping sends Ping request PingReply field is incremented by 1 whenever Ping reply for Ping request from the peer is received Loss field is incremented by 1 whenever Wait Timeout is occurred because nothing is replied to the peer in certain period of time after sending Ping request Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN YAV 1030015M 44 WiZnet ping Local Variable Declare amp Init SOCKET s 1 PING PingRequest PING PingReply bLoop 0 RemainTime 0 IsReceived 0 long peerip inet_aton addr PingRequest type 8 a PingRequest code 0 RemainTime time 2 PingR
52. G 100A T become a WS100A LF Wimet Partner nChip NM7000A more TCP IP Ethernet Module NHI7000A is the mini network module including W3100A hardwired TCPAP chip Ethernet PHY and other glue logics It can be used WIZnet News HORE WizZnet Inquire of Download WiZnet Center Q amp A 2005 04 12 WiZnet Office Relocation TECHNICAL SUPPORT AWE C nChip inam City Kyunggi do 463 818 Kor S KOREAN Wiznet Products Technology Support Howtobuy News Partners About us If you find the best network solution here is WIZnet WIZnet provides the simplest and smartest Internet connectivity using memory like TCP IP chips and component d SUPPORT O Q amp A En HOME gt SUPPORT gt Q amp A 0 OLA En a O Q amp A Kr No SUBJECT NAME DATE HITS D FAQ 45 Serial configuration of IM710 0 E 20050341 110 Lead free Status 44 How check that Tx buffer is em 0 Vityusha 20050310 105 0 Download 43 API for AVR Codevision 0 Luke 20050340 89 Related Link 42 hanging problem 0 Dg 20050309 114 41 dynamic timeout 0 Biler 20050308 84 CONTACT US fad 40 RE dynamic timeout 0 June 20050309 93 Marketing amp Sales 39 IM7010A interrupt problem 0 Marcin 20050308 103 T Support 38 RE IM7010A interrupt proble 0 dune 20050309 97 37 Interrupt 0 Biler 20050308 93 36 BRE interrupt 0 June 2005 03 09 96 reload write 12345 net W5100E01 AVR User s M
53. P Address or Domain Name depending on Query Type lt Fig 3 39 gt is dns_query s process map Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN HAV LO300LSM 80 IZnet Declare amp Initialize Local Variables u_int port u_char response_received 0 char qname dns_buf u char TX BUF get domain name dns buf MAX DNSMSG SIZE query data querydata Jenue y S 19SN HAV LOI00 LEM RETURNO Send the query to the DNS Server sendto dns_buf dnsip IPPORT_DOMAIN C N Y Wait 10ms i wait 10ms 1 A EE N Y Close the socket Receive a answer fromthe DNS Serve close s recvfrom dns buf reponse received Y Analyze the answer dns parse reponse Huer data BY NAM pl domain_ip get_domain_ip N Copy get domain name to domain name strcpy domain name get domain name RETURN 1 Fig 3 39 dns query gt 81 Copyright 2007 WIZnet Co Ltd All rights reserved IZnet dns_makequery Declare amp Initialize Local Variables char query dns buf u char domain tok u int domain Jen u int qtype u int qclass u i data BYNAWE a atype TYPE A atype TYPE PTR Header Section qclass CLASS IN query MAKE FLAG 00 query MAKE FLAG 10 n u_intiquen 1 Question Section query dns_buf DHDR_SIZE domain len strlenfqname domain Jen domain tok qnam domain_len gt 63 Y RETURNO N query domain Jen memcpy query qname doman len
54. P Gender Type Option lt Table 1 2 Contents of Software gt Directory Contents W5100E01 DOCs Manual User s Manual AVR Datasheet All sorts of Datasheet Application Note AVR Tool Gudie ISP Gender Guide HW Schematics All sorts of schematics Part List All sorts of Part List PAL Logic Source amp JED File SW Firmware EVB B D Firmware PC Utility All sorts of Tool Program W5100 e The contents of Software could be changed by version Please check the official website of WIZnet Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN HAV LO300LSM VIZnet 1 2 Feature 1 2 1 H W Features W5100E01 AVR B D is composed of 2 type B Ds OQ PMA MCU ATmega128 8MHz RAM 32KB SRAM External ROM 128KB Flash Atmega128 Internal Flash ICE I F JTAG ISP Support W5100E01 AVR Power DCSV 2A Adaptor UART Two 232 Serial Port default 57600 Baud Rate LCD Display 16 X 2 Text LCD PAL Address Decoder W5100 Hardwired TCP IP Chip embedded PHY chip MagJack RD1 125BAG1A UDE Integrated Transformer 1 1 Link amp ACT amp FDX LEDs 1 2 2 F W Feature The F W of EVB B D is made up of two parts Manager mode Network Config MAC Source IP G W IP S N DNS IP Setup Channel Config W5100 Test Application Setup for each channel Ping Test Ping Request Test with DNS Application mode Loopback TCP Server TCP Server Mode Test Application Loopback TCP Client
55. PD 0 7 JP5 43 PD1 SDA JP4 47 PD2 RXD1 JP4 45 PD3 TXD1 JP5 34 PD4 JP5 35 PD5 JP5 36 PD6 JP5 37 PD7 JP4 48 RXDO lO RXDO is connected with PEO JP4 46 PE1 TXDO through 1K ohm resistor JP5 38 PE2 PE 1 7 JP5 44 PE3 JP5 23 PEA I2CHIP IRQ JP5 46 PES JP5 6 PE6 JP5 8 PE7 JP5 13 PFO O PF 0 7 20 PF7 Copyright 2007 WIZnet Co Ltd All rights reserved enue S 19SN YAV LOSOOLSM 94 VIZnet JP4 41 ANR PGO I O PG 0 4 without ALE PG2 JP4 42 RD PG1 JP5 40 PG3 LED_0 JP5 41 PG4 LED_1 JP5 4 CPU_RESET Reset Signal Input process generated by EVB B D s Reset Switch SW3 JP5 1 2 3 3V 3 3V Power Input JP4 1 2 5V 5V Power Input Not Used JP5 10 12 21 GND Signal Ground JP5 22 45 47 JP5 48 49 50 JP4 23 24 49 50 JP5 3 5 7 9 11 RESO RESERVED LINE JP4 19 20 21 22 2 33 34 35 36 RES18 37 38 39 40 43 44 JP5 24 NC 25 NC 39 NC Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN HAV L0300L6M 95 VIZnet AVR ISP JP3 Pin Mapping PDO YCC GND GND CPU RESET GND SCK GND PDI GND jenueW S 19SN HAV LOJOOLSM lt Table 4 2 ISP Pin Description gt SIGNAL Pin Number I O Description VCC 2 Power is delivered to the AVRISP GND 3 4 6 8 10 Ground PDO 1 Input Commands and data from AVRISP to EVB B D PDI 9 Output Data from EVB B D to AVRISP SCK 7 Input Serial Clock Controlled by AVRISP CPU_RESET 5 Input Reset Co
56. Ping reply message were done by ping The elements of ping are of destination IP address Ping reply wait time number of Ping requests Ping data size and received Ping Replies are analyzed and processed to fit the elements lt Fig 3 11 gt is the process of ping and Ping message is defined and used as the data type of lt Table 3 21 gt Refer to inet ping h Copyright 2007 WIZnet Co Ltd All rights reserved jenuew S 19SN HAV LO3I00 LSM 42 VIZnet lt Table 3 20 PINGMSG Data Type Definition gt typedef struct PINGMSG char Type 0 Ping Reply 8 Ping Request char Code Always 0 u_short CheckSum Check sum u_short ID Identification u_short SeqNum Sequence Number char Data PINGBUF LENJ Ping Data PINGMSG Data field size of PINGMSG is of PINGBUF_LEN Byte PINGBUF_LEN is defined as 32 However data field max size may be 1472 This is because the sending MTU of W5100 is 1480 bytes and the sum of Code CheckSum ID and SeqNum Field Size is 8 Bytes If we subtract 8 from 1480 we get 1472 Hence the size is 1472 bytes The results from ping are saved in Data Type defined in lt Table 3 22 gt lt Table 3 21 PINGLOG Data Type Definition gt typedef struct PINGLOG u_short CheckSumErr u short UnreachableMSG u short TimeExceedMSG u short UnknownMSG u short ARPErr u short PingRequest u short PingReply u short Loss PINGLO
57. QNAME and NAME are variable length fields which are composed of lt Fig 3 36 gt Format and they process each field RDDATA variable length field processes using the data length of RDLENGTH Field For further details refer to RFC1034 and RFC1035 DNS Message is operated by Data Type defined in lt Table 3 38 gt Refer to inet dns h Copyright 2007 WIZnet Co Ltd All rights reserved jenueWw S 19SN HAV LO3I00 LSM 78 WiZnet lt Table 3 37 DNS Message Data Type gt Header Section typedef struct DHDR u_int id Identification u_char flagO u_char flag1 u_int qdcount Question count u_int ancount Answer count u int nscount Authority name server count u int arcount Additional record count JDHDR jenueN S 19SN HAV L03001L6M Question Section typedef struct QUESTION char qname Variable length data u_int qtype u_int qclass DQST Resource Records typedef struct RESOURCE RECORD char name Variable length data u int _type u_int _ class u long ttl u_int _rdlen char _rdata Variable length data JDRR DNS Resolver works based on gethostbyaddr and gethostbyname gethostbyaddr transforms Internet IP Address to Internet Domain Name and gethostbyname transforms Internet Domain Name to Internet IP Address gethostbyaddr and gethostbyname test the setup of DNS Name Server IP Address and search free c
58. Server Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN YAV 1030015M WiZnet Mini Term File E Configure C Transfer I Help H Y Check the IP Conflict No Conflict gt Get network information from DHCP Server DHCP Client Start Log AEIEHEIEIEHEH TEIEHEHETETEHEH TEREHE HE ETEHE HE ETEHE E EIER ETE HET HET I E W5166E61 AUR Test in Direct Mode AEH Copyright WIZnet Inc 2667 http www wiznet co kr support amp viznet co kr sales wiznet co kr F W Version H W Version HAC Addr 66 68 DC 66 66 66 Source IP 192 168 8 2 Gateway IP 192 168 8 1 Network Information received from DHCP Server Subnet Hask 1255 255 255 8 DNS Server IP 6 0 0 0 Mem alloc 55 HAH Loop Back TCP Server Started 1 Loop Back TCP Server Started 2 Loop Back TCP Server Started 3 Loop Back TCP Server Started Connected 57600 8 None 1 None Capture OFF lt Fig 2 14 DHCP Client Test gt 2 4 2 2 Loopback TCP Server Loopback TCP Server Application is an application that loops back any file or packet data through TCP channel connected with AX1 Program of Test PC First of all set any channel as Loopback TCP Server application type using Manager gt gt Channel Config menu of EVB B D to test Loopback TCP Server When setting up Loopback TCP Server application type of EVB B D you can set listen port to any value Here it s set as the default
59. TCP Client Mode Test Application Loopback UDP UDP Test Application Web Server Web Server Test Application DHCP Client Dynamic Network Config using DHCP Server Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN HAV LO300LSM VIZnet 2 Getting Started 2 1 System Configuration 2 1 1 EVB B D Layout amp Configuration For testing the functions of the EVB B D and developing applications the EVB B D should be configured as shown below First the EVB B D is connected to the PC using the crossed UTP Cable for data transmission and the Serial Cable for monitoring Second the dip switch and jumper should be set as below O gt 200000000nm m Beeee ee0 al e Ne00000000000000 1 J3 s 3 gt 3 ac an eee eee eee eee eee eco eco 900 lt Fig 2 1 EVB B D Jumper Setting gt D SPI Enable J3 For interfacing W5100 with MCU through SPI mode the pin of 2 and 3 of JP3 should go short In case that SPI mode is not used the pin of 1 and 2 should be shorted BUS 1 SPI Fig 2 2 JP3 Jumper Setting gt Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y s Jesf YAV 1030015M VIZnet 2 2 PC Programs Install 2 2 1 Development Program Install Please refer to AVR Tool Guide Vx x pdf
60. Te RD RA Z bit RCODE abit ARCOUNT lt Fig 3 35 Header Section Format gt Wariable Length 2 Bytes 2 Bytes lt Fig 3 36 Question Section Format gt Copyright 2007 WIZnet Co Ltd All rights reserved jenuew 49SM HAV LOI00 LEM Um Length Length lt Fig 3 37 Recode Resources Format gt Header Section of DNS Message holds type of Message DNS Query type and count information on variable length section In lt Fig 3 35 Header Section Format gt QR field gets 0 when DNS Message is a request from Resolver to Name Server and gets 1 when it s from Name Server to Resolver Opcode Field gets 0 when it queries Domain Name as IP Address and gets 2 when it queries Name Server status QDCOUNT ANCOUNT NSCOUNT and ARCOUNT Field count information for variable length represent Block Count that is composed of Question Answer Authority and additional section Question section is made of blocks shown in lt Fig 3 36 Question Section Format gt Answer Authority and Additional Sections are composed of blocks shown in lt Fig 3 37 gt For example if QDCOUNT is 1 ANCOUNT is 10 NSCOUNT is 10 and ARCOUNT is 10 then Question Section is composed of block 1 of lt Fig 3 36 Question Section Format gt Answer Authority and Additional Section are composed of 10 blocks shown in lt Fig 3 37 gt NAME of lt Fig 3 37 gt QNAME Filed of lt Fig 3 36 gt and RDDATA Field also get variable lengths
61. W5100E01 AVR User s Manual Version 1 1 0 TT 5 T WIZnet W5100E01 AVR 2007 01 30 WiZnet 2007 WIZnet Co Ltd All Rights Reserved For more information visit our website at http www wiznet co kr WiZnet Document History Information Ver 1 0 0 Febrary 1 2007 Original Document The software CD is not provide anymore For more software contents please visit our website Ver 1 1 0 June 17 2013 www wiznet co kr modified the comment about S W CD CH 1 1 4 3 1 4 3 2 4 4 4 4 5 1 4 5 2 W5100E01 AVR User s Manual WiZnet WiZnet s Online Technical Support If you have something to ask about WIZnet Products Write down your question on Q amp A Board in WIZnet website www wiznet co kr WIZnet Engineer will give an answer as soon as possible HOME SITEMAP CONTACTUS KOREAN Wiznet Products Technology Support How to buy News Partners About us FAQ Lead free Status Download If you find the best network is WiZnet WIZnet provides the simplest and smartest Internet connectivity using memorydike TCP IP chips and component modules Products products name lt Wy Hardwired TCP IP Why WZnet tech is E unique amp competitive TOE IPv6 Core EG EG SR 7100A EVB nore IIM7 100A Evaluation Board NM70004 is the mini network module including W3100A hardwired Lead free How to TCPIIP chip Ethernet PHY and other glue logics It can be used VI
62. Znet 2 3 Quick Start After the confirming the Package of EVB B D test EVB B D in the order shown below CD Confirm the testing environment Refer to Chapter 2 1 Connect test PC to EVB B D using UTP cable directly Connect test PC to EVB B D using serial cable directly Connect 5V power adaptor to EVB B D Confirm the network information of Test PC as the following Source IP Address 192 168 0 3 Gateway IP Address 192 168 0 1 Subnet Mask 255 255 255 0 Install AX1 on Test PC Refer to Chapter 2 2 2 1 After the execution of serial terminal program like Hyperterminal set up the properties as the following Table 2 1 Terminal Properties Setting Properties Setting Value Bits Per second Baud Rate 57600 bps Data Bits 8 Bits Stop Bits 1 Bit Parity No Flow Control None After the completion of terminal setup connect to EVB B D and wait Turn on the power switch SW1 of EVB B D Following items should be checked upon power on Check lighting on power LED D2 of EVB B D when powering on Check if LEDs of D3 and D4 blink three times by turns Check if Text LCD display of EVB B D outputs in the way shown in Fig 2 3 and shown in Fig 2 4 on the Terminal Program After about 7 seconds Fig 2 3 EVB B D Text LCD Display gt Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y s Jesf YAV 1030015M VIZnet Mini Term File E Configure C Transfer T Help
63. al website of WIZnet www wiznet co kr jenuew 49SM HAV LOI00 LEM 101 Copyright 2007 WIZnet Co Ltd All rights reserved VIZnet 4 4 PAL In EVB B D PAL creates Chip Select Module Enable The address map of EVB B D is same as lt Fig 3 1 EVB B D Memory Map gt The EVB B D supports 3 enable signal Chip Select as shown in the address map of EVB B D jenueW S 19SN HAV LO300LSM EVB B D provides VHDL Code For developer who uses PAL element CUPL is recommended since it is a freeware PAL Compiler WINCUPL of ATMEL co can be used after simple registration Use it with AWINCUPL EXE that is downloadable from ATMEL Homepage Refer to AVR Tool Guide pdf for usage 4 4 1 IO Define The following is VHDL Source code entity evb_pal is port Addr in std logic vector 15 downto 10 nRD in std logic nWR in std logic nRAMCS out std logic nCS IINCHIP out std logic LCDCS out std logic The following is CUPL Source code 102 Copyright 2007 WIZnet Co Ltd All rights reserved rig kkkkkkkkkkkkkkk INPUT PINS kaii ra PIN 1 6 A10 15 address upper 6bits PIN 7 nRD read signal PIN 8 nWR write signal fr eee OUTPUT PINS renn PIN 12 nCS RAM External SRAM CS PIN 13 LCD E LCD CS PIN 14 2 nCS IINCHIP iinChip CS 4 4 2 External SRAM Area External SRAM area is ranged from 0x0000 to Ox7fff The following is a VHDL Source Code that makes SRAM CS
64. ansion through Expanded Interface 4 2 4 SRAM SRAM with the size of 32Kbytes is used as external data memory of Atmega128 4 2 5 RS232 Port It s a interface for Dual Serial USARTs that is supported by Atmega128 EVB B D uses 9Pin DSUB male Type P1 P2 connector 4 2 6 Expanded Board Interface Expanded board interface is designed to be developed easily using EVB B D Most of the port pin of Atmega128 output sinal of PAL PAL_OUT_0 PAL_OUT_4 power and many reserved pin are connected to Expanded Board Interface The Signals of Atmega128 that are not connected to Expanded Board Interface are 7 RXD1 PD2 TXD1 PD3 RXDO PEO TXDO PE1 LEDO PG3 LED1 PG4 I2CHIP_IRQ PE4 lt Table 4 4 Expanded Board Interface Pin Description gt Pin Pin Name Dir Description Bus Interface 66 34 67 35 A0 A1 A2 A3 O Parallel Address Bus 0 15 68 36 69 37 A4 A5 A6 A7 70 38 71 39 A8 A9 A10 A11 73 40 74 41 A12 A13 A14 A15 77 45 78 46 DO D1 D2 D3 O Parallel Data Bus 0 7 79 47 80 48 D4 D5 D6 D7 53 RD O Parallel Bus Read Strobe 86 IWR Parallel Bus Write Strobe 25 PAL OUT 0 O Reserved Parallel Bus Chip Select Enable 29 PAL_OUT_4 18 SDA PDO 1 0 12C Bus Data Line Port DO O Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN YAV 103001S5M 98 VIZnet 19 SCL PD1 O I2C Bus Clock Line Port D1 Atmega128 Por
65. anual iii WiZnet COPYRIGHT NOTICE Copyright 2007 WIZnet Ltd All Rights Reserved Technical Support support wiznet co kr Sales amp Distribution sales wiznet co kr General Information info wiznet co kr For more information visit our website at http www wiznet co kr W5100E01 AVR User s Manual VIZnet Table of Contents EE SEE eco det tl ie lie dd 1 1 1 Package 1 1 2 Ric 2 1 2 1 ph dtu e 2 1 2 2 FAM Fealur 2 2 Getting Started PP cinc recen 3 2 1 System G ntiguration occ EE nn 3 2 1 1 EVB B D Layout amp Configuration ccccc cece cece ec ee cece ee ee 3 2 2 Dexprograms Install 898 cc PEL 4 2 2 1 Development Program Install esses 4 2 2 2 EVB B D Test PC Program Install sess 4 2 3 Quick Start 8 Eua 008 200 O o m 5 2 4 EVB B D Test EE Mu ED 6 2 4 1 Manage Progamiem B FR EE AE aaa 7 2 4 2 EVB B D Test Applications ccccc cece cece eee e renee ene eee n eens eae eneenes 13 2 5 TroubleshoetingiGuide SES cocinera 18 2 5 1 2115 22200000 TI NN 18 2 5 2 Misc 222200 O JE 18 3 Vi grammer s Guide Aoc ici 19 3 1 Memory Map c 19 3 1 1 Code amp Data Memory Map rararararararararararenenenenenenenenenenenenenenenene 19 3 1 2 AVR Internal EEPROM MAP sssssssssssse mee eere 20 3 2 EVB B D
66. at of lt Fig 3 27 gt it contains Magic Cookie Field a Lease Identification Cookie with the size of 4 Byte and Code Set ranged from Code 0 to Code 255 From Code1 to Code 254 codes are composed of pairs of Code Len Value and Copyright 2007 WIZnet Co Ltd All rights reserved VIZnet Code 0 and Code 255 are composed of Code only For further explanation of each Code of Option Field refer to RFC1533 t D ONO Zero Padding Fig 3 27 DHCP Message s Option Field Format Table 3 33 DHCP Message Option Code Definition gt padOption used to cause subsequent fields to align on word boundaries subnetMask specifies the client s subnet mask routersOnSubnet a list of IP addresses for routers on the client s subnet dns specifies a list of DNS servers available to the client hostName specifies the name of the client dhcpRequestedlPaddr request that a particular IP address be assigned by the server dhcplPaddrLeaseTime a lease time for the IP address dhcpMessageType used to convey the type of the DHCP message dhcpServerldentifier the IP address of the selected server dhcpParamRequest request values for specified configuration parameters dhcpClientldentifier specify client unique identifier endOption marks the end of valid information In the Option Field of 312 Bytes the unused bytes are denoted with 0
67. be set repeatedly by channels but the same port number cannot be used Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN HAV L0300L6M 37 WiZnet lt Table 3 18 Constraint by Application Types gt Repeat Destination IP APPTYPE Port Repeat Setups Setup DHCP_CLIENT X X X O supports all the simultaneously LB TCPS connected clients as many as the number of repeated ports LB TCPC X LB UDP X O supports all the simultaneously WEB SERVER connected clients as many as the number of repeated ports START Display Config manage channel Oth Channel 1th Channel E 2th Channel Get the Channel Information 3th Channel get chconf amp ChConf Factory Reset Display Channel Config Menu Get the pressed Key sel uartd getchard Display Channel Information display_chconf Select Apps Type select ch appO LL ep ZR Factory Reset pr domes load factory chconfO Update Channel Information set chconf amp ChConf lt Fig 3 7 manage channel gt Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN HAV LOI00 LSM 38 VIZnet lt Table 3 19 Reference Functions in manage_channel gt Function Name Description Location u_char manage_channel void Configure Channel Information evb manage c void select_ch_app Select available Application Type and Setup evb manage c CHCONF pChConf u_char ch required fac
68. c O Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN HAV LOI300LSM 48 VIZnet 3 2 6 Applications Its a network application using W5100 It includes Loopback program Web Server and DHCP Client Application is selected by Manager Program 3 2 6 1 Loopback TCP Server The Loopback TCP Server program of EVB B D works as server mode and AX1 program of the testing PC works as client mode AX1 tries to connect to EVB B D and if the connection is successful AX1 transmits the data stream through the TCP channel EVB B D returns back the data stream from AX1 without processing through the TCP channel Loopback TCP Server Program uses loopback_tcps and lt Fig 3 14 gt shows the process procedure of loopback_tcps loopback_tcps Declare amp Initialize Local Variables u_char data_buf TX_BUF Y Select Socket Status getSn SR SOCK ESTABLISHED N Y Close Socket S OOK OLOSE WAN close ch o SOCK CLOSED Select Recieved Size len s D Y len getSn RX RSR Receive the Data recv ch data buf len Send the Received Data send ch data_buf len Create a TCP Socket socket ch SOCK STREAM port flag Y Wait a connetion with a client NBlisten ch RETURN DEE lt Fig 3 14 loopback_tcps gt
69. ck TCP Server Started Started i ac k p D 2 Loop Back UDP Started e Loopback UDP Application Log oop bac P erver arted lt Fig 2 17 Loopback UDP Test gt 2 4 2 5 Web Server Web Server Application sends and receives web pages and EVB B D control data through HTTP Channel connected with web browser For Web Server testing set up any channel of W5100 as Web Server Application Type using Manager gt gt Channel Config menu of EVB B D When setting up Web Server Application Type of EVB B D set HTTP port as any value Here it s set to 80 the default value Refer to Chapter 2 4 1 2 After setup for EVB B D run Web browser in the Test PC type the URL http 192 168 0 2 of the EVB B D in the address field and connect to EVB B D s 192 160 0 2 s 192 160 0 1 s 855 255 255 0 0 0 0 0 MAC Addr OxOO 0x08 0xDC O0x00 0x00 HUHHHHHHHEEHHSHEHHHSHHHHHHHHHHHHHHHHHEH O Loop Back TCP Server Started 1 Loop Back TCP Client Started 3 Web Started Web Server Application Log and 3 Connected by 192 168 0 30 2313 Peer Connection Information lt Fig 2 18 Web Server Test gt If the web browser is successfully connected to HTTP port of EVB B D the Web Page of lt Fig 2 19 gt can be viewed In case Web Page of lt Fig 2 19 gt is not shown refresh the screen using the Refresh function of the web browser Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN YAV 10
70. d in web page lt Fig 3 17 gt shows HTTP message flow between web server and web client lt Table 3 28 gt shows structure of HTTP message y Lum 845 Om rem quo I G aE a gt n sete t peot pa gaan aE HTTP Request HTTP Request HTTP HTTP Response Web Browser EVB B D Web Server lt Fig 3 17 HTTP Message Flow gt Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN YAV 1030015M 55 VIZnet HTTP message Simple Request lt Table 3 27 HTTP Message Format gt Simple Response Full Request Full Response Full Request Request Line General Header Request Header Entity Header CRLF Entity Body Full Response Status Line General Header Response Header Entity Header CRLF CRLF Entity Body Request Line Method SP Request URI SP HTTP Version CRLF Status Line HTTP Version SP Status Code SP Reason Phrase CRLF Entity Header Allow Content Encoding Content Length Content Type Expires Last Modified extension header Entity Body OCTET Method GET HEAD POST extension method For further information on HTTP message refer to RFC2616 HTTP request message varies according to web browser type Table 3 29 shows the examples of HTTP message communication between Internet Explores on Windows 2000 and EVB B D Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN HAV L0300L6M WiZnet lt Table
71. ed DHCP CLIENT DHCP Client LB TCPS Loopback TCP Server LB TCPC Loopback TCP Client LB UDP Loopback UDP WEB SEVER Web Server CH PORT X Source Destination Little Endian Port number of No X LB TCPS Default Source Port 0x5000 LB TCPC Default Destination Port 0x3000 LB UDP Default Source Port 0x3000 WEB SERVER 80 CH DESTIP X Destination IP addres of OxCO A80003 192 168 0 3 No X channel Channel Information is used for recording application type for 4 channels of W5100 Channel application type includes Loopback TCP Server Loopback TCP Client Loopback UDP DHCP Client Web Server Channel Information is defined as APPTYPE enumeration type Table 3 10 Channel Application Type gt typedef enum APPTYPE NOTUSE DHCP_CLIENT LB_TCPS LB_TCPC LB_UDP WEB_SERVER APPTYPE 24 Copyright 2007 WIZnet Co Ltd All rights reserved VIZnet Channel Information is accessed as CHCONF Data Type lt Table 3 11 CHCONF Data Type Definition gt Type Definition Global Instance typedef struct _CHCONF CHCONF ChCont u_int test struct CH CONF jenueW S 19SN YAV 103001S5M u_char type u int port u long destip jch 4 CHCONF lt Table 3 12 Channel Information Access Function gt Function Description void set_chconf CHCONF pChConf Save the channel information void get_chconf CHCONF pChConf
72. ed from Web Browser to Web Server SP Space text is transmitted in the form of and other Reserved Texts are transmitted in the form of HEXHEX Accordingly Reserved Texts in Request URI needs to be decoded to the previous value from to SP and from HEXHEX to related ASCII vales For the details of Request URI decoding refer to RFC1738 URI name of Request URI is extracted with get_http_uri_name Query String of Request URI can include one or more variable value pair that has 8 as a separator Through function get_http_param_value it can extract the wanted variable value in Query String get http url namet get http param valuet Declare amp Initialize Local Variables Declare amp Initialize Local Variables char tempURI MAX LIRI SIZE char tempURI MAX LIRI SIZE char uri name chars name NULL Copy uri to tempURI Get the LIRL name Token uri_name strtok tempURI Find param_name in tempURI name strstr tempURl param_name Extract the value of parma_name name stren param name 1 name strtok name amp vins Decoding the escape characters RETURN unescape http uri name Replace with SP RETURN replacetochar name SP Fig 3 22 get http uri name amp get http parse value gt CGI processing of Web Server Program at EVB B D is different from general Web Server Program which is Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y s Jesf YAV
73. el Config Ping App Test START ale Reset manage config Select Display the Config Menu Get the pressed Key sel uartd getchar Y Configure Network bmodify manage network Configure Channel O bmodify manage_channeD Test Ping App ping_requestO the Factory Reset Value load factory netconfO load factory chconfO bmodify 1 Y i Y EVB B D Auto Reset evb soft reset0 N lt Fig 3 5 manage config gt If the EVB B D is updated the EVB B D automatically reboots to apply the updated configuration Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN HAV LOI00 LEM 34 VIZnet lt Table 3 16 Caller Function at Manage Program gt Function Name Description Location void check_manage void Decision of Manage Program is executed or not evb manage c void manage_config void Manage Program evb manage c u_char manage_network void Configure Network Information evb manage c u_char manage_channel void Configure Channel Information evb manage c u_char get_reset_flag void EVB B D s Auto Manual Reset recognition and confirm Auto SYSTEM_AUTO_RESET Manual SYSTEM_MANUAL_RESET evb config h evb config c void set_reset_flag u_char flag Copy of EVB B D Reset status evb config c void load_factory_netconf void Factory Reset Network Information evb config c void load_factory_chconf void Factory Reset
74. equest checksum 0 PingRequest seqnum PingRequest id Random Integer Number PingRequest checksum 0 PingRequest seqnum Random Integer Number IsReceived 0 Fill in PingRegeust data with a to w alphabet Calculate Checksum of PingRequest Y Update PingRequest checksum ou PingLog PingRequest PingLog ARPErr Display Loss Ping Reply PingLog Loss PingLog ChecksumErr recei ec ingReply from Display or 20 Unknown Peer Y IsReceived 1 Calculate Check Sum of PingReply PingLog UnkonwMSG Displa fem IN eck Sum Error Error Y ingReply type N Display Unreachable Error PingLog UnreachableErr Y IsReceived 1 ingReply type N PingLog TimeExceedMSG 4 Y EDS IsReceived 1 ingReply N Send a Ping Reply to a peer EE B Reply type Call SendPingReply Sina alo N y PingLog PingReply PingLog UnkonwMSG IsReceived 1 Display Ping Reply OK lt Fig 3 11 ping gt Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S Jesf HAV 1030019M WiZnet Display PingStatistics Display a Title Display the Packet Count Sent ReceivedLost Display the Check Sum Error Count Disp
75. er using destip and destport which are sent as elements In loopback udp there is no example of using close but in case that the UDP communication is not needed anymore close can be always called to close the udp socket 3 2 6 4 Web Server Web Server program is a TCP server program using HTTP protocol which is used on TCP protocol Before building Web server program message structure of HTTP protocol that is transmitted between Web server and Web client Web browser are needed to be understood Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S JeSf HAV L0300L6M 54 WiZnet HTTP which stands for Hyper Text Transfer Protocol is a protocol used in Internet for transferring between Web server and client browsers lt Table 3 26 Web Browser s HTTP Request Operation Procedure gt Request of Client Web Browser gt URL Analysis Transforming Domain Name to IP Address at DNS gt Connection to server at the other end gt Client Web Browser requests document wanted from URL gt Sending Document Server Receiving Document Client gt Displays received document on the browser Web Server program analyzes method and URI Uniform Resource Identifier of HTTP Request message received from web browser In case the related URI simply requests for web page the page will be sent If it requests an action such as CGI Common Gateway Interface it takes the action and the result is informe
76. esesceseseseseaeseseseseanesesesesesesceceeesees 58 FIG 3 19 PROC HTTP s terrre atada ad 59 lt FIG 3 20 PARSE_HTTP_REQUEST gt ccccssssssssssesesescscecesesesesesesesussesenescseseesesesesesesesesesesnsneseneseseseeeeeesees 61 lt FIG 3 21 FIND HTTP_URI_TYPE gt c ccsssssssessssssescsescsssssesscsescsssssecessssssesescesssesssesesesssesucesesesssseneneecesseees 62 lt FIG 3 22 GET_HTTP_URI_NAME amp GET_HTTP_PARSE_VALUE gt ccscsssescsesesesesesesesnsesesesescseseeeesees 62 lt FIG 3 23 NETCONF CGI PROCESSING essent tette tette tenete 63 lt FIG 3 24 LCDNLED CGI PROCESSING gt cccccsscscscssssssssesesesesessesesesesescsceseseseseseseseseensacseneneaeseececesees 64 lt FIG 3 25 DHCP MESSAGE FLOW gt c cccccsesesssssscsescsssssessesesessssscessssesenenstsssesssesesesesesnasecneneneseneecesseees 66 lt FIG 3 26 DHCP MESSAGE FORMATS tentent tenete tereti tette tenete enn 67 lt FIG 3 27 DHCP MESSAGE S OPTION FIELD FORMAT esses enne 68 lt FIG 3 288 NIBDHCP CLIENT A 0000 BERI eee 69 Fia 3 Alert IP DHCPSQ uff 8 0 4 70 lt FIG 3 30 DHCP MESSAGE FLOW BY DHCP CLIENT STATE tenens 72 FIESB cue BC sr MD AR oaaae 73 lt FIG 3 32 PARSE DHCPMSG amp CHECK_DHCP_TIMEOUT gt cccsscsssescsesssssscseseseseseceseseseseseeeesees 74 lt FIG 3 33 DOMAIN NAME SYSTEM STRUCTURE amp DNS MESSAGE FLOW s sse 76 lt FIG 3 34 DNS MESS
77. esesesseeesseerssecneseseeseeesecs 48 TABLE 3 23 REFERENCE FUNCTIONS IN LOOPBACK TCPS ssssssssssssesesescseeeesesesesesesnsesseseseseseseeeesees 50 TABLE 3 24 REFERENCE FUNCTIONS IN LOOPBACK TCPO sssessssssssesesescsssessesesesesessucscseseseseeceesees 52 TABLE 3 25 REFERENCE FUNCTIONS IN LOOPBACK _UDP gt cssssssssssssesesescessecsesesesesesnceeseseseseeeecesesees 54 W5100E01 AVR User s Manual ix VIZnet lt TABLE 3 26 WEB BROWSER S HTTP REQUEST OPERATION PROCEDURE see 55 lt TABLE 3 27 HTTP MESSAGE FORMA eee 56 lt TABLE 3 28 HTTP MESSAGE BETWEEN EVB B D AND WEB BROWSER gt sss 57 lt TABLE 3 29 SYSTEM ENVIRONMENT VARIABLES USAGE AT EVBCTRL HTML gt ccccccssesesteseseeessesnenes 60 lt TABLE 3 30 ST HTTP HEQUEST DATA gt s e hat ati 61 TABLE 3 31 REFERENCE FUNCTIONS IN WEB_SERVER gt ccscssssssesessesessesesesscsesssesesesseseeneseecseesesnenes 65 lt TABLE 3 32 DHCP MESSAGE DATATYPE aids i arde it is 67 lt TABLE 3 33 DHCP MESSAGE OPTION CODE DEFINITION retener 68 TABLE 3 34 DHCP CLIENT STATE amp TIMEOUT DEFINITION erret 71 TABLE 3 35 DHCP MESSAGE FLAG FIELD SESUBSS sssseeneenen rl EG eee 71 lt TABLE 3 36 REFERENCE FUNCTIONS IN DHCP CLIENT trente tentes 75 lt TABLE 3 37 DNS MESSAGE DATA TYPE gt 0 200 00 RI 79 TABLE 3 38 QUERY TYPE DEFINITION AT DNS_QUERY gt ccccsessssssesessesesssse
78. essage can be divided into Method and Request URI by parse_http_request and stored in st_http_request Date Type which is defined in lt Table 3 31 gt lt gets the requested URI Type with get_http_uri_type lt Table 3 30 st_http_request Data gt define MAX_URI_SIZE 2048 sizeof char 2 typedef struct st http request u char METHOD request method METHOD GET u char TYPE request type PTYPE HTML char URI MAX URI SIZE request file name iu st http request parse http request d y Get a Method Token nexttok strtok buf SP e T mexttok NULL request gt method request gt method request gt method METHOD_GET METHOD_HEAD METHOD_POST Y Y Get a Request URI Token Get a Request URI Token nexttok strtok NULL SP nexttok strtok NULL 0 Y T iexttok NULE Y equest gt method METHOD_ERR EN AN Copy nexttok to request gt URI RETURN lt Fig 3 20 parse http request gt Copyright 2007 WIZnet Co Ltd All rights reserved jenue N S 19SN HAV LO300LSM 61 RETURN lt Fig 3 21 find_http_uri_type gt Request URI which is saved in URI MAX_URI_SIZE of st_http_request has URI Name before symbol and Query String after sign When Request URI is transferr
79. f HTTP request message by calling find_http_uri_type if HTTP request type is CGI it performs the related CGI command process jenue N S 19SN HAV LO300LSM After processing CGI commands or in case that HTTP request type is not the CGI search file with URI Name from ROM File Image which is built in EVB B D If the file is found create HTTP response message and send it HTTP Response message is composed of HTTP response header transmission and HTTP response body transmission For transmission of HTTP response header it calls make http response head using HTTP request type as the element to create HTTP response header After transmitting the created HTTP response header the HTTP response body is transmitted For example if the HTTP response body is any file in ROM File Image the files are much bigger than the MTU of W5100 Hence it has to be divided into maximum size of W5100 before transmission At this point if system environment variables that are defined in EVB B D in HTTP response body exist it calls replace_sys_env_value and replaces system environment variables to system environment value stored in EVB B D lt Table 3 29 System Environment Variables Usage at evbctrl html gt lt tr gt lt td width 110 height 22 gt lt font color F EFEEF gt lt font gt Source IP lt td gt td width 240 height 27 gt lt input name sip type text size 20 value SRC_IP_ADDRES gt lt td gt lt tr gt
80. gL og END of Processing Fig 3 9 ping request Continue 41 Copyright 2007 WIZnet Co Ltd All rights reserved VIZnet Let s take a brief look at Ping message before we proceed to Ping program Ping message has the value of 0 Ping Reply or 8 Ping Request at Type Field The Code Field of ICMP Message has 0 Type Dependant Data Field 4Bytes of ICMP Message can be re defined as ID Field 2Bytes Sequence Number Field 2Bytes respectively Data Field of ICMP Message is filled with the Ping data to be looped back Finally it calculates the checksum of ICMP header and Ping data of which the checksum fields are O After the calculation it replaces 0 checksum fields with the newly calculated values lt Fig 3 10 gt is a diagramming representation of the relationship between the ICMP message format and the Ping message Type Code 1 Byte 1Byte Checksurn Checksurn Bytes Type Dependent Data 4Bytes Sequence Number 2 Bytes Data Ping Data ICMP Message Ping Message lt Fig 3 10 ICMP Message VS Ping Message gt Checking the Ping reply to the Ping request can be processed by checking if the values of ID sequence number and ping data field are same or not In case the Ping reply does not come back in wait time the ping can be sent again In such case the Ping request is sent with the sequence number incremented by 1 Transmitting Ping request message and checking the
81. hannels of W5100 needed for connection with DNS Name Server If a free channel of W5100 exists gethostbyaddr and gethostbyname call dns query with BYNAME or BYIP as the elements For examples of gethostbyaddr and gethostbyname refer to Chapter 3 2 5 3 Ping Request Program Actual connection with DNS Name Server is performed through dns query and gethostbyaddr and gethostbyname are reporting only the result of dns query Table 3 38 Query Type Definition at dns query gt typedef enum _QUERYDATA BYNAME BYIP QUERYDATA Query type vg Copyright 2007 WIZnet Co Ltd All rights reserved VIZnet gethostbyname Declare Local Variables SOCKET s Y Get the network information of EVB get_netconf amp NetConf NetConf dns 0 NetConf dns OXFEFFFFFF N Y Find a Free channel getSocket SOCK_CLOSED Found Y YT Y DNS Server IP gt dess is not vw Configued 72 C RETURN 0 4 Not found a Free Socket j Communicate with the DNS Server dns_query s amp hostip BYNAME RETURNI dns_query initializes the buffer that is needed for DNS inter working and creates QNAME of Question Section based on Query Type BYNAME and BYIP If the Query Type is BYNAME that is when querying Fallo N communicate with the Server C RETURN 0
82. iable length sections such as Question Answer Authority and Additional Section are analyzed Since the necessary information is set in Answer Section it s analyzed and processed and other section analysis and process are not performed If you need information on Authority and Additional Section you can get them easily on your own Question Section is processed as many as QDCOUNT of Header Section by calling dns_parse_question Answer Section is processed as many as ANCOUNT of Header Section by calling dns_parse_question 86 Copyright 2007 WIZnet Co Ltd All rights reserved WiZnet Declare amp Initialize Local Variables Declare amp Initialize Local Variables u_intlen intlen type char name MAX QNAME LEN char qname MAX QNAME LEN u long tip Extract amp convertthe QNAME field In Question Sectio lenzparse nam name Extract amp convertthe NAME field In Answer Sec len parse name qnamd Jenue y S Jesf HAV LOI00 LEM cp len cp 4 lypez u int cp cp 2 RETURN cp Skip CLASS TTL RDLENGT Extract the IP Address in cp tp 8 and then assign itto tip 1 chaf amp tip cp uchar amp tip 1 cp u chaf amp tip 2 cp u chaf amp tip 3 cp Extract amp convertthe RDDATA field In Answer Sectian len parse named qname NULL N cp len len cp cp len len cp cp len a N Y RETUR len parse name qname 4 f cp scien
83. ip w5100 c s data u_char socket SOCKET s Creates related socket as TCP UDP IP iinChip socket c u_char protocol u_int port u char flag u int sendto SOCKET s Sends data to specific port of specific iinChip socket c const u char buf u int len destination related socket u char addr u int port u int recvfrom SOCKET s Sends data to any port of any iinChip socket c u_char buf u_int len u_char destination related socket addr u int port void close SOCKET s Close related socket iinChip socket c If the udp socket is in SOCK CLOSED status socket is called using SOCK DGRAM Port Number and Option Flag as the elements to create the UDP socket UDP communication as opposed to TCP is a datagram communication without the requirement of connection process So direct data communication is possible immediately after socket creation After creation of UDP socket the udp socket status will be changed from SOCK CLOSED to SOCK UDP Here not like TCP for data communication which uses send and recv sendto and recvfrom are used This is because TCP is 1 to 1 communication method of which destination is known but UDP is 1 to many communication without connection procedure sendto sends data to specific port of specific destination that is sent as an element recvfrom is used to receive the incoming data from temporary port Destination information from recvfrom is informed to us
84. lay the Unreachable Message Count Display the Time Exceeded Message Count Display the ARP Error Count Display the Receive Timeout Count Display the PingReply Count lt Fig 3 12 DisplayPingStatistics gt Ping request program is as explained previously a program that uses ICMP protocol which is running on IP Protocol In case of using ICMP channel at W5100 as shown in lt Fig 3 11 gt and lt Fig 3 13 gt IP protocol to be used must be decided The socket must be created after calling setIPProtocol s IPPROT_ICMP IP_RAW channel must be created by calling socket s SOCK_IPL_RAW port flag when creating the socket In case of closing ICMP Socket setlPProtocol s 0x00 should be called after close s and clear the ICMP Flag which was previously set Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN YAV 1030015M 46 VIZnet SendPingReply Declare amp Initialize Local variables SOCKET PingReplySocket u int size len ize lt PINGBUF_L N size PINGBUF_LEN Y Y Find a Free Socket Call getSocket SOCK CLOSED S Y Assign the socket to PingReplySocket Fail to Send a Ping Reply Packet Make a PingReply Packet pingrequest Type 0 pingrequest Code 0 pingrequest CheckSum 0 Calculate the check sum of pingrequest Successed to Send Fail to Send Y H rsel aa RETURN lt Fig
85. look at DHCP STATE LEASED state at check DHCP state the Lease Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN HAV LO300LSM 73 WiZnet Time received from DHCP server is finite in case that half of the Lease Time passed it sends DHCP_REQEUST Message to DHCP Server and changes it as DHCP_STATE_REREQUEST after it backs up the source IP As it continuously transmits DHCP REQUEST to the server network information is maintained parseDHCPMSG check DHCP Timeout Declare amp Initialize Local Variables u_char svr addi B u short svr port pRIPMSG u char RX BUF eset fimeout amp retry_coun u int len i 1 reset DHCP time u char p e u_char type opt Jen Receive a DHCP Message hop time recvfrom amp pRIPMSG svr addr amp svr porb next Time my time DHCP WAIT TIME retry courte DHCP_SIP pRIPMSG siaddr GET SIP pRIPMSG gt yiaddr type 0 p pRIPMSG 0p p 240 e p ler 240 endo plop RETURN type N padOption Y opt_len 0 N type p Set GET_SN_MASK memcpy GET SN MASK p 4 Set GET GW IP memcpy GET GW IP p 4 Set GET DNS IP memcpy GET_DNS_IP p 4 Set Lease Time lease time u_long p Set DHCP_SIP memcpy DHCP SIP p lt Fig 3 32 parse DHCPMSG amp check DHCP Timeout gt Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN YAV 1030015M VIZnet parseDHCPMSG receives DHCP message from DHCP
86. management of network information obtained from DHCP server can be performed by check_DHCP_state lt Fig 3 30 gt shows DHCP message flow due to DHCP client state change in the check_DHCP_state process Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN HAV LO300LSM 71 WiZnet DHCP Client DHCP Server STATE_DHCP_DISCOVER Receive Timeout STATE_DHCP_REQUEST Receive Timeout STATE_DHCP_DISCOVER STATE_DHCP_REQUEST STATE_DHCP_LEASED After the half of leased time STATE_DHCP_REREQUEST STATE_DHCP_LEASED DHCP_DISCOVER DHCP_DISCOVER DHCP_OFFER DHCP_REQUEST DHCP_DISCOVER DHCP_OFFER DHCP_REQUEST DHCP_REQUEST Unicast lt Fig 3 30 DHCP Message Flow by DHCP Client State gt check_DHCP_state checks if there is DHCP message from DHCP server It receives and analyzes DHCP message Accoridng to the types of analyzed DHCP message if it s DHCP message that can be receivable it changes to next state after it changes DHCP Client State as shown DHCP Message Flow of lt Fig 3 30 gt Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN YAV 1030015M 72 IZnet check_DHCP_state Y Declare amp Initialize Local Variables u int len u_char type 0 len getSn_RX_RSR s Y Receive amp Analyze type parseDHCPMSG Broadcast DHCP_REQUEST send_DHCP_REQUEST
87. ne STATE DHCP LEASED 3 ACK Receiving Acquiring Network Information define STATE DHCP REREQUEST 4 After obtaining Network Information REQUEST Retransmission define STATE DHCP RELEASE 5 RELEASE Transmission define MAX DHCP RETRY 3 Number of Same DHCP Message Transmission 3 times define DHCP WAIT TIME 5 Waiting time for receiving DHCP Message 5 sec At getlP DHCP DHCP XID is variable to set up xid Field of DHCP message in Fig 3 26 DHCP Message Format gt it must be unique and maintain the same value until Lease Time of network information is expired DHCP XID is fixed with 0x12345678 on here but it s recommended to use the random value Be advised to set source IP address as 0 0 0 0 when initializing W5100 for communication with DHCP server You can use any IP address to set Source IP address of W5100 but using 0 0 0 0 is better because 0 0 0 0 corresponds to Class A in IPv4 addressing and it s a Null IP address that is not actually used For this reason there is no chance for collision with other network For DHCP server to transmit UDP broadcast packet note that Flag field MSB of DHCP message must be set 1 Refer to lt Fig 3 26 DHCP Message Format gt lt Table 3 36 gt is a part of code that sets up Flag field lt Table 3 35 DHCP Message Flag Field Setup gt define DHCP_FLAGSBROADCAST 0x8000 pRIPMSG gt flags htons DHCP_FLAGSBROADCAST Third
88. ntrolled by AVRISP 96 Copyright 2007 WIZnet Co Ltd All rights reserved VIZnet 4 2 2 LCD LCD is used for debugging and system status display Pin Description of LCD Interface JP3 is as follows lt Table 4 3 LCD PIN Description gt jenueN S 19SN HAV LOI300LSM EVB B D PIN NAME PIN IR AN WATE DIR Description 1 GND VSS Signal Ground 2 5V VDD LCD Power Supply 3 VO VO Voltage for LCD drive 4 A1 RS Data Instruction register select 5 AO RW Read Write 6 LDC_E E Enable signal start data read write 7 DO DBO I O Data Bus Line 14 D7 DB7 15 NC1 LED A O LED Anode power supply 16 NC2 LED K O LED Cathode ground OV It uses minimum 0 3V and maximum 13V of VDD VO at Specification Document of LC1624 To fit the data R6 5V Pull Up maximum 10K and R7 Gnd Pull Down 820R are used and in real application LCD Display became clear when R6 was adjusted For details on LC1624 refer to LC1624 Specifications document 97 Copyright 2007 WIZnet Co Ltd All rights reserved VIZnet 4 2 3 PAL PAL is used to make enable signal of various chip or module that are used for EVB B D The PAL element that is used in the product is ATF16V8B 15PL from ATMEL co It uses 10 input pins and 8 I O Pins It makes Chip Select or Enable Signal about SRAM CS_RAM LCD LCD_E and W5100 CS_IINCHIP The output PAL_OUT_0 PAL_OUT_4 are set aside for exp
89. ocal Network If DHCP server exists at the network then DHCP server receives Discovery message and provides network Information such as IP G W IP Subnet Mask and DNS sever IP which can be used by DHCP Client and information such as Lease Time to the DHCP Client as OFFER message DHCP Client can detect DHCP server by receiving the OFFER message and then it sends REQUEST message to DHCP server to use the information suggested by DHCP server After receiving REQUEST message from DHCP Client DHCP server finds out if the requested network information is usable If it is it sends ACK message if not NACK message is sent to DHCP Client After receiving ACK message from DHCP server DHCP Client uses the offered network information The network information is valid only for the Lease Time suggested by DHCP server Hence if DHCP Client wants to keep using the network information it retransmits REQUEST message to DHCP server to maintain network information usually after half of the Lease Time In this process DHCP client can get same or new network information from DHCP server In case that it receives new network information the new one must be used Message between DHCP server and client has the format as in Fig 3 26 with the size of 544 Bytes Refer to document RFC1541 for detailed explanation for each field of DHCP message Format op Field of the first Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S JeSf HAV L0300L6M 6
90. or Internet IP Address to Internet Domain Name DNS is composed of Name Server that contains mapping table between IP Address and Domain Name and DNS resolver that receives query results by transmitting query to Name Server DNS resolver queries IP address or Domain Name to be transformed to local Name Server Local Name Server which received the Query searches its DB and answers back to the Resolver If Resolver cannot find the information it looks up Local Name Server sends the received query to Name Server at higher layer and the received answer can be sent to the Resolver Query i Query gt Local Name Server RESOLVER CLIENT lt Answer Fig 3 33 Domain Name System Structure amp DNS Message Flow As seen in Fig 3 33 DNS Query and DNS Answer Message transmittable between DNS Resolver and Name Server are composed of 5 Sections in Fig 3 34 Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN HAV L0300L6M 76 VIZnet dim TET cum sis Resource Records RRg Variable Length Authority Additional lt Fig 3 34 DNS Message Format gt Header Section has fixed 12 Bytes length and the other 4 sections have variable lengths Answer Authority Additional Section other than Header and Question Section are called Resource Records RRs Each of Header Question and RRs has different format Po QDBOUN ANCOUNT NSCOUNT aR Opcode 4bit AA
91. p c variables void DHCP timer handler void DHCP Timer Handler inet dhep c void send DHCP DISCOVER Transmits DHCP DISCOVER inet dhcp c SOCKET s message to DHCP server void send DHCP REQUEST Transmits DHCP REQUEST inet dhcp c SOCKET s message to DHCP server void Transmits inet dhcp c send_DHCP_RELEASE_DECLINE DHCP_DISCOVER DHCP_DECLIN SOCKET s char msgtype E message to DHCP server u_int init_dhcpc_ch SOCKET s Creates DHCP client socket inet dhcp c Copyright 2007 WIZnet Co Ltd All rights reserved enue S 19SN HAV LO300LSM 75 VIZnet uint8 getSn_SR SOCKET s Informs status of socket iinChip w5100 c uint16 getSn RX RSR SOCKET s size of data transmittable and iinChip w5100 c received data u char socket SOCKET s Creates sockets as TCP UDP IP iinChip socket c u char protocol u int port u char flag u int sendto SOCKET s const Transmits data through specific port iinChip socket c u_char buf u int len u_char addr of specific Destination u int port u int recvfrom SOCKET s u_char Receives data through any port of iinChip socket c buf any destination u intlen u char addr u int port void close SOCKET s Closes the Socket iinChip socket c 3 2 6 6 DNS Client Let s take a brief look at the DNS Domain Name System before DNS Client setup is introduced DNS is a system that transforms Internet Domain Name to Internet IP Address
92. p c DHCP Client Protocol dns h dns c DNS Client Protocol httpd h httpd c HTTP Protocol ping h ping c Ping Protocol main main h main c EVB B D F W main rom webpage EVB B D Web Pages romfs h romfs c EVB B D Web Pages Image searchfile h searchfile c EVB B D Web Page control util myprintf h printf for debugging sockutil h sockutil c Utilities relating Socket util h util c Utilities iinChip iinchip conf h System Dependant Defintion of W5100 W5100 h w5100 c I O Functions of W5100 Socket h socket c Socket APIs for W5100 Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN HAV L03001L6M 27 VIZnet 3 2 2 How to Compile Sources of Chapter 3 2 1 compile in bundle after arranging SRC items Compiling of W5100E01 AVR B D firmware can be processed by using WINAVR and AVRSTUDIO First install the WINAVR and AVRSTUDIO at the PC Then open the firmware file sw fw W5100E01 AVR aps through AVRSTUDIO project file to perform the compiling easily Be sure to check compile setting detail at the Configuration option of Project menu of AVRSTUDIO For the setting method refer to AVR Studio User Guide As the firmware provided by WIZnet is based on AVR GCC 3 4 6 it can not be operated correctly at another version of the comiler AVR Studio D WWIZNETWMYYWW5100E01 AVRWW5I00EVB_FWWmcuWtypes h 1 B Ble Project Buld Edit View Tools Debug Window Help OSEAS tBRSEN2RR MA mmm b d x AVR GCC AARERRRRERAR
93. ption Ping rgsFlags 0x80 N Y Y ETokel Ping rgsFlags 0x02 2 IPTig rgsf lags amp 0x01 Ts pingent 1 a oao O O d Ping rgsFlags 0x04 Tf Token gt Ve Get the value of 1 option Satin Nl PingargsFlags 0x80 N Y Ora A O N N Y Bad Y EDO Ping rgsFlags 0x80 liters N Be Found Y n en he Foi nknown Copy the Destination list to qname Ping rgsFlags 0x20 lt Fig 3 8 ping_request gt 40 Copyright 2007 WIZnet Co Ltd All rights reserved WiZnet FingArmsFlags z p No Arguments N IPING hau TPIhidArgsFlags amp 0x20 f No Destinatiorrlist N e Desinatiore i CB mod P Aidos Convert the IP Address String into a32 Bit Address 8 N TPMG rgsFlags amp 0x07 E tr Jenue y S Jesf HAV L0300LGA Convert the Internet IP Address into a Internet Domain Name Call gethostbyaddr peeip qnarr Convert the Internet Domain Name into a Internet IP Address di Unknown Ho Call gethosbyname qname S ccessed i0 Catt IP Address Y ate L SU tessed lo Cal END of Processing Y END of Ping rgsFlags 0x40 Convert the 32 Bit Address into the IP Address String Display the IP Address String N IPInaArgsFlags amp 0x42 Eh Display the Internet Domain Name Send the Ping Request To the destination Call ping amp PingLog N Fail to Ping S ccessed to Call gt Display the Result of Ping Request Call DisplayPingStatistic amp Pin
94. quest RX_BUF Y Select Socket Status getSn_SR ESTABL Y Select Recieved Size Pe lon o Y Receive the Data len getSn RX RSR recv ch http request len N CLOSE WAIT Y Close Socket 2 close ch t y Y CK CLOSED Create a TCP Socket Wait for sending the HTTP socket ch SOCK STREAM port flag Response completely Wait a connetion with a client NBlisten ch a ER a P Fig 3 18 web server gt y Close Socket close ch Since web_server is TCP server program it is built in the similar way as loopback_tcps as explained in Chapter 3 2 6 1 Difference between web_server and loopback_tcps is in the data communication codes web_server calls proc http that processes HTTP request message from web browser at SOCK_ESTABLISHED of the http socket After calling function proc_http it waits until the HTTP response message to HTTP request from web browser and then calls disconnect to close the http socket This socket close is called Active Close and in the case EVB B D requests the close to the client first For your reference Passive Close is where client requests disconnection first The reason why web server program supports Active Close is that EVB B D supports the connection with other clients Copyright 2007 WIZnet Co Ltd All rights reser
95. quest Message inet dns c u_char op char qname Int dns_parse_reponse void Analyzes DNS Response Message inet dns c u_char dns_parse_question Analyzes Question Section of DNS inet dns c u_char cp Response Message u_char dns_answer Answer Section of DNS Response inet dns c u_char cp Message int parse_name char cp char Analyzes NAME Field of Question inet dns c qname u int qname maxlen RRs Section uintlG getSn RX RSR SOCKET size of data transmittable and iinChip w5100 c s received data u_char socket SOCKET s u_char protocol u_int port u_char flag Creates sockets as TCP UDP IP iinChip socket c u_int sendto SOCKET s const u_char buf u int len u_char addr u_int port Transmits data through specific port of specific Destination iinChip socket c u_int recvfrom SOCKET s u_char buf u_int len u_char addr u int port Receives data through any port of any destination iinChip socket c void close SOCKET s Closes the related Socket iinChip socket c Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN HAV L03001L6M 91 W5100E01 AVR User s Manual W5100E01 AVR RS232 2 Port Serial Interface Serial Interface P1 P2 SPI Interface DIN 96Pin Expanded Board Interface Port Interface J1 3 3V Power On Power Regulator System Reset o O 7 0 E i T e o pum 49
96. ram and run EVB Test Application If EVB B D is connected to AX1 successfully loop back the desired data Refer to AX1 Manual Vx x pdf Source IP 192 168 0 2 Gateway IP 192 168 0 1 Subnet Mask 255 255 255 0 DNS Server IP 0 0 0 0 MAC Addr 0x00 0x08 0xDC 0x00 0x00 0x35 HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHEHHHHH 0 Loop Back TCP Server Started 1 Loop Back TCP Client Started H o0 Bac P erver arted 3 Loo 1 t Con p Back TCP Server Started nected by 192 168 0 30 2827 Peer Connection Information in 1 channel of W5100 Fig 2 16 Loopback TCP Client gt 2 4 2 4 Loopback UDP Loopback UDP Application is an application that loops back any file and packet data through UDP Channel connected with AX1 Program of Test PC First of all to test Loopback UDP set up any channel of W5100 as Loopback UDP Application Type using Manager gt gt Channel Config Menu of EVB B D In setting up Loopback UDP Application type set Source Port as any value Here it s set with 3000 Refer to Chapter 2 4 1 2 After EVB B D setup is over loop back desired data with IP Address and UDP Source Port of EVB B D using menu or Icon related to UDP Refer to AX1 Manual Vx x pdf Copyright 2007 WIZnet Co Ltd All rights reserved jenueWw S 19SN HAV L0300LGAM VIZnet 192 168 0 2 192 168 0 1 255 255 255 0 0 0 0 0 0x00 0x08 0xDC 0x00 0x00 0x35 HERRERA R TERRA ARRE O Loop Ba
97. rk Information evb config c void display netconf Outputs the Network Information to evb config c NETCONF pNetConf the terminal Void load factory netconf void Load Factory Reset Network evb config c Information char uart0 getchar void Read one character from UARTO mcu serial c int uart gets u char uart char str Read text lines from UART 0 1 mcu serial c char bpasswordtype int max_len char VerifylPAddress char src Check if the string is IP Address util sockutil c Unsigned long htonl unsigned long hostlong Transforms ordering of Long Type Data util sockutil c Unsigned long inet addr unsigned char addr Transforms IP string into long type util sockutil c 3 2 5 2 Channel Configuration Channel Configuration a sub program of Manage Program is made of manage config and decides which application to be applied for each of 4 channels of W5100 The application types that can be set up are DHCP Client Loopback TCP Server Client Loopback UDP and Web Server Program Each channel can be set up with any one of the applications above However the DHCP Client can only be supported by the first channel and the setting cannot be repeated on other channels TCP Server Program LB TCPS WEB SERVER can be set repeatedly by all channels In such case the same port can be used Here the number of clients is as many as the same port number Other applications can
98. rogram is a program that sets up network and channel information through RS232 terminal and tests application by sending Ping Request to certain Destination Manage program can be started by calling check_manage from main function check_manage checks if there is any entering command to Manage Program from RS232 terminal if character M or m is input or not And if the command is detected Manage Program will be entered through manage_config If the user jenueWw S 19SN HAV LO3I00 LSM change the configuration the EVB B D automatically reboots and check_manage is skipped START check managed Y Check to reset EVB B D automatically get_reset_flag Clear Reset Flag Y T Reset Automatically set_reset_flag SYSTEM_MANUAL_RESET Display the Followed Console Message A Press M to enter the manager mode J Mo Y lt 1 i y Check to Press a Key uart_keyhit Get the pressed Key uart0 getchar Wait 10ms wait 1ms 10 j lt 40 je Y Key ESC Run Manage Program manage_config Display the Progressing Character J i N i lt 16 i END lt Fig 3 4 check_manage gt 33 Copyright 2007 WIZnet Co Ltd All rights reserved WiZnet Network Config Chann
99. s Manual vi Wiznet Figures PUG 2 1 EVB B D JUMPER SETTINGS csr aarti a dedi iei Sa ead dM UM cu 3 lt FIG 2 2 JP3 JUMPER SETTING gt c cccssssssssesessssssesescecscssssesesesesesssssscsssesencacecesssssesesesessscecseseseseneaeecesenees 3 lt FIG 2 3 EVB B D TEXT LCD DISPLAY 2 eren nenne nnne nnne 5 lt FIG 2 4 OUTPUT OF TERMINAL PROGRAMS a 6 lt FIG 2 5 EVB B D PING REPLY TEST gt ececcsescesceesesseescesecoessccneesecneeseceaecseesecaeseeceasseesaecaesaesaesaeeeeeeeeas 6 FIG 2 6 MANAGE PROGRAM EXECLAE 0 sssecsssesssssssccssessscssaseessssesssssseassecaesesasaesssesasessncosecs 7 lt FIG 2 7 NETWORK CONFIO PA A cocos 8 lt FIG 2 8 SOURCE IP ADDRESS SETUP EXAMPLE cccsssssssesesesesesseseseseseseesesesesesesesesesneneneneacseseececesees 9 FIG 2 9 MAC ADDRESS SETUP EXAMPLE M 0 Re 9 lt FIG 2 10 MENU OF CHANNEL CONFIG gt ccccessssssescsescssssesesesesessnesesesesescescseseseseseseseseansneneneaeseseeceeesees 10 lt FIG 2 11 LOOPBACK TCP CLIENT APPLICATION SETTING EXAMPLE sese 11 lt FIG 2 120 9 9 3GE OF PING APPLICATION gt 997 9998 889a 12 Fic 2 SING APPLICATION TES ee ee ee hv 13 Sac Cen Ee 0 AN ume 14 lt FIG 2 15 LOOPBACK TCP SERVER TEST ccccssssssssssssssssssssesesesuencneneseseseeseseseseseseseseaesnsneseseseseececeeesees 15 HEENS LOOPBACKIICP CLIENT gt WERE B Ee 95e 15 lt He217 LOOPBAGIMBIBIATESS
100. scssesesessesesesseaeensseeeseeseanenss 79 lt TABLE 3 39 CONSTANTS AND MACRO USED IN HEADER SECTION ssssscssssesseseseeeeseseseseeeeeeseanenss 83 TABLE 3 40 CONSTANTS DEFINITION AT QTYPE amp QCLASS FIELD seen 84 TABLE 3 41 CONSTANT DEFINITION AT HEADER SECTION S RCODE FIELD 86 lt TABLE 3 42 REFERENCE FUNCTIONS IN DNS CLIENT gt sess tette 91 lt TABLE 4 1 PM A1 MODULE PIN DESCRIPTION Eee nennen 94 lt TABLE 4 2 ISP PIN DESCRIPTION TG mr coco recorra rca coca roo raro tnter 96 lt TREME 4 3 LCD PIN DESSEEIBUION SUM o scscsscessccssessssssecorsesensessssessseessassusacsesurasassneessensssesaness 97 lt TABLE 4 4 EXPANDED BOARD INTERFACE PIN DESCRIPTION rennen 98 lt TABLE 4 5 EVB B D POWER CONSUMPTION gt 00ssssecessccssseseseesssesssssscoesecsesessseesssersessssensseestassssees 107 W5100E01 AVR User s Manual X VIZnet 1 Overview W5100E01 AVR is W5100 Evaluation B D for AVR developers 1 1 Package When purchasing W5100E01 AVR B D please make sure you have all the following contents lt Table 1 1 List of Items Contained in the EVB B D gt Item Quantity W5100E01 AVR Main Board 1 PM A1 MCU Module EVBB D Plugged In W5100E01 AVR Power Adaptor DC5V 2A 1 AVR ISP Internal Flash Programming Tool Option UTP Cable 1 Accessory Serial Cable 1 IS
101. server categorizes Type of DHCP Message and saves network information When performing check_DHCP_state check DHCP Timeout is called in case that DHCP message is not received during the DHCP WAIT TIME or received DHCP message from DHCP server is not expected to retransmit DHCP message to DHCP server If the retransmission of DHCP message is repeated as much as MAX DHCP RETRY it transmits DHCP DISCOVER message to DHCP server after it initializes all the variables to start the connection of DHCP server and DHCP message lt Table 3 36 Reference Functions in DHCP Client gt Function Name Description Location void init_dhcp_client SOCKET s Initializes DHCP Client inet dhcp c void ip_update void void ip conflict void u int getIP_DHCPS void Obtains network information from inet dhcp c the server void check DHCP state SOCKET s Manages network information inet dhcp c obtained from DHCP Server void set DHCP network void Applies network information inet dhcp c obtained from DHCP server to W3150A char parseDHCPMSG Analyzes and processes DHCP inet dhcp c SOCKET s u int length message void check DHCP Timeout void Retransmits the DHCP message inet dhcp c when DHCP connection Timeout occurs char check leasedlP void Check if the IP obtained from DHCP inet dhep c server is faced with collision void reset DHCP time void Initializes DHCP Timer related inet dhc
102. t Interface 20 PBO 1 0 Port B 0 7 21 PB1 56 PB2 57 PB3 58 PB4 59 PB5 60 PB6 61 PB7 92 PD4 1 0 Port D 4 7 93 PD5 89 PD6 90 PD7 91 PE2 1 0 Port E 2 3 22 PE3 Port E 5 7 23 PES 3 PE6 5 PE7 1 2 4 6 RESO RES3 Not Available 7 75 42 76 RES4 RES7 43 81 49 83 RES8 RES11 50 84 51 85 RES12 RES15 52 54 87 RES16 RES18 Power Interface 31 32 5V O 5V Power Supply 63 64 3 3V O 3 3V Power Supply 8 9 24 30 44 GND Ground 55 62 65 72 No 8 Pin and GND became Short in AVR 82 88 94 Module Expanded Board Interface Connector which is PCN10BK 96S 2 54DS of Hirose co is a Din Connector 96Pin Female Rightangle Type Connector of Male Type that is mated here is PCN10 96P 2 54DS Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN HAV LOI300LSM 99 WiZnet 4 2 7 Power Regulator EVB B D gets 5V DC power through power adaptor The powers used inside the board are 5V and 3 3 V The regulator is LT1963EST 3 3 U1 To shut down the regulator Toggle Switch SW 1 is used 4 2 8 3 3V Power On System Reset Manual reset and Power On Reset is implemented using RC analog circuit Jenue y S 19SN YAV 1030015M 100 Copyright 2007 WIZnet Co Ltd All rights reserved WiZnet 4 3 Schematic 4 3 1 W5100E01 AVR Please refer to W5100E01 AVR DSN in the official website of WIZnet www wiznet co kr 4 3 2 PM A1 Please refer to PM A1 DSN in the offici
103. te ten 23 lt TABLE 3 7 NETCONF DATA TYPE DEFINITION tette teens 23 TABLE 3 8 NETWORK INFORMATION ACCESS FUNCTIONS nete tenes 23 TABLE 3 9 CHANNEL INFORMATION gt cccccccesesssssseseseccesssesesesesesessueseneseseseesesesesesesesesesesnsneseseseseseeceeesees 24 TABLE 3 10 CHANNEL APPLICATION TYPE tette tette ttis 24 TABLE 3 11 CHCONF DATA TYPE DEFINITION tnter tenete teens 25 TABLE 3 12 CHANNEL INFORMATION ACCESS FUNCTION eere nettes 25 TABLE 3 13 EVB B D SOURCES tenete teneret tette eerte tenete tens 27 lt TABLE 3 14 W5100 s DEFINE OPTION TYPES H gt essent nnne nennen nnns 29 TABLE 3 15 REFERENCE FUNCTIONS IN EVB B D S MAIN csesessssssesesesccesesscsesesesesescseseseseseeceeesees 31 TABLE 3 16 CALLER FUNCTION AT MANAGE PROGRAM gt c ccccsssesssssseseseseecseseseseseseseseneseseseseseeeesesees 35 TABLE 3 17 REFERENCE FUNCTIONS IN MANAGE _CONFIG gt csesessssssesesesccssessesesesesessetscseneseeeeceeesees 37 TABLE 3 18 CONSTRAINT BY APPLICATION TYPES c cssssssssesesesesseseseseseseesesescsesesesesesneneseseseseseeceeesees 38 lt TABLE 3 19 REFERENCE FUNCTIONS IN MANAGE CHANNEL gt csccccscsecccessssesesesesesescscseseseseseesesees 39 lt TABLE 3 20 PINGMSG DATA TYPE DEFINITION nnnm 43 TABLE 3 21 PINGLOG DATA TYPE DEFINITION tette tenens 43 TABLE 3 22 REFERENCE FUNCTIONS IN PING_REQUEST gt ssecsssssssessssesese
104. the client socket is in SOCK_CLOSED status loopback_tcpc calls socket with the elements of SOCK_STREAM any Port Number and Option Flag to create TCP client socket In creating socket here any port number is used for get_system_any_port This is because connection may be failed if it tries to connect to the same server with same port number After successfully creating the socket call connect with the elements of the client socket to connect to the AX1 server connect makes the socket status into SOCK_SYNSENT and keeps the status as SOCK_SYNSENT until it receives the authorization for connection from the server If the connection is successful the socket status is changed from SOCK_SYNSENT to SOCK_ESTABLISHED In SOCK_ESTABLISHED status the operation is same as explained in loopback tcps Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN HAV L03001L6M 51 VIZnet loopback top EN Y Declare amp Initialize Local Variables u_char data buf TX BUF y Select Socket Status getSn_SR Y _ _ Y lt SOCK_ESTABLISHED Select Recieved Size len getSn RX RSR len gt 0 o Receive the Data recv ch data buf len Send the Received Data send ch data_buf len Y i pe c Y Close Socket y ima RM A close ch m N Y Create a TCP Socket
105. tors void get_chconf Get Channel Information evb config c CHCONF pChConf void set_chconf Update Channel Information evb config c CHCONF pChConf void display_chconf Output Channel Information through Terminal evb config c CHCONF pChConf void load factory chconf void Factory Reset Channel Information evb config c char uart0 getchar void Read one character from UARTO mcu serial c 3 2 5 3 Ping Request Program Ping Request Program is a program that sends Ping Request to a certain destination It uses ICMP protocol message on IP protocol and made with ping request ping request is created with the form similar to Ping program in DOS command prompt It sends Ping request to a destination after analyzing and processing the options Both domain name and IP address can be used for destination address to the Ping request In case of using domain name domain name is changed into IP address using gethostbyname or DNS With the changed IP address the Ping request is sent When IP address is used with a option domain name can be obtained through gethostbyaddr from DNS Server and the Ping request is sent to the IP address When IP address is used without the a option Ping request is sent to input IP address without the connection with DNS gethostbyname gethostbyaddr is DNS related functions For further information refer to Chapter 3 2 6 6 DNS Client lt Fig 3 8 gt and lt
106. ts reserved Jenue y s Jesf YAV 1030015M 63 WiZnet Processing Display the Value On Text LCD param 15 0 evb_settIcd_text 1 param Jenue y S 19SN YAV 1030015M Extract the value of ledO param get http param value hitp request uri led e Value on Tum the D1 LED on Tum the D1 LED off led_on 0 led_off 0 Extract the value of led1 param ge http param _value http_request gt uri led1 ticam ie e Value a N Y Tum the D2 LED on Tum the D2 LED off led on 1 led off 1 C Set the file name to be sentfor HTTP response strcpy name evbctrl html Find the uri type of the file find http uri typeO END Fig 3 24 LCDNLED CGI Processing FORM of NETCONF CGI is submitted in POST Method FORM submitted using POST Method is not submitted in Query String but submitted in Entity Body of HTTP Request Message Such value of parameter for NETCONF CGI also is used to extract related parameter value using get http param value lt FORM gt of LCDNLED CGI is submitted in GET Method and FORM submitted as GET Method is submitted in Query String of Request URI Parameters submitted by Query String of Request URI can also extract parameter value using get http param value 64 Copyright 2007 WIZnet Co Ltd All rights reserved VIZnet lt Table 3 31 Reference Functions in web server gt
107. u_int len Sends data using connected socket iinChip socket c u_int recv SOCKET s u_char buf u_int len Receives data from the data from the connected socket iinChip socket c void disconnect SOCKET s Closes the connection of the socket iinChip socket c void replacetochar char str char oldchar char newchar Changes the special characters in text rows into new characters util util c Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN HAV L0300L6M 65 WiZnet 3 2 6 5 DHCP Client DHCP Client program is a program that assigns the network information from DHCP server in the network Note that DHCP Client program must be started prior to other programs because it manages Network Information setup First review basic facts on DHCP Dynamic Host Configuration Protocol and get further into the usage of DHCP Client program DHCP uses UDP protocol in Transport Layer and communicates with DHCP server using broadcast of UDP The reason why it uses broadcast is because it has no IP address and the IP address of server is unknown When UDP broadcast at W5100 destination IP address needs to be set 255 255 255 255 for broadcast packet transmission lt Fig 3 25 gt is a Message Flow between DHCP Server and Client DHCP CLIENT OFFER 68 Port inl Fig 3 25 DHCP Message Flow First of all DHCP client broadcasts DISCOVERY message to the l
108. ult value Refer to lt Table 2 2 gt M or m Sets up MAC Address Warning This value is not changed when Factory Reset E Exit Exit Net Config Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN HAV L0300L6M WIZnet lt Fig 2 8 gt is an example of setting the Source IP of EVB B D in Network Config D Display config 1 Source IP 2 Gateway IP 3 Subnet Mask 4 DNS Server IP M MAC address A memory Allocation F Factory reset E Exit Select 2 1 Source IP 192 166 0 100 lt Fig 2 8 Source IP Address Setup Example gt lt Fig 2 9 gt is an example of setting the MAC address of EVB B D in Network Config D Display config 1 Source IP 2 Gateway IP 3 Subnet Mask 4 DNS Server IP M MAC address A memory Allocation F Factory reset E Exit Select 2 m MAC Address 00 08 dc 00 00 20 lt Fig 2 9 MAC address Setup Example gt 2 4 1 2 Channel Config It sets up an application that can be operated in 4 channels of W5100 By selecting 2 Channel Config each channel can be set up The default W5100 channel information is shown in lt Table 2 4 gt lt Table 2 4 EVB B D Default Channel Information gt W5100 Channel Test Application 1 Loopback TCP Server Port 5000 p Loopback TCP Server Port 5000 ga Loopback TCP Server Port 5000 4 Loopback TCP Server Port 5000
109. unicast datagram communication of UDP protocol It operates same as Loopback TCP Server Client program does UDP communication includes unicast datagram communication and broadcast datagram communication and basically supports 1 to many communication that is used for many destinations with one channel Loopback UDP program uses loopback_udp and lt Fig 3 16 gt shows processing procedure of loopback udp a N C loopback_udp Declare amp Initialize Local Variables u_char data_buf TX_BUF u_long destip 0 u_int destport 0 Y Select Socket Status getSn SR OCK INIT Y Select Recieved Size 0 len gt 0 Y Receive the Data len getSn RX RSR recvfrom ch data buf len amp destip amp destport N N i OCK UDP Y nA Send the Received Data sendto ch data buf len destip destport N CL Y Create a TCP Socket 2 socket ch SOCK_DGRAM port flag L RETURN a V y lt Fig 3 16 loopback_udp gt Copyright 2007 WIZnet Co Ltd All rights reserved jenueN S 19SN YAV 103001S5M VIZnet lt Table 3 25 Reference Functions in loopback_udp gt Function Name Description Location void loopback_udp u_char ch Loopback udp program app loopback c uint8 getSn_SR SOCKET s Gets the socket status iinChip w5100 c uint16 getSn_RX_RSR SOCKET size of data transmittable and received iinCh
110. variables which are the leased time of network information received from DHCP server by calling reset_DHCP_time and uses DHCP Timer for 1 sec interval using set_timer After the initialization of DHCP_Timeout with 0 it waits for DHCP message to be received from DHCP server as long as the DHCP_WAIT_TIME defines and as many as the MAX DHCP RETRY defines While waiting for DHCP WAIT TIME amp MAX DHCP RETRY time it continuously checks if dhcp state is changed to STATE DHCP LEASED through check DHCP state STATE DHCP LEASED state represents the network information and means that getlP DHCP is done successfully If network information is not obtained from DHCP Server during the waiting time for DHCP WAIT TIME amp MAX DHCP RETRY check DHCP state sets DHCP Timeout to 1 When Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S JeSf HAV L0300L6M 70 VIZnet DHCP Timeout is 1 getlP DHCPSY returns failure after releasing the DHCP Timer When it failed to obtain network information from DHCP server EVB B D sets network configuration using default network information or previously obtained network information Table 3 35 gt is a definition of State Timeout and Retry Count of DHCP Client lt Table 3 34 DHCP Client State 8 Timeout Definition gt Define Description define STATE DHCP DISCOVER 1 DISCOVERY Transmission define STATE DHCP REQUEST 2 OFFER Receiving amp REQUEST Transmission defi
111. ved jenueW S 19SN HAV LO300LSM 58 IZnet proc http Declare amp Initialize Local Variables prog chare contents char name param u_int file Jen send len http response u_cha TX_BUF Analyze the HTTP request parse_http_reqeust amp request buf RETURN Processing Send Unknown Page send ERROR HTML PAGE Make the ResonseHead forthe request TYPE make http response head http response regeus TYPE len Send the HTTP Response Header send http response RETURN M lt ie len gt gt Y titgT n gt TX RX MAX BUF SEZE X send file file len VE send_file TX RX MAX BUF SIZE 1 Replace System Environment Variables Y XE ETE send len replace sys env value es VE a Send a HTTP Response Body send hitp_response content send_len file_len send_len lt Fig 3 19 proc_http gt Copyright 2007 WIZnet Co Ltd All rights reserved Jenue y S 19SN HAV 1030019M 59 VIZnet proc_http calls parse_http_request to analyse the HTTP request message received from web browser If the METHOD of analyzed HTTP request message is GET HEAD or POST get_http_uri_name is called and URI Name is extracted from HTTP Request message If extracted URI Name is replace URI Name to index html which is web server default page of EVB B D because this means that web browser is requesting default page of web server After getting the HTTP request type o
112. ver does not exist in LAN it sets back to default value after certain amount of time TCP Loopback Server TCP Server Test Program lt Warning gt EVB B D TCP Server AX1 TCP Client TCP Loopback Client TCP Client Test Program Warning EVB B D TCP Client AX1 TCP Server Loopback UDP UDP Test Program Web Server Web Server Test Program Copyright 2007 WIZnet Co Ltd All rights reserved jenueW S 19SN HAV LO300LSM VIZnet Other application types except for DHCP Client can be repeatedly set up regardless of channel lt Fig 2 11 gt shows an example of 2 channel setting of W5100 as TCP Loopback Client When inputting simply ENTER without IP address or port number the default value is applied lt Table 2 7 gt shows default values required for each application Select 2 Select the followed APPs type for 1 channel 0 No Use 2 Loop Back TCP Server 3 Loop Back TCP Client 4 Loop Back UDP 5 Web Server Select 3 Server IP Address Default Applied 192 168 0 3 Server Port Num 1 65535 2 Default Applied 3000 lt Fig 2 11 Loopback TCP Client Application Setting Example gt lt Table 2 7 Application Default Value gt Application Type Default Value DHCP Client None TCP Loopback Server Listen Port Number 5000 TCP Loopback Client Server IP Address 192 168 0 3 Server Port Number 3000 Loopback UDP Source Port Number 300

Download Pdf Manuals

image

Related Search

Related Contents

Vetre-Sel-E  センチプローブ - 日本メジフィジックス  施工要領書  日立密閉形隔膜式膨張タンク  ー防爆栓の採用により、 安全性に配慮  6x6 Little Squirt Playhouse Outdoor Living Today Assembly Manual    User manual Benutzerhandbuch Mode d`emploi  PUCK EN ROUMANIE - Theatre  

Copyright © All rights reserved.
Failed to retrieve file