Académique Documents
Professionnel Documents
Culture Documents
COM4201
Objectives
Describe the communication layers required
in TCP/IP embedded designs
Describe the Application layer components
required of Web based embedded designs
Capture and modify a simple HTML/CSS web
page design
Modify an existing HTML/CSS web page to
include dynamic variables
Integrate status and control requirements
within the Microchip TCP/IP stack
Specify the layout considerations for using
an Ethernet Phy in embedded applications
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide22
Agenda
Crash Course in Networking
Lab 1 – Join the Network
Introducing our Project
Lab 2 – Web Page Design
The Microchip TCP/IP Stack
Planning for Applications
Lab 3 – Integrating the Stack
Lab 4 – Removing Blocking Code
Implementing Web Applications
Building with HTTP2
Lab 5 – Web-Based Status Monitoring
Lab 6 – Web-Based Control
Hardware Design Guidance
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide33
Crash Course in Networking
Crash Course in Networking
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide55
Basic Ethernet Topology
Hub
Repeats all traffic
Mostly obsolete Switch
or Hub
Switch
Directs traffic to
specific destination
Common “in-room” Local
Subnet
Router Router
Routes traffic
Acts as gateway
Internet
Other functionality
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide66
Basic Ethernet Topology
“Star Topology”
More like a tree
Routers (at the root) serve as gateways to
rest of the world
Other configurations exist (obsolete)
Definitions
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide77
MAC and IP Addresses
MAC Addresses
Associated with hardware
Six bytes: 00:04:A3:00:12:34
Specific to IEEE 802. networks
Ethernet, WiFi, etc
Only usable within the local network
Sold in blocks by the IEEE
Globally unique
US$550 / 4096 pcs or US$1650 / 16M pcs
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide88
MAC and IP Addresses
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide99
Network Address Translation
192.168.1.101
Internet
Router
192.168.1.100
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide10
10
MAC and IP Addresses
Finding Nodes:
Start with host name
www.microchip.com
Local name, e.g. MCHPBOARD
Resolve host name to IP address
DNS for global addresses
NBNS for local addresses
Resolve IP address to MAC
Use Address Resolution Protocol (ARP)
Router or gateway may respond
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide11
11
Microchip Ethernet Hardware
ENC28J60 – In Production
Stand-alone 10Mbps Ethernet Controller
Integrated MAC + PHY + 8kB SRAM
3.3V, 20MHz SPI interface
28-pin SOIC, SSOP, QFN, SPDIP
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide12
12
Microchip Ethernet Hardware
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide13
13
Microchip Ethernet Hardware
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide14
14
Development Tools
DM163024
PICDEM.netTM 2
PIC18F97J60
ENC28J60
Ethernet PICtailTM
PICDEM HPC 2
Explorer
AC164121
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide15
15
Lab 1: Join the Network
Goals:
Configure your development board
MAC Address
Local host name
Compile and load TCP/IP Stack
Upload demo web pages
Test connectivity
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide16
16
Review:
Crash Course in Networking
Basic Ethernet Topology
Hubs, Routers, Switches
IP and MAC Addresses
Microchip Hardware
Stand-alone and integrated parts
Development Tools
PICDEM.netTM 2
Ethernet PICtailTM Plus
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide17
17
Introducing our Project
Introducing our Project
Project Demonstration
Web Page Development
HTML Structure and Tags
Packaging Web Pages
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide19
19
Introducing our Project
Demonstration
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide20
20
Web Page Development
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide21
21
Sidetrack to HTML
<tag attr=“value”>content</tag>
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide22
22
HTML Structure
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide23
23
Sample HTML Page
<html>
<head>
non-displayed header content...
</head>
<body>
displayable content...
text, images, links...
</body>
</html>
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide24
24
HTML Content Tags
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide25
25
Completed Sample Page
<html>
<head>
<title>My First Web Page</title>
</head>
<body>
<h1>My First Web Page</h1>
<p>Compared to assembly, HTML is
<b>really</b> easy!</p>
</body>
</html>
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide26
26
Completed Sample Page
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide27
27
Packaging Web Pages
Using yes
EEPROM? EEPROM
MPFS2 Utility
File system for embedded devices
Creates file system image
Uploads image to running application
Application programs to EEPROM
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide28
28
Lab 2: Web Page Design
Goals:
Create a simple web page
Test web page locally
Compile and upload MPFS2 image
Bonus:
Use CSS to format
your page
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide29
29
Want to Learn More?
TLS8221
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide30
30
Review:
The Microchip TCP/IP Stack
Vending Machine Application
Principles of HTML
Markup language
Tag format and structure
Packaging Web Pages
Visual Elements with CSS
Style and layout
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide31
31
The Microchip TCP/IP Stack
The Microchip TCP/IP Stack
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide33
33
About the Stack
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide34
34
About the Stack
Cross-platform
PIC18, PIC24, dsPIC, PIC32
MPLAB® C18, C30, C32, HI-TECH PICC-18
RTOS Independent
Modular Design
Compile only what you need
High performance
Full TCP state machine
Supports multiple connections
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide35
35
The TCP/IP Layer Model
Communication Protocol
Layers
Each handles a specific task
Independent functions
Shared functionality
Communicate only with the layer below
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide36
36
The TCP/IP Layer Model
SNMP
Telnet
NBNS
DHCP
SMTP
SNTP
HTTP
DNS
FTP
Application
IP ARP Addressing
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide37
37
Layers at a Glance
Foundation Layers
Functionality handled by the stack
Interact only with TCP and/or UDP
Just send and retrieve data
IP ARP Addressing
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide38
38
Layers at a Glance
SNMP
Telnet
NBNS
DHCP
SMTP
SNTP
HTTP
DNS
FTP
Application
Application Layers
Custom applications built on these layers
Request and transmit data
Respond to incoming requests
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide39
39
Application Examples
NetBIOS Name Service (Server)
NBNS
Local Host Names
Domain Name Service (Client)
DNS
Global host name resolution
Simple Network Time Protocol (Client)
DNS
Determines the absolute time
Dynamic Host Configuration Protocol (Both)
DHCP
Automatic IP and network configuration
Simple Network Management Protocol (Server)
SNMP
Enterprise monitoring and control (AN870)
Telnet (Server)
Telnet
Command-line interface
Simple Mail Transfer Protocol (Client)
SMTP
Sends e-mail messages
Hyper-Text Transfer Protocol (Server)
HTTP
Serves web pages and processes web form input
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide40
40
Application Examples
Custom Applications
HTTP Client
Streaming data / audio
Serial to Ethernet bridge
Data logging
Bootloader
Other data transfer
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide41
41
Selecting an Application
Requirements:
Provide status monitoring
Allow for device control
Desires:
Cross-platform graphical interface
Easy to implement
© 2008 Microchip Technology Incorporated. All Rights Reserved. TCP/IP: Designing aHIF
Monitor
2131 and Control Device Slide43
43