| Written by Administrator, on 27-10-2007 11:44 |
| Views |
2917  |
|
How-to build a web server for 30 euros !
The ENC28J60 is a single chip 10mb Ethernet controller easy to drive by a microcontroller with SPI bus. It's a cheap low pin-out (28 pins) chip available in various packages including SPDIP, so it's a good choice for the electronic hobbyist.
The chip is pretty new and it's difficult to find informations about it. In this web page I will try to compile information gleaned over the web about this chip.
Here is a picture of my prototype ready to serve web pages :) :
The board
First, let's have a look at the ENC28J60 data-sheet. The figure 2.4 (page 9) is the minimal application schematic.
We can find different experimentation boards on the web.
The board below is compatible with the Microchip Ethernet PICtail(TM) Daughter Board for pin assignment. It will be possible to use the Microchip TCP/IP stack with only few modifications because it use a PIC 18F4620 (or 18LF4620 for running at 3.3V) microcontroller.
Step 1 - The minimal circuit (running at 3.3V)

Click to enlarge
Step 2 - The board with a serial interface and a level shifting system made with 74HCT08 AND gates. Microcontroller is running at 5V and ENC at 3.3V.
(Warning, the concept looks fine, but I encountered odd problems with level shifting system on my proto??)

Click to enlarge
Warning - These are prototypes, please report any mistakes on these circuits
Here are my tips to build the circuit:
- 50 Ohms/1% resistors are not standards. My solution is to put two 47 and 2.7 Ohms resistors in serial and to select them with an ohmmeter.
- The ferrite bead is not well described in the data sheet. It should support 100mA... well, a general purpose ferrite with 60 Ohm resistance at 100MHz seems OK. Note: For prototyping you can remove the ferrite, it's only necessary to eliminates interferences
- Ethernet transformer is an other big problem. It looks that Ethernet magnetics designed for RTL8019 should be compatibles in many cases (but the filter level will not be tuned for the enc28J60, so maybe it could impact signal level in some conditions). Mine is a P02-102-17C9 connector. The best is to buy an Ethernet connector with magnetics included but this kind of device is not easy to find. (In France you can look at Lextronic, a small shop near Paris)
The softwareMicrochip provide a driver for the ENC28J60 and a TCP/IP stack including an HTTP web server. Webpages are stored in external or internal eeprom. This firmware is written in C (Compatible with Microchip C18 compiler). This code is free (like in free beer) but unfortunately it's not a free software. You can find it here
I don't know if it's possible to redistribute this software with some modifications. So I suggest to download it from the microchip website and you can follow these tips if you want to run it on an home made board:
- With MPLAB, choose mpnicpg.mcp project to use the internal memory
- Select your device( for example PIC 18F4620) in the MPLAB Configure Menu,
- Change the specified Linker Scripts for your device
- Eventually adjust the pin assignment in enc28j60.c (in the DEFINITIONS section), don't forget to change TRIS settings too
- Eventually modify builds options to remove dhcp and then remove dhcp.c from the project and set the IP configuration in stack_task.h
- Change the MPU frequency in the file compiler.h
- Eventually change the SYSTEM LED port in MainDemo.c
- Modify web pages in the webpages directory. Generate the mpfs C file with the mpfs utility (MPFS directory MPFSImg.c /c )
- It's easy to handle Input/Output microcontroller pins with functions HTTPExecCmd and HTTPGetVar
in MainDemo.c
Live Demo
When the prototype is plugged, you can see the on-line demo. On line demo
Getting helpAsk your question to the electronicfr community http://www.electronicfr.com/forum/phpBB2/viewforum.php?f=2.
DisclaimerANY CONTENT ON THIS WEBSITE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|