Vous êtes sur la page 1sur 4

Indonesian Journal of Physics

Kontribusi Fisika Indonesia

Vol. 14 No.3, Juli 2003

Development of Single-Board Computer Based Web Server for Physics Related Instrumentation and Its More General Usage
Endarko1) and Zaki Suud2) Electronics and Instrumentation Laboratory Physics Department, FMIPA Sepuluh Nopember Institute of Technology Kampus ITS, Keputih Sukolilo Surabaya 60111 2) Nuclear and Parallel Processing Laboratory Physics Department, FMIPA Bandung Institute of Technology Jl. Ganesa 10 Bandung 40132 e-mail : szaki@fi.itb.ac.id
1)

Abstract The web server single-board provides web access to some digital I/O and serial I/O signals without the need for assistance from external PCs or UNIX computers. Its stand-alone device with real-time networking kernel, a TCP/IP stack, and HTTP web server. This project started partly as an excuse to use a new microprocessor and partly to settle a long-standing argument about the possibility of delivering web pages with a commercial microcontroller. The Atmel AT90S8515 microprocessor looked exciting with its low power RISC processor, 8 KB flash program memory, 512 bytes of EEPROM, 512 bytes of RAM, 32 I/O lines, and a built-in UART. The proposed device is designed application for physics related instrumentation and its more general usage. Keywords: Web server single-board, real-time networking kernel, TCP/IP stack, EEPROM, UART. 1. Introduction See the worlds smallest web server. Step right up and see how these guys put together a stand-alone web server that includes an Ethernet controller, realtime networking kernel, and TCP/IP stack. The web server single-board started partly as an excuse to use a new microprocessor and partly to settle a longstanding argument about the possibility of delivering web pages with commercial microcontroller1). The Atmel AT90S8515 is a low-power CMOS 8-bit microcontroller based on the AVR RISC architecture, 8 Kb of flash program memory, 512 bytes of EEPROM, 512 bytes of SRAM, 32 I/O lines, and built-in UART. By executing powerful instructions in single clock cycle, the AT90S8515 achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consumption versus processing speed2). With an execution rate of one instruction per clock and a clock rate of 8 MHz, the AT90S8515 can transfer data over the ISA bus at full speed (about 2 MBps). For debugging purposes, we hooked up the micros serial port to cable with an RS-232-level converter embedded in the DE-9 connectors hood. 2. Hardware The block diagram of the hardware connection is shown in figure 1. Its has been adapted from PicoWeb Embedded Internet Workshop Seminar3).

Figure 1. Block diagram Web server Single-board As can be seen from the block diagram, the web server single-board connected to the internet via a RJ-45 Ethernet socket. There was also a supplied programming cable and serial cable. On the other end, any digital input/output to web server single-board was via the DB-25 plug. This included 15 free I/O lines, program downloads via the serial peripheral interface (SPI) port, as well as any serial data I/O3). The hardware of the Web server contains two integrated circuits that have volatile and non-volatile storage which needs to be configured before the web server can be used. One is the Atmel AT90S8515 microcontroller and the other is an I2C serial EEPROM chip. The Atmel microcontroller chip has three kinds of memory: static RAM (512 bytes), flashbased program memory (8 Kbytes), and on-chip EEPROM (512 bytes). The I2C serial EEPROM chip holds between 16 and 32 Kbytes of data, depending upon how to build the web server made. The configuration of the initialized portion on the static RAM, the two EEPROM memory blocks (on-chip and external) and

93

94

KFI Vol. 14 No. 3, 2003

the microcontrollers flash-based program storage is defined completely by the PWP file5).

3. Firmware Description The web server single-board firmware supported a simple kernel that had the organization shown in figure 2. Its main function was for serving web pages. The Ethernet controller provided the support for the two lowest layers of control, hence the Atmel microcontroller looked after all those above them. The next two layers contain the network adapter driver and TCP/IP networking stack. In the application layer is the HTTP web server.

The HTML file is required for displaying the result of the web server single-board. Java scripts and Java applets could be included for execution on the client program (web browser) to allow for software routines that were too large or complex for the web server single-board. CGI routines were embedded into the web pages for execution at user interactions. C program could also be linked into the program. The PWP file fully specified the configuration and inputs of various units of the web server singleboard. The format of the PWP file is shown in listing 15).

Figure 2. Firmware layers in web server single board4) Listing 1. PWP file structure The web servers unique Ethernet address is broadcast as part of the BOOTP request packet. If a valid BOOTP response is received, the web server uses the contents of the response to set its IP address. The web server single-board also responds to ICMP echo, or ping, requests. The server responds to ICMP echo requests by responding with an echo reply. ICMP echo requests are typically generated by using a program called ping on a remote host. The ping program enables users to quickly test network connectivity with the web server single-board and evaluate the round trip time (RTT) of the echo request/replies. The firmware also provided various tools for embedded system projects. These include a p-code interpreter, an extensible debugging monitor for EEPROM alteration and memory dumps, as well as file system inside the serial EEPROM for the storage of web page-related files such as HTML, CGIroutines, Java scripts, and Java applets. 4. Software Various software pieces were required to make a PWP (Picoweb project). The file organization is shown in figure 3. Note that not all files are required. Figure 4. Application Single-Board Computer Based Web Server for control LED Figure 3. Application software organization of the web server single-board4)
// HTML file for Thesis Endarko project <html> <head> <title>Thesis Endarko Percobaan</title> </head>

5. Web Server Single-Board HTML Tag and Applications Listing 2 shows the contents of the home page from the sample project Thesis Endarko Percobaan. This page will display the Web page shown in Figure 4. To those familiar with HTML, this file looks very much like an ordinary HTML document except for some odd syntax relating to tokens tagged with back-ticks (`).

KFI Vol. 14 No. 3, 2003

95

<body text=#000000 bgcolor=#c0c0c0> <center> <p><img src="koko.jpg" alt="NuklirWeb Logo" width=175 height=54></p> <h2>Laboratorium Nuklir dan Komputer Paralel<br> NuklirWeb<sup><font size="-2">TM</font></sup> Server v$$VERSION$$ </h2> <h1><font color="red">Hello Mas Endarko!</font></h1> <center> <FORM name=mfrm0 method=GET action="/nyala.htm"> <input type=submit VALUE="LED Nyala"> </FORM> <FORM name=mfrm1 method=GET action="/Mati.htm"> <input type=submit VALUE="LED Mati"> </FORM> <FORM name=mfrm2 method=GET action="/pulsa.htm"> <input type=submit VALUE="LED Pulsa"> </FORM> <a href="javahits.html">Mau lihat jam Mas!!!</a> </center> <p>&#169;2002 Nuklir ITB Bandung</p> <p><small>Powered by <b><font face="Comic Sans MS">NuklirWeb&#153;</font></b> &nbsp;(<a href="http://nuklir.fi.itb.ac.id/">nuklir.fi.itba.c.id</a>) </center> </body> </html> File : Nyala.html <html> <center> LED Should be On `led_on.cgi` <FORM name=mfrm method=GET action="/"> <input type=submit VALUE="Kembali"> </FORM> </center> </html>

Figure 5. A Clock with Hit Counter.

Listing 2. Sample Web server Single-board page Figure 6. Simulation of Doppler Effect. The special tag `led_on.cgi` at the end of the file was mentioned previously. It tells the Web server to call the user-supplied p-code routine led_on at that point in the HTML code stream where that tag is located. Application about display an analog clock with hit counter and simulation of Doppler effect using Java applet is shown in figure 5 and figure 6. The clock applet has four parameters; the background color (bgcolor), the main foreground color (the hands and dial) (fgcolor1), the secondary foreground color (the seconds hand and numbers) (fgcolor2), and the NuklirWeb URL which returns the current hits count. The first three parameters are hexadecimal RGB numbers (like the ones used for the body bgcolor tag in HTML). For example: <applet code="hits" width=170 height=150> <param name=bgcolor value="000000"> <param name=fgcolor1 value="ff0000"> <param name=fgcolor2 value="ff00ff"> <param name=url value="hits.htm"> </applet> 6. Conclusion The creation of the web server single-board involved both hardware and software implementation. The proposed device is designed application for physics related instrumentation and its more general usage. References 1. S.Freyder, D. Helland, and B. Lightner, A $25 Web Server, Circuit Cellar Online, Jul. 1999, www.chipcenter.com/circuitcellar/july99/c79bl1. htm, (1999). G. Schmidt, Beginners Introduction to AVR assembly language, AVR-Tutorial, http://www.dg4fac.de.avr.avr_en/ (current Oct. 8, 2001). B.D. Lightner, PicoWebTM Block Diagram, PicoWebTM Embedded internet Workshop, October 1 1999, Lightner Engineering, San Jose, CA. http://www.picpweb.net/download/ eiw99/ sld004.htm, (1999). S. Kwong, A WebCam built on the PicoWeb Server, School of Information Technology and Electrical Engineering University of Queensland,

2.

3.

4.

95

96

KFI Vol. 14 No. 3, 2003

5.

St Lucia 4072, (Submitted for the degree of Bachelor of Engineering (Honours) in the division of Electrical Engineering, Oct. 2001). How to Build a PicoWeb Project, Picoweb Development System, Version 2.15, July 7 2002, Lightner Engineering, La Jolla CA http://www.picoweb.net/,

6.

ATMEL 8-bit AVR Microcontroller with 8 K Bytes In-System Programmable Flash (AT90S8515), Atmel Corporation, Updated Sep http://www.atmel.com/atmel/acrobat/ 2001, doc0841.pdf

Vous aimerez peut-être aussi