Brush Electronics POC UDP Client and UDP Server Technical Note

Similar documents
Ethernet Bootloader Andrew Smallridge

Generic Serial Bootloader System Andrew Smallridge

Encrypted Serial Bootloader System Andrew Smallridge

Command Manual Network Protocol. Table of Contents

Laboration 2 Troubleshooting Switching and First-Hop Redundancy

CS 457 Lecture 11 More IP Networking. Fall 2011

Teldat Router. ARP and InARP Protocol

Fundamentals of Computer Networking AE6382

Chapter 5: Trouble shooting of a network

Use of the TCP/IP Protocols and the OSI Model in Packet Tracer

DGS-1510 Series Gigabit Ethernet SmartPro Switch Web UI Reference Guide

Chapter 7. ARP and RARP MGH T MGH C I 20

Practical Exercises in Computer Networks

Operation Manual ARP H3C S5500-SI Series Ethernet Switches. Table of Contents

Different Layers Lecture 20

Lab 6.7.1: Ping and Traceroute

Design and deployment of HSRP in a LAN environment

Introduction to the Packet Tracer Interface using a Hub Topology

Firewall Stateful Inspection of ICMP

Cisco Interconnecting Cisco Networking Devices Part 2

Switching & ARP Week 3

Outline. SC/CSE 3213 Winter Sebastian Magierowski York University. ICMP ARP DHCP NAT (not a control protocol) L9: Control Protocols

AT&T Digital Subscriber Line Service

Lab - Configure a NIC to Use DHCP in Windows

LAB THREE STATIC ROUTING

Step 2. Manual configuration of global unicast and link-local addresses

Last time. Network layer. Introduction. Virtual circuit vs. datagram details. IP: the Internet Protocol. forwarding vs. routing

Encrypted SD/MMC Bootloader PIC24/dsPIC33 Series

ICS 451: Today's plan

Lab 9.8.1: Address Resolution Protocol (ARP)

Configuring DHCP Features and IP Source Guard

eip-10 Embedded TCP/IP 10-BaseT Network Module Features Description Applications

ASL Holdings Ltd. User Guide for the: - DELTA PLUS LAN modem. Provisional Ver1.8

Ch. 5 Maintaining and Troubleshooting Routing Solutions. Net412- Network troubleshooting

Date: Saturday, November 01, SHDesigns Ethernet Downloader for Z-World Rabbit Boards and the Softools Compiler Copyright (c) 2003 SHDesigns

Outline. CS5984 Mobile Computing. Host Mobility Problem 1/2. Host Mobility Problem 2/2. Host Mobility Problem Solutions. Network Layer Solutions Model

Configure the Protocol Family on page 40. Configure the Interface Address on page 40

Outline. CS6504 Mobile Computing. Host Mobility Problem 1/2. Host Mobility Problem 2/2. Dr. Ayman Abdel-Hamid. Mobile IPv4.

Configuring IPv4. Finding Feature Information. This chapter contains the following sections:

Computer Networks. More on Standards & Protocols Quality of Service. Week 10. College of Information Science and Engineering Ritsumeikan University

Configuring DHCP Features

Example: Configuring DHCP Snooping and DAI to Protect the Switch from ARP Spoofing Attacks

History Page. Barracuda NextGen Firewall F

cable modem dhcp proxy nat on Cisco Cable Modems

7 Filtering and Firewalling

The Lean Plan p. 1. Embedded Systems. The Operating System The Development Environment. Acknowledgments Introduction p. 1.

FiberstoreOS IP Service Configuration Guide

Configuring HSRP. Understanding HSRP CHAPTER

Configuring DHCP Features

ExtraHop Command-line Reference

TCP/IP Diagnostic Utilities on Windows 2008 Server

Patch For AR450S Routers

HP FlexFabric 5930 Switch Series

IP/MAC Address Translation

Router Architecture Overview

Configuring IP Addressing

ARP Inspection and the MAC Address Table

ARP Inspection and the MAC Address Table for Transparent Firewall Mode

DDoS Testing with XM-2G. Step by Step Guide

1/18/13. Network+ Guide to Networks 5 th Edition. Objectives. Chapter 10 In-Depth TCP/IP Networking

Example: Configuring DHCP Snooping, DAI, and MAC Limiting on an EX Series Switch with Access to a DHCP Server Through a Second Switch

Access Rules. Controlling Network Access

Chapter 2 Lab 2-1, EIGRP Configuration, Bandwidth, and Adjacencies

OSI Model with Protocols. Layer Name PDU Address Protocols Device

Putting it all together

Network Security. Introduction to networks. Radboud University, The Netherlands. Autumn 2015

SD24GS. 24-Port Web Smart Gigabit Ethernet Switch. User s Manual

The trace is here:

Configuring DHCP. Finding Feature Information. Information About DHCP. DHCP Server. DHCP Relay Agent

DHCP Technology White Paper

Configuring DHCP Features and IP Source Guard

Configuring UDLD. Understanding UDLD CHAPTER

Chapter 6: Network Layer

Quiz 7 May 14, 2015 Computer Engineering 80N

Configuring DHCP. Finding Feature Information. Information About DHCP. DHCP Server. DHCP Relay Agent

Introduction to Computer Networks. CS 166: Introduction to Computer Systems Security

Configuring IP Services

Assigning the Switch IP Address and Default Gateway

Layer 3 Switch Processing. CEF-Based Multilayer Switches. Layer 3 Switch Processing (Cont.)

Configuring DHCP. Finding Feature Information. Information About DHCP. DHCP Server. DHCP Relay Agent

HP FlexFabric 5930 Switch Series

Dynamic Host Configuration DHCP. DHCP Process Flow. Overview. DHCP Process Flow, cont. DHCP Process Flow, cont.

CPSC 826 Internetworking. The Network Layer: Routing & Addressing Outline. The Network Layer

ACE PLUS CORP. APCON100 series Operation Manual RS-232 to Ethernet Converter

User Manual Electronic Systems Protection, Inc. / Technical Support: / espei.com

Chapter 5: Maintaining and Troubleshooting Routing Solutions

2016 Braindump2go Valid Cisco Exam Preparation Materials:

Lab Configuring OSPF Timers

Kea Messages Manual. Kea Messages Manual

Procedure Note: The research steps for this lab are not included in this procedure.

1. Which OSI layers offers reliable, connection-oriented data communication services?

Overview of the Cisco NCS Command-Line Interface

Interconnecting Networks with TCP/IP. 2000, Cisco Systems, Inc. 8-1

COEN 445 Lab 8 Wireshark Lab: DHCP

Lab - Troubleshooting DHCPv4 Topology

ICS 351: Networking Protocols

Chapter 1 Introduction to TCP/IP

H3C S5120-EI Series Ethernet Switches. Layer 3 - IP Services. Configuration Guide. Hangzhou H3C Technologies Co., Ltd.

DHCP in. Introduction. Step 1 router. In this lab, you. computer. Page 1 of 7

CS4450. Computer Networks: Architecture and Protocols. Lecture 20 Pu+ng ALL the Pieces Together. Spring 2018 Rachit Agarwal

Transcription:

PIC18Fxxxx / ENC28J60 Proof of Concept UDP Client and UDP Server Solution 28 August 2006 2003-2006 Andrew Smallridge asmallri@brushelectronics.com www.brushelectronics.com This Technical note describes the Brush Electronics PIC18Fxxxx / ENC28J60 Proof of Concept UDP Client and UDP Server Solution. This proof of concept (POC) solution comprises the PIC software, implementing a UDP Client and UDP Server on a Microchip PIC18F series microcontroller with an associated Microchip ENC28J60 Ethernet controller, and PC software implementing a UDP client application. A UDP client implemented on a PIC requires more resources from the PIC to implement than a UDP server application. A client requires more RAM, Program Memory and a richer implementation of the IP protocol stack. The UDP server implementation described in this technical note is more flexible than the standalone UDP server described in the Brush Electronic s technical note PIC18Fxxxx / ENC28J60 Proof of Concept UDP Server Solution as a result of the more extensive protocol implementation in this version. The IP stack used in the proof of concept solution has been developed by Brush Electronics. Considerable effort has been made to simplify the developers interface by off loading tasks from the developer to the driver and by simplifying the state machine. For example, the user s application program does not need to resolve the IP to MAC address binding before attempting to send a UDP packet. The driver will attempt to resolve the binding from the ARP cache and, if no matching entry is found, will automatically perform ARP discover. The driver also avoids the lock-step problem than can occur when an application is blocking pending an ARP resolution which cannot be resolved because other frames proceed the required ARP response packet in the Ethernet controller s receive buffer. Protocols supported in this implementation include: DHCP client ARP Request ARP Response ICMP Echo Request (ping) ICMP Echo Reply (ping reply) UDP Client UDP Server An ARP cache has been implemented with appropriate aging timers. Copyright 2004-2006 Andrew Smallridge Page 1 of 6

Note: For applications that have severe resource constraints, the reader may want to investigate the implementation of a tiny UDP client as described in the Brush Electronic s Technical note Implementing a tiny UDP client with UDP Server Code. The PIC code includes the necessary network protocols to implement a UDP client and UDP server application enabling the PIC to service requests from one or more network clients. The PIC code implements three UDP sockets, two sockets for the UDP server (listens to two UDP ports) and one socket for the UDP Client function. The two UDP server sockets are the CONTROL port and the DATA port. The CONTROL port (0x4000) is used for receiving commands from the PC POC application. The DATA port (0x4001) is used for receiving data from the PC POC application. The UDP CLIENT port (0x5000) is used to connecting to a remote UDP server application. The supplied PC software implements the UDP client and UDP Server functions. The PC software UDP server client function is hard coded to use the IP address of 192.168.2.200 as the IP address for the PIC however, on reception of a UDP packet from the PIC to the UDP Server port on the PC, the target address of the PC s UDP Client sockets (control and data) will remap to use this learnt address for the PIC. If the proof of concept UDP Client and UDP Server application is used in conjunction with the Brush Electronic s Ethernet Bootloader, and the IP address of the Bootloader is to be the same as the IP address of the UDP application, then the MAC address used by the PIC software should be changed to be the same as the MAC address used by the Ethernet Bootloader. This will simplify application development and debugging negating the need to clear the controlling hosts ARP cache whenever the PIC is rebooted. PIC software user interface: The PIC software uses the serial port for accepting commands from the user, displaying status information in debug mode, and displaying messages sent over the data socket from the PC application. Serial port configuration: 115200bps, 8 data bits, 1 stop bit, no parity. The following five serial interface commands are supported by the PIC software: ARP Displays the contents of the ARP cache including the age of the entry in minutes and the time in minutes since the entry was last accessed. The Last Access time is used by the PIC software to remove least recently used entries from the ARP table in the event the ARP table is full. ARP Table: IP Addr MAC Addr AGE Last Access 192.168.002.254 00:14:6C:AC:6A:38 0 1 192.168.002.051 00:11:2F:84:5D:55 0 0 Copyright 2004-2006 Andrew Smallridge Page 2 of 6

ARP d Deletes the contents of the ARP cache. ARP Table: IP Addr MAC Addr AGE Last Access ECHO The character string immediately following the ECHO keyword is sent, via a UDP data packet, to the PC POC application s data socket. The message will be displayed in the DATA Channel window. Note that the PC POC application must have previously sent a packet to the PIC to enable the PC s IP address and PC s UDP source port number to be learnt by the PIC.. DEBUG Puts the PIC application into debug mode. Debug mode provides diagnostic information to the serial port on receipt of network traffic. INIT Reinitializes the ENC28J60 Ethernet controller subsystem. IPCONFIG Displays IP address configuration parameters. If DHCP is enabled, this command also displays the DHCP timers. IP Config: Assigned IP addr: 192.168.2.3 Assigned GW addr: 192.168.2.254 Assigned Mask: 255.255.255.0 Derived subnet: 192.168.2.0 DHCP Timers: Lease=82202, T1=39002, T2=71402 PING Issues an ICMP Echo Request (ping). By your command> ping 66.102.7.104 By your command> ICMP Echo Reply from 66.102.7.104 time=291ms RESET Resets (reboots) the PIC hardware including the Ethernet controller. SEND Sends a string via UDP to a designated IP address (demonstrates UDP client). send 192.168.2.100 Hello Copyright 2004-2006 Andrew Smallridge Page 3 of 6

UNDEBUG Exits debug mode. The following commands are DHCP specific. These commands would typically be used for debugging DHCP and are available when the code has been compiled with the #define USE_DHCP_CLIENT directive. LEASE Set the DHCP Lease time to 10 seconds T1 Set the DHCP T1 timer to 10 seconds. T2 Set the DHCP T2 timer to 10 seconds. RENEW Forces a DHCP RENEW cycle. PC Proof of Concept Application This PC application is a multithreaded application implementing UDP Server and UDP Client sockets. The PC application implements two UDP Client sockets to support the PIC s UDP Server Control and Data ports. The PC application also implements a UDP Server socket to support the PIC s UDP Client s Client port. PC application s Control and Data UDP Client sockets destination IP address of the PIC is hard coded to 192.168.2.200 however will automatically be remapped to the source address of the first UDP packet received from the PIC s UDP Client on the PC s UDP Server port. This enables the PC application to dynamically reconfigure itself to map the outgoing destination IP address to the IP address of the PIC. The application is implemented with Borland s C++ compiler. The user interface is shown in the following screen capture: Copyright 2004-2006 Andrew Smallridge Page 4 of 6

The PC POC application sends and receives data via the windows sockets interface. One UDP client socket, designated the control socket, is used for sending commands to the PIC. Another UDP client socket, designated the data socket, is used for exchanging data strings with the PIC s serial port. A UDP Server socket is used to display strings sent from the PIC via the PIC s SEND command. The PC POC application has nine visual controls: Data Sequence (Edit box): Characters to be send to the PIC s serial port are entered into this field. The characters are transmitted via the data socket when the Send Data button is clicked. Send Data (Button): The string in the Data Sequence edit box is sent via the data socket to the PIC s serial port. Copyright 2004-2006 Andrew Smallridge Page 5 of 6

UDP Server (from Remote UDP client) (Memo): This windows displays the payload contents of UDP packets received sent from the PIC using the SEND command. Data Channel (Memo): This windows displays the payload contents of UDP data packets received from the PIC. This is the character sequence immediately following the ECHO keyword received by the PIC on its serial interface. Control Channel (Memo): Displays status information about packets received from the PIC via the control socket. LIA Status (Button): Initiates the status request command UDP control message which is sent via the control socket to the PIC. The PIC will respond with a Hello, world message embedded in the UDP payload of a packet sent to the control port. This message will be displayed in the Control Channel window. Dummy (Button): Initiates a command UDP control message which is sent via the control socket to the PIC however, in this case, the command is not a valid command. The PIC will respond with a UNKNOWN command received message embedded in the UDP payload of a packet sent to the control port. This message will be displayed in the Control Channel window. RESET (Button): Initiates the reset request command UDP control message sent via the control socket to the PIC. The PIC will respond with a RESET command received message embedded in the UDP payload of a packet sent to the control port and, after a two second delay, will reset (reboot) the PIC. This message will be displayed in the Control Channel window. Clear Screen (Button): This button will clear the Data Channel and Control Channel windows. No network traffic is generated. Copyright 2004-2006 Andrew Smallridge Page 6 of 6