MicroWebServer

From Wiki

(Difference between revisions)
Jump to: navigation, search
(Zusammenbau)
Line 32: Line 32:
For demonstration purposes there is a usual webserver-application added to the download-package. This application takes place on the top of the stack (according to the OSI layer model). It implements a server for webpages that can be accessed by a regular internet browser. The server currently supports GET and POST request, to configure the 14 I/Os on the extension headers or set the output value of those. (HIGH +3.3V, LOW 0V)
For demonstration purposes there is a usual webserver-application added to the download-package. This application takes place on the top of the stack (according to the OSI layer model). It implements a server for webpages that can be accessed by a regular internet browser. The server currently supports GET and POST request, to configure the 14 I/Os on the extension headers or set the output value of those. (HIGH +3.3V, LOW 0V)
-
==Zusammenbau==
+
==Assembly==
-
===Was wird benötigt===
+
===Needed tools===
-
*Lötkolben (SMD tauglich)
+
*Soldering iron (SMD capable)
-
*Fortgeschrittene Löterfahrung (0805-SMD, TQFP44)
+
*Advanced soldering experience (0805-SMD, TQFP44)
-
*Atmel AVR Programmiergerät mit 6poligem Stecker und Kompatibilität für 3,3V Zielspannung
+
*Atmel AVR programmer with a 6 pin header and compability for 3.3V target voltage
-
*Spannungsquelle 5V - 7V DC mit mindestens 150mA
+
*Voltage source of 5V - 7V and at least 150mA
-
===Bestückung===
+
===Mounting===
-
#niedrige Bauelemente wie 0805 Kondensatoren/Widerstände bestücken
+
#lower parts like 0805 capacitors/resistors
-
#ATMega168, ENC28J60 und LM1117 bestücken
+
#ATMega168, ENC28J60 and LM1117
-
#Quarz und andere Kondensatoren bestücken
+
#crystal and remaining capacitors
-
#Pfostenleisten bestücken
+
#pinheaders
-
#Ethernet-Buchse bestücken
+
#ethernet jack
-
*Lötkolben nicht zu lange an das gleiche Bauteil halten
+
*Don't heat up a part too long
-
*Vorsichtig löten um keine schwer auffindbaren Lötbrücken einzubauen
+
*Solder carefully without creating short circuits
-
*Wenn nötig mit Lupe oder Mikroskop löten
+
*If necessary, use a magnifier or microscope while soldering
-
===Inbetriebnahme===
+
===Setup===
-
#Sources herunterladen ({{ProjectLinkDownloads}})
+
#Download sources ({{ProjectLinkDownloads)
-
#Am Netzwerk anschließen
+
#Connect to network via RJ45 connector patch cable
-
#Spannungsquelle an die 2-polige Stiftleiste anschließen (Polung beachten!)
+
#Connect voltage source to 2-pin header
-
#Programmiergerät an 6-poliger Programmierschnittstelle anschließen
+
#Connect programmer to 6-pin header
-
#Optional: Programm modifizieren und neu kompilieren (siehe [[#Konfiguration]])
+
#Optional: Modify sources and recompile (See [[#Configuration]])
-
#HEX-Datei in den Mikrocontroller flashen
+
#Flash HEX file into microcontroller using the programmer
-
#Fuses des AVR modifizieren ('''LFuse:''' E0h, '''HFuse''': DDh)
+
#Modify Fuse-bits of AVR ('''LFuse:''' E0h, '''HFuse''': DDh)
-
##Taktquelle auf Ext. Clock stellen (Startup Time 65ms)
+
##Use ext. clock as clock-source (startup-time: 65ms)
-
##Brown Out Detector auf 2,7V einstellen
+
##enable Brown Out Detector using 2.7V as threshold
-
Nach dem Programmiervorgang wird der Mikrocontroller automatisch gestartet und beginnt den ENC28J60 zu initialisieren und seine eigene Taktquelle auf 12,5MHz einzustellen. Ab jetzt sollte die grüne Leuchtdiode an der Netzwerkbuchse dauerhaft leuchten und bei Empfangsaktivität erlischen. Die andere (rote/gelbe) Leuchtdiode leuchtet bei Sendeaktivität.
+
After successfully programming the AVR it automatically begins to initialize the ENC28J60 and switches to 12.5MHz main-clock. Now the green light of the ethernet should be glowing. This means that the ENC28J60 sensed an ethernet connection. The green light goes off while packets are being received. If packets are being sent, the red light begins to light up.
Nachdem an die 2 polige Stiftleiste eine Spannung von etwa 5V - 7V DC angelegt wurde und ein Netzwerkkabel eingesteckt wurde, sollte sich etwas an den Leuchtdioden der Netzwerkbuchse tun.
Nachdem an die 2 polige Stiftleiste eine Spannung von etwa 5V - 7V DC angelegt wurde und ein Netzwerkkabel eingesteckt wurde, sollte sich etwas an den Leuchtdioden der Netzwerkbuchse tun.

Revision as of 17:18, 26 May 2008

Features

Contents

Introduction

The MicroWebServer is a small Webserver using the popular ENC28J60 (produced by Microchip) and an ATMega168 AVR (Atmel).

It was designed to act as a platform for developing hardware-drivers for the ENC28J60 which still should bebe useful afterwards. In order to be useful, the MicroWebServer extends the unused I/O-pins to a 20 pole extension header that can be connected to another circuit board with relais on it, just to mention one example.

Hardware

Board

As you can see, the board-layout has been kept very common. Therefore it is possible to use this board in a versatile way. Although this, the board has become very compact by using SMD parts and small isolate values regarding the ground plane. The all-over size of the board measures 38x31mm². The board can be bought at IT-WNS Shop (Germany) either together with the needed electrical components or PCB-only. You can also make the PCB yourself and order the components at a random shop.

Voltage regulator

Among the electrical components there is a 3.3V fixed voltage regulator (LM1117). With an average drawn current of 150mA and with the approximately 1.1V dropout voltage, Ive decided to set the mark of maximum input voltage to 7V and the minimum input voltage to 5V. The absolute minimum input voltage is 4.4V.

Attention
The generated 3.3V are also available on the 20 pol extension header. Be sure that you dont draw more than 350mA on this line when you use an input voltage of 5V (Already about 0.6W power dissipation!). If you are even using 7V as input voltage, you shouldn't draw that much current at all.

Ethernet-Jack

The IT-WNS Shop ships different versions of the kit, depending on what ethernet-jack is currently available. Therefore there are two different board-layouts, since the original MagJack SI-60024-F uses another pinout than the Halo FastJack™ HFJ11-2450E-L12RL or ERNI Modular Jack M3D01-203199. Moreover the pinout of the integrated LEDs isn't always the same, so either you accept that you have some swapped colors or you change the initialization word of the ENC28J60 chip, which needs a recompile of the project (See FAQ).

The mentioned ethernet-jacks integrate an isolating ethernet-transformer needed for the electrical isolation according to the ethernet specifications.

Extension header

The MicroWebServer offers a 20 pole extension header to connect the 14 I/Os to external periphery. The remaining 6 pins on the extension header are 2xGND, 2x3.3V and 2xVin. All of the 14 I/Os can be configured to act as an input or output. Some of the pins utilize a special function like for example an integrated I²C module (No integrated pull-ups on board) or a 10-Bit A/D Converter (decoupling capacitor present on board) using a reference voltage of 3.3V or 1.1V integrated. Moreover there are pins having an output-compare function to produce PWM waveforms for example. Also all of the 14 I/Os can trigger a pin-change interrupt.

Software

Network-Stack

The uip-Stack is used to implement the upper network-layers (IP, ARP (Echo), ICMP, UDP and TCP).

Stack-Application

For demonstration purposes there is a usual webserver-application added to the download-package. This application takes place on the top of the stack (according to the OSI layer model). It implements a server for webpages that can be accessed by a regular internet browser. The server currently supports GET and POST request, to configure the 14 I/Os on the extension headers or set the output value of those. (HIGH +3.3V, LOW 0V)

Assembly

Needed tools

  • Soldering iron (SMD capable)
  • Advanced soldering experience (0805-SMD, TQFP44)
  • Atmel AVR programmer with a 6 pin header and compability for 3.3V target voltage
  • Voltage source of 5V - 7V and at least 150mA

Mounting

  1. lower parts like 0805 capacitors/resistors
  2. ATMega168, ENC28J60 and LM1117
  3. crystal and remaining capacitors
  4. pinheaders
  5. ethernet jack
  • Don't heat up a part too long
  • Solder carefully without creating short circuits
  • If necessary, use a magnifier or microscope while soldering

Setup

  1. Download sources ({{ProjectLinkDownloads)
  2. Connect to network via RJ45 connector patch cable
  3. Connect voltage source to 2-pin header
  4. Connect programmer to 6-pin header
  5. Optional: Modify sources and recompile (See #Configuration)
  6. Flash HEX file into microcontroller using the programmer
  7. Modify Fuse-bits of AVR (LFuse: E0h, HFuse: DDh)
    1. Use ext. clock as clock-source (startup-time: 65ms)
    2. enable Brown Out Detector using 2.7V as threshold

After successfully programming the AVR it automatically begins to initialize the ENC28J60 and switches to 12.5MHz main-clock. Now the green light of the ethernet should be glowing. This means that the ENC28J60 sensed an ethernet connection. The green light goes off while packets are being received. If packets are being sent, the red light begins to light up.

Nachdem an die 2 polige Stiftleiste eine Spannung von etwa 5V - 7V DC angelegt wurde und ein Netzwerkkabel eingesteckt wurde, sollte sich etwas an den Leuchtdioden der Netzwerkbuchse tun. eine grüne Leuchtdiode an der Ethernet-Buchse leuchten. Dies bedeutet, dass ein Ethernet Link hergestellt ist. Auf der grünen Leuchtdiode wird außerdem die Empfangsaktivität des Ethernet-Chips, durch ein kurzes Erlischen der Leuchtdiode dargestellt. Die andersfarbige Leuchtdiode an der Buchse leuchtet bei Sendeaktivität.

Attention
Sollte die Leuchtdioden-Konfiguration nicht zufriedenstellend sein, kann diese im Sourcecode angepasst werden. Siehe FAQ.

Sofern die Konfiguration in Schritt 5 nicht verändert wurde, sollte der Server unter der IP-Addresse 192.168.0.55 erreichbar sein. Für einen schnellen Funktionstest kann also das Kommandozeilen-Tool "ping" benutzt werden.

ping 192.168.0.93

Konfiguration

Standardkonfiguration:

  • MAC-Adresse: 00:03:6F:55:1C:C2
  • IP-Adresse: 192.168.0.93
  • Netzmaske: 255.255.255.0
  • Gateway: 192.168.0.254
  • Weberver-Port: 8080

Die Konfiguration der MAC-Adresse kann in Hardware/Enc28j60.h angepasst werden. IP-Adresse, Netzmaske und Gateway lassen sich in Main.c anpassen und der Webserver-Port kann in Net/TcpApps/HttpD.h angepasst werden. Nach dem Anpassen muss das Projekt neu kompiliert werden. Hierfür muss eine AVR-GCC Installation (zB WinAVR für Windows) vorhanden sein.

Personal tools
In other languages