MicroWebServer

From Wiki

(Difference between revisions)
Jump to: navigation, search
Line 17: Line 17:
===Ethernet-Jack===
===Ethernet-Jack===
-
The [http://www.it-wns.de/themes/kategorie/detail.php?artikelid=114&source=2 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 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 {{ProjectLinkFAQ}}).
+
The [http://www.it-wns.de/themes/kategorie/detail.php?artikelid=114&source=2 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 {{ProjectLinkFAQ}}).
-
Der [http://www.it-wns.de/themes/kategorie/detail.php?artikelid=114&source=2 IT-WNS Shop] liefert mehrere verschiedene Versionen des Bausatzes aus, da es zeitweilig Probleme mit der Beschaffung der vorgesehenen Ethernet-Buchse gab. Da diese neue Buchse unter anderem auch ein anderes Pinout hat, sind mehrere Versionen der MicroWebServer-Platine im Umlauf.
+
The mentioned ethernet-jacks integrate an isolating ethernet-transformer needed for the electrical isolation according to the ethernet specifications.
-
Desweiteren ist die Belegung der Leuchtdioden an selbigem nicht immer gleich, sodass man entweder unterschiedliche Farben für die Sende-/Empfangsaktivität bzw. Ethernet Link hat, oder das Initialisierungswort des ENC28J60 so anpasst, dass die Funktion der Leuchtdioden getauscht wird. (Siehe {{ProjectLinkFAQ}})
+
-
Die verwendete(n) Ethernet-Buchse(n) hat/haben einen Ethernet-Übertrager integriert, was das Layout um einiges verkleinert hat. Dieser Übertrager ist nötig um das Potential des MicroWebServers von dem Potential auf den Netzwerkleitungen zu trennen. (Galvanische Trennung).
+
===Extension header===
-
In der ersten Version des MicroWebServers war dies die "Magjack SI-60024-F" Buchse. In den neueren Versionen wird entweder die "Halo FastJack™ HFJ11-2450E-L12RL" oder die "ERNI Modular Jack M3D01-203199" Buchse verwendet.
+
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.
-
===Pfostenleiste===
+
-
Der MicroWebServer bietet eine 20-polige Pfostenleiste um die 14 darauf gelegten Ein-/Ausgänge sauber mit externer Peripherie zu verbinden. An diesem 20-poligen Steckverbinder befinden sich neben 2xGND, 2xEingangsspannung und 2x3,3V, wie gesagt, die 14 Pins des ATMega168.
+
-
Alle dieser 14 Pins können als normale Ein- oder Ausgänge geschaltet werden. Manche dieser Pins besitzen aber auch Spezialfunktionen, wie zum Beispiel ein integriertes I²C Modul ('''Keine Pull-Ups auf der Platine vorhanden!'''), 6 analoge Eingänge die auf den internen 10-Bit AD-Konverter gehen ('''Kondensator an AREF ist auf dem Layout vorgesehen. Typisch: 100nF. Als Referenz können die 3,3V aus dem Spannungsregler, sowie 1,1V intern gewählt werden.'''), sowie diverse Output-Compare Einheiten um Signalformen für beispielsweise PWM zu erzeugen. Jeder der 14 Pins ist zudem noch fähig einen Pin-Change-Interrupt auszulösen.
+
==Software==
==Software==
-
===Netzwerk-Stack===
+
===Network-Stack===
-
Als Netzwerk Stack kommt der [http://www.sics.se/~adam/uip/index.php uip-Stack] von Adam Dunkels zur Verwendung. Er implementiert die Netzwerkfähigkeiten der höherliegenden Schichten (insgesamt IP, ARP (Echo), ICMP, UDP, TCP).
+
The [http://www.sics.se/~adam/uip/index.php uip-Stack] is used to implement the upper network-layers (IP, ARP (Echo), ICMP, UDP and TCP).
-
===Stack-Applikation===
+
===Stack-Application===
-
Zur Demonstration ist dem Downloadpaket eine klassische Webserver-Anwendung beigelegt. Diese Applikation liegt in der obersten Schicht des OSI Modells und somit über dem uip-Stack.
+
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)
-
Die Anwendung implementiert einen einfachen Webserver, der über einen Browser abgefragt werden kann (GET) und über diesen auch Daten wieder empfangen kann(POST). Mit der Beispielapplikation können die 14 herausgeführten Pins an der 20-poligen Pfostenleiste auf Ein- oder Ausgang geschaltet werden, sowie in ihrem Pegel (HIGH +5V, LOW 0V) verändert werden.
+
==Zusammenbau==
==Zusammenbau==

Revision as of 17:07, 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)

Zusammenbau

Was wird benötigt

  • Lötkolben (SMD tauglich)
  • Fortgeschrittene Löterfahrung (0805-SMD, TQFP44)
  • Atmel AVR Programmiergerät mit 6poligem Stecker und Kompatibilität für 3,3V Zielspannung
  • Spannungsquelle 5V - 7V DC mit mindestens 150mA

Bestückung

  1. niedrige Bauelemente wie 0805 Kondensatoren/Widerstände bestücken
  2. ATMega168, ENC28J60 und LM1117 bestücken
  3. Quarz und andere Kondensatoren bestücken
  4. Pfostenleisten bestücken
  5. Ethernet-Buchse bestücken
  • Lötkolben nicht zu lange an das gleiche Bauteil halten
  • Vorsichtig löten um keine schwer auffindbaren Lötbrücken einzubauen
  • Wenn nötig mit Lupe oder Mikroskop löten

Inbetriebnahme

  1. Sources herunterladen (Downloads)
  2. Am Netzwerk anschließen
  3. Spannungsquelle an die 2-polige Stiftleiste anschließen (Polung beachten!)
  4. Programmiergerät an 6-poliger Programmierschnittstelle anschließen
  5. Optional: Programm modifizieren und neu kompilieren (siehe #Konfiguration)
  6. HEX-Datei in den Mikrocontroller flashen
  7. Fuses des AVR modifizieren (LFuse: E0h, HFuse: DDh)
    1. Taktquelle auf Ext. Clock stellen (Startup Time 65ms)
    2. Brown Out Detector auf 2,7V einstellen

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.

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