Technical Seminar
Build An ARM Cortex-M3
Based Embedded Web
Server with Luminary
Micro and Stellarisware
Agenda
Introduction to ARM Cortex, TCP/IP, and Ethernet
Introduction to Luminary Micro Hardware and Software Tools
Build an embedded web server using StellarisWare!
Embedded Ethernet Control Examples
Introduction to ARM Cortex, TCP/IP, and Ethernet
What is ARM Cortex-M3?
The Cortex family of ARM processors provides a range of solutions optimized around
specific market applications across the full performance spectrum.
Cortex underlines ARM's strategy of aligning technology around specific market
applications and performance requirements.
The ARM Cortex family is comprised of three series, which all implement the Thumb-2
instruction set to address the increasing performance and cost demands of various
markets:
ARM Cortex-A Series
Applications processors for complex OS and user applications.
Supports the ARM, Thumb and Thumb-2 instruction sets.
ARM Cortex-R Series
Embedded processors for real-time systems.
Supports the ARM, Thumb, and Thumb-2 instruction sets
ARM Cortex-M Series
Deeply embedded processors
optimized for cost sensitive applications.
Supports the Thumb-2 instruction set only
Note:
ARM Code 32-bit
Thumb Code 16-bit
Thumb-2 Code mostly 16-bit & some 32-bit (25% Faster, 26% Smaller)
What is Ethernet?
Ethernet refers to the family of local-area network (LAN) products covered
by the IEEE 802.3 standard that defines what is commonly known as the
CSMA/CD protocol
Five data rates are currently defined for operation over optical fiber and
twisted-pair cables:
10Base-T Ethernet (1 Mbps/10 Mbps )
Fast Ethernet (100 Mbps )
Gigabit Ethernet (1000 Mbps )
10-Gigabit Ethernet (10000 Mbps )
100-Gigabit Ethernet (100000 Mbps )
TCP/IP Model
TCP/IP defines a set of rules to enable computers to communicate over a
network. specifying how data should be packaged, addressed, shipped, routed
and delivered to the right destination.
Application layer
Transport layer
Network/Internet layer
Data link layer
Physical layer
Five-Layer TCP/IP Model
Application Layer: DHCP, DNS, FTP, HTTP, IMAP4, IRC, NNTP, XMPP, POP3,
RTP, SIP, SMTP, SNMP, SSH, TELNET, RPC, RTCP, RTSP, TLS (and SSL), SDP,
SOAP, GTP, STUN, NTP, etc...
Transport Layer: TCP, UDP, DCCP, SCTP, RSVP, ECN, etc...
Network/Internet Layer: IP (IPv4, IPv6), OSPF, IS-IS, BGP, IPsec, ARP, RARP,
RIP, ICMP, ICMPv6, IGMP, etc...
Data Link Layer: Ethernet, 802.11 (WLAN), 802.16, Wi-Fi, WiMAX, ATM, DTM,
Token ring, FDDI, Frame Relay, GPRS, EVDO, HSPA, HDLC, PPP, PPTP, L2TP,
ISDN, ARCnet, LLTD, etc...
Physical Layer: Ethernet physical layer, Twisted pair, Modems, PLC,
SONET/SDH, G.709, Optical fiber, Coaxial cable, etc...
Typical TCP/IP Stack Options
Acronym
TCP
IP
UDP
ARP
RARP
BOOTP
DHCP
BSD
ICMP
IGMP
PPP
SLIP
DNS
FTP
TFTP
RIP
RTP/RTCP
Telnet
HTTP
SNMP
SMTP
POP3
SNTP
PTP*
NAT
SSL
IPSec
IKE
Translation
- Transmission Control Protocol
- Internet Protocol
- User Datagram Protocol
- Address Resolution Protocol
- Reverse Address Resolution Protocol
- Bootstrap Protocol
- Dynamic Host Configuration Protocol
- Berkeley Socket
- Internet Control Message Protocol
- Internet Group Management Protocol
- Point-To-Point Protocol
- Serial Line Internet Protocol
- Domain Name System
- File Transfer Protocol
- Trivial File Transfer Protocol
- Routing Information Protocol
- Real-time Transport (Control) Protocol
- Terminal Emulation
- Hypertext transfer Protocol Server
- Simple Network Management Protocol
- Simple Mail Transport Protocol
- Post Office Protocol-3
- Synchronized Network Time Protocol
- Precision Time Protocol (also called IEEE1588)
- Network Address Translation
- Secure Sockets Layer
- Internet Protocol Security
- Internet Key Exchange
*Several Stellaris MCUs integrate hardware assistance for IEEE1588 PTP.
Wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
wikipedia Link
High-level Purpose
(guarantee delivery)
(data oriented)
(fire-and-forget)
(finding a address)
(finding a address)
(finding a address)
(adding devices to a network)
(connecting to the internet)
(error message generation)
(manage IP multicast groups)
(direct point-to-point connection)
(direct point-to-point connection)
(translate host name to address)
(transfer files point-to-point)
(FTP, but for smaller files)
(routing internal networks)
(send audio/video over internet)
(remote access)
(publish/retrieve web pages)
(manage/monitor client status)
(send email over internet)
(retrieve email over internet)
(network clock synchronization)
(deterministic synchronization)
(network privacy)
(secure communication)
(virtual private network)
(security key/certificate sharing)
Introduction to Luminary Micro Hardware and Software Tools
Ethernet in Embedded Systems
Media Access Controller (MAC) Part of the Data Link Layer. The MAC
provides addressing and channel access control mechanisms that make it
possible for several terminals or network nodes to communicate within a
multipoint network.
Physical Layer (PHY) - The most basic network layer, providing only the
means of transmitting raw bits rather than packets over a physical data link
connecting network nodes.
Magnetics (Isolation Transformer) - Part of the Physical layer used to
decouple PHY from the physical Ethernet cable.
RJ45 - That Ethernet Connector.
Stellaris Family: Unique Value Proposition
The only ARM MCU with 10/100 Ethernet MAC / PHY
Enables network connectivity and embedded web servers
Lower external power budget requirements than solutions using an
external PHY
Savings in board space and system cost
The Stellaris MCU in
a BGA package is
just slightly larger
than a standard
Ethernet PHY in a 48
pin TQFP package
10mm
10mm
MCU + PHY + More
Stellaris Features in
an area the size of an
Industry standard
PHY!
And now even more value in the same small package:
Hardware support for Precision Time Protocol (IEEE 1588 PTP)
Full Solution Menu
Main Menu
Serial Interfaces
Analog
IEEE 1588
CAN MAC
USB Full Speed
UART
I2C
SSI/SPI
I2S
ADC
Channels
ADC Speed
(Ksps)
Internal Temp
Sensor
LDO Voltage
Regulator
Analog
Comparators
Digital
Comparators
256
64
50
1000
46
100-LQFP
108-BGA
LM3S8000s
12
256
64
50
1000
46
100-LQFP
108-BGA
LM3S9000s
256
96
100
2 O/H/D 3
16
1000
65 100-LQFP
Hibernate
QEI
10/100 Ethernet
MAC+PHY
19
GPIOs (5-V)
Outputs
LM3S6000s
Flash (KB)
Fault Inputs
ADC (10-bit)
Digital
RTC
Motion
Control
PWM
Package Options
General Purpose
Timer Modules
Core
16-bit Timer
Watchdog
Timers
CCP
Memory and
Speed
SRAM (KB)
ROM SW
Library
Max Speed
(MHz)
Internal
Precision
Oscillator
32-bit Timer
MCUs in Series
Ethernet Connected MCUs
Stellaris LM3S6965 Evaluation Kit:
LM3S6965 Evaluation Board
OLED graphics display with 128 x 64 pixel resolution
User LED, navigation switches, and select pushbuttons
Magnetic speaker
LM3S6965 I/O available on labeled break-out pads
Standard ARM 20-pin JTAG debug connector with input and output modes
MicroSD card slot
Included IP Web Server (from FreeRTOS.org)
Ethernet, USB, and JTAG Cables
CD containing evaluation software tools, documentation, quickstart guide,
Stellaris Peripheral Driver Library, and source code
Four versions, each only $69:
EKK-LM3S6965
ARM RealView Microcontroller Development Kit tools with 16KB address Limit
EKI-LM3S6965
IAR Embedded Workbench KickStart with 32KB address limit
EKC-LM3S6965
CodeSourcery Sourcery G++ GNU with 30-day evaluation license
EKT-LM3S6965
Code Red Technologies Red Suite with full evaluation license locked to board
Full Solution Menu
Main Menu
EK-LM3S6965: Evaluation Kit Overview
Stellaris LM3S6965 Evaluation Kit:
LM3S6965 Evaluation Board
Stellaris LM3S6965 microcontroller with fullyintegrated 10/100 Ethernet controller
Simple setup
OLED graphics display with 128 x 64 pixel resolution
User LED, navigation switches, and select
pushbuttons
Magnetic speaker
LM3S6965 I/O available on labeled break-out pads
Standard ARM 20-pin JTAG debug connector with
input and output modes
MicroSD card slot
Included IP and lwIP IP stacks with Web
Servers
Retractable Ethernet Cable, USB cable,
and JTAG cable
CD containing:
Evaluation software tools
Device documentation
quickstart guide,
Stellaris Peripheral Driver Library
Example source code
EK-LM3S6965: Hardware Features
JTAG/SWD Input
and Output
Reset Switch
Debug Out LED
Navigation Buttons
Power LED
OLED Graphics Display
34 Pin I/O Breakout
Header
Stellaris LM3S6965
microSD Memory Slot
10/100BaseT
Ethernet Jack
Speaker
User Status LED
User Push Button
26 pin I/O Breakout
Header
In-circuit Debug
Interface
USB Interface
Ethernet Hardware: Simple Hardware Design
EK-LM3S6965: Debug Interface Mode
The LM3S6965 evaluation board can be used as an In-Circuit Debugger
Interface (ICDI).
The board can be used to debug other Stellaris hardware such as a custom
board. This feature is supported by Keil, IAR, CodeSourcery, and Code Red
tools.
ARM Cortex-M3 JTAG and SWD/SWT
JTAG
Industry standard boundary scan
for in-circuit testing
In-circuit flash programming
Parallel JTAG TAP
Allows access to chip JTAG for
boundary scan, or
Cortex-M3 JTAG for debug support
Serial Wire Debug / Serial Wire Trace
(SWD/SWT)
New technology to provide debug
access and control in two pins, with
an optional pin for trace information
Development Tools for Stellaris MCUs
Eval Kit License
30-day full
function.
Upgradeable.
32KB addresslimited.
Upgradeable.
16KB addresslimited.
Upgradeable.
Full functional;
locked to board.
Upgradeable.
Compiler
GNU C/C++
IAR C/C++
RealView C/C++
GNU C/C++
Debugger / IDE
gdb / Eclipse
C-SPY /
Embedded
Workbench
Vision
code_probe /
Eclipse-based
tool suite
Full Upgrade
199 USD
personal edition /
3000 USD full
support
2700 USD
MDK-Basic (256
KB) = 2000
(2895 USD)
999 USD
(upgrade to run
on customer
platform)
J-Link, ~299
USD
U-Link, ~199
USD
Red Probe, 155
USD
JTAG Debugger
Remember: In addition to its original use as an evaluation kit, each
Stellaris evaluation kit has the built-in capability for use as a
simple USB-to-20-pin JTAG debugger.
Full Solution Menu
Main Menu
Communications Stacks for Stellaris MCUs
Micrim C/TCP-IP
Express Logic NetX TCP/IP protocol stack
CMX-MicroNet protocol stacks
InterNiche TCP/IP NicheStack, NicheLITE, and add-on modules such as
HTTP, SNMP, and security protocols
EtherNet/IP protocol stacks
FreeRTOS.org Open-Source IP Embedded web server
IP Embedded TCP/IP Stack
lwIP TCP/IP Stack
Open source TCP/IP stack for small footprint embedded systems
Open source light-weight implementation of the TCP/IP stack for small RAM
embedded systems
IEEE 1588 PTP (Precision Time Protocol)
SEVENSTAX TCP/IP Protocol Stack
Open Source TCP/IP Stacks
uip
Protocols supported
Transmission Control Protocol (TCP)
User Datagram Protocol (UDP)
Internet Protocol (IP)
Internet Control Message Protocol (ICMP)
Address Resolution Protocol (ARP)
Typical code size on the order of a few
kilobytes
RAM usage can be as low as a few hundred
bytes.
Memory conserved by limiting to one
outstanding transmit packet
Website
http://www.sics.se/~adam/uip
Protocols supported
Memory requirements
lwip
Memory Requirements
uip and lwip licenses
No restriction in shipping in real products
Redistribution of stack source or binaries
(such as in our kit) must carry copyright
Typical code size is on the order of 25 to 40
kilobytes
RAM requirements are approximately 15 to a few
tens of kilobytes
Website
Internet Protocol (IP) including packet forwarding
over multiple network interfaces
Internet Control Message Protocol (ICMP) for
network maintenance and debugging
User Datagram Protocol (UDP) including
experimental UDP-lite extensions
Transmission Control Protocol (TCP) with
congestion control, RTT estimations, and fast
recovery/transmit
Dynamic Host Configuration Protocol (DHCP)
Point-to-Point Protocol (PPP)
Address Resolution Protocol (ARP) for Ethernet
Specialized raw API for enhanced performance
Optional Berkeley-like socket API
http://www.sics.se/~adam/lwip
http://savannah.nongnu.org/projects/lwip
Build an embedded web server using StellarisWare!
EKx-LM3S6965: Key Steps to get up and running
Documentation and software
Connecting the board
USB drivers
Tool Chain
Application example, drivers and more
Import, compile, debug an embedded web server
Customize examples
Documentation and Software CD
The Luminary Micro Software and
Documentation CD contains a
wealth of information.
This includes:
Quickstarts
Datasheets
Users manuals
Schematics
Application notes
Example software
and more
More information and updates are
available at:
www.luminarymicro.com
Tell us how to communicate with you!
Log in to Luminary
Micro website
Sign up for automatic
updates on:
Software updates for
devices, kits, and
reference designs
Errata notifications
Product Change
Notices (PCNs)
Applications notes
updates and
publication
Datasheet updates
Never miss out on
PCNs or errata that
affect your design!
Connect the Eval Board
Use the USB cable supplied in the kit to power the eval board.
Connect the mini-b (smaller) end of the USB cable to the connector labeled
USB TO JTAG/SWD on the EVB.
Connect the other end (Type A) to a free USB port on your host PC.
Connect the Ethernet cable supplied in the kit between the eval board and
the connector on your laptop (unless you have a router supporting DHCP
available in which case you should plug both into this instead).
The quickstart application will begin, enjoy the game!
USB Drivers for EK-LM3S6965
When you plug in the EVB for the first time, Windows starts the Found New
Hardware Wizard and asks if Windows can connect to Windows Update to
search for software. Select No, not this time and then click Next.
You will need administrator privileges to install the device drivers
USB Drivers for EK-LM3S6965
There are 3 USB driver s to install
Stellaris Evaluation Board A.
Stellaris Evaluation Board B.
Stellaris Virtual COM Port.
A Found New Hardware Wizard appears asking to install drivers for each of
these devices in Sequence
Install your preferred Tool Chain
Stellaris evaluation kits come with the evaluation
version of either
IAR Embedded Workbench for ARM Kickstart
Keil MDK ARM
CodeRed Red Suite (GCC/Eclipse)
Code Sourcery (GCC/Eclipse)
Codered - Red Suite Evaluation Tools
No time limits!
Fully featured including Red Trace SWV support
The evaluation version is a code size UNLIMITED and full
featured on Stellaris Evaluation Kits.
With the evaluation version, debug out functionality to
custom target boards is limited until a license is purchased.
Install application examples, drivers and more
Free license and royalty-free source code:
Peripheral Driver Library
Graphics Library
USB Library
Boot Loader
IEC 60730 Library
Example Applications
Third Party utilities
Enabling our customers with the ability to rapidly develop
and deploy their products at competitive costs yielding a
higher overall value for the Stellaris solution!
Can be found on evaluation kit CD or downloaded from
the Luminary Micro website
Import / Load Application Examples
Once StellarisWare is installed all application
examples can be found in
./Stellarisware/boards/ek-lm3sxxxx
Keil
IAR
Codered
Codesourcery
*.mpw
*.eww
*.xml
makefile
Codered: Import the EK-LM3S6965 Projects
Open the Quickstart Projects and Files
list.
Select Import project(s) from XML
description.
Browse to the relevant location
Import all required projects
Code Red: IDE C/C++ Perspective
The Code Red IDE is a customized version of the open source Eclipse IDE (Europa
release)
Workspace/source
browser
Source editor
Outline view: Include
files, function
prototypes, etc.
Quick start
shortcuts
Console, datasheet
browser, error window
Codered: Program and Debug Project
The Debug Perspective has standard Eclipse debug capabilities plus the Code Red
SWV plug-in
Debug thread view
window
Core register,
variable, breakpoint,
peripheral viewers
Source/PC view
Outline view: Include
files, function
prototypes, etc.
Console, Memory
windows, and Red
Trace SWV viewer
Press this button to
run the application.
EKx-LM3S6965 - Available examples
bitband
blinky
boot_demo1
boot_demo2
boot_serial
enet_io
enet_lwip
enet_ptpd
enet_uip
gpio_jtag
graphics
hello
interrupts
mpu_fault
pwmgen
qs_ek-lm3s6965_revc
sd_card
uart_echo
watchdog
Ethernet examples
Embedded Control Web Page (enet_io)
enet_io
Servers web pages from
internal flash
The enet_io application
illustrates two methods of
controlling board operations
from the web browser:
I/O Control Demo 1 shows
direct HTTP requests
generated via JavaScript
code in the web page
(io_http.html).
I/O Control Demo 2 shows
the use of Server Side
Includes (SSI) and
Common Gateway
Interface (CGI) to perform
the same operations
(io_cgi.shtml)
All web site files are stored
as a file system image
(io_fsdata.h) linked into the
application image in flash.
Web Server Demos uIP, lwIP
o
enet_lwip
o
Serves web
pages from
internal flash or
from user microSD card
o
Extended support
for SSI & CGI
added to lwIP
HTTPD
o
All web site files
are stored as a
file system image
(lmi_fsdata.h)
enet_uip
o
Serves basic
single page
o
Web pages
stored as ascii
character array
(httpd.c)
Full Solution Menu
Main Menu
LM3S6965 Web Server Game Mode
o
QuickStart/lwip
o
Serves web
pages from
internal flash
o
Serves map for
arcade game
o
All web site files
are stored as a
file system
image (fsdataqs.h) linked into
the application
image in flash.
Full Solution Menu
Main Menu
IP Address Assignment
Example applications first attempt to use DHCP to
obtain an IP address.
With a DCHP server available, an IP address is
typically assigned to the board in a few seconds.
If DHCP times out (as it will here since we do not
have a DHCP server available), a link-local IP
address (169.254.xx.yy) is chosen using the
AUTOIP (RFC3297) protocol.
DHCP timeout defaults to 1 minute so it may take
some time for the board and laptop to pick IP
addresses.
The lwIP TCP/IP stack can be configured for
DHCP, AUTOIP or static IP address use.
Example wed site customization
Modifying the web site in enet_io, enet_lwip
makefsfile.exe tool is included in example root
directory.
HTML and images are stored within the application
binary as a file system image.
This data can be found in:
- io_fsdata.h
- lmi_fsdata.h
The application web site can be found in the fs
directory imported alongside the application.
After changing content in the fs directory, rebuild the
file system image using command:
enet_io
enet_lwip
makefsfile -i fs -o io_fsdata.c -h r
executed from the example directory
Demonstrations
Embedded Ethernet Control Examples
Embedded Ethernet Control: Motor Control
Example applications:
Factory automation
Small appliances
Electric wheelchairs and mobility devices
Pumping and ventilation systems
Advanced motor control for three-phase brushless DC
motors up to 36 V 500 W
Flexible platform accelerates integration process
Uses a Stellaris LM3S8971 microcontroller
10/100 Ethernet and CAN interfaces
Four quadrant operation for precise control
Hall Effect and Quadrature operation modes
Sensorless operation modes
On-board braking circuit
Incremental quadrature encoder input
Analog and digital control inputs
Status LEDs indicate Power, Run, and Fault
conditions
Optional power-managed fan for forced-air cooling
JTAG/SWD port for software debugging
Embedded Ethernet Control: Motor Control GUI
Optional PC-side GUI
based on LabWindows
Configure motor
capabilities and safety
parameters
Test controls and effects
Understand tradeoffs in
end motor system design
View system statistics
Embedded Ethernet Control: Serial-to-Ethernet
Example applications:
SCADA Remote Terminal Units (RTUs)
Electronic Flow Meters (EFMs)
Medical Point-of-Care and Retail Point-of-Sales Machines
CCTV RS-232 Recorders
RS-232 Stepper Motor Controller Systems
LM3S6432 in a 10 x 10 mm BGA package for reduced
board size
10/100 Mbit Ethernet port
Serial ports
UART0 has RS232 levels, transceiver runs at up to 250
Kbits/sec
UART1 has CMOS/TTL levels, can run at 1.5 Mbits/sec
UART ports include RTS/CTS for flow control
Software
Auto MDI/MDIX cross-over correction
Traffic and link indicators
IP configuration with static IP address or DHCP
Telnet server for access to serial port
Web server for module configuration
UDP responder for device discovery
Telnet client for Ethernet-based serial port extender
Module supports 5 V and 3.3 V supplies
JTAG port pads for factory programming
Embedded Ethernet Control: Automation Demo
Robotic Arm
Servo Control
Board
CAN cable
Geared
BLDC Motor
Brushless DC
Motor Controller
Web Browser Console for Automation System Demo