• Based on simplifies TCP/IP the agreement stack’s information electrical appliances network server

    Abstract: Through the analysis and the experiment, study embedded TCP/IP agreement stack S1C33-Stack the structure and the movement principle, gives constructs the single chip embedded network server by S1C33-Stack, and turns on Internet the information electrical appliances network to realize the plan. Studies in the single chip embedded network server S1C33-Stack and the user program connection plan, the user registers the software and the information electrical appliances monitors software’s design method.

        Key word: SIC33209 embedded system TCP/IP agreement stack network server information electrical appliances Internet

    Introduction

    S1C33209 is RISC which EPSON Corporation promotes the structure 32 high performance CMOS microprocessor, has high speed, low characteristics and so on power loss, low voltage operation, simplification set of instructions, provides while with accumulates the function, may also use in the office equipment, is also suitable specially in needs the high-level data processing the mobile equipment, may carry on the high speed operation, the nimble I/O mouth control and the highly effective data manipulation. S1C33209 has 8KB internal RAM, its operating rate may reach 60MHz, in addition optimizes most for the single clock cycle set of instructions, causes the S1C33209 volume of goods handled is the enhancement greatly. S1C33209 has the structure which compared to conventional MCU the quicker operating speed and the reliable performance, may duplicate program, enables the simplification TCP/IP to be able in reliability service.

    1 hardware platform structure and design

    When information electrical appliances long-distance access, the correspondence data quantity is not big, the 10M ethernet’s correspondence speed then satisfies requests; The next information electrical appliances are not high to the timely request, may locate in a second level.

    In this case, has constructed electrical appliances network hardware platform server S1C-WebServer, its structure as shown in Figure 1. S1C33-WebServer is mainly composed of three parts, namely the S1C33209 microprocessor, the RTL8019AS full-duplex ethernet controller (RealTek Corporation produces, 100 foot’s TQFP seals, maximum speed 10Mbps, brings 16KB SRAM, works in Ethernet II and under IEEE802.3, 10Base5, 10Base2, 10BasetT, full-duplex, supports 8 with 16 bit data main lines, with NE2000 compatible), may scratch writes Flash (to use Intel E28F320, capacity is 4MB). Considered Flash scratches writes is not too convenient in the program debugging, thought that the S1C33209 periphery expands 512KB SDRAM. In S1C33209, movement user program and S1C33-Stack. In Flash, deposits S1C-WebServer each kind of Web resources information, the synthesis may process the Web page, the image document and so on, may save the massive different pages with on the PC machine WebServer in hard disk. The Flash capacity has decided the WebServer resource file size. RTL9019AS is the Ethernet controller, is responsible for S1C33209 and the Ethernet data transfer. In the information electrical appliances have had RS232 or under the related standard interface condition, use household automation main line HAB (Home Automation Bus) takes S1C33-WebServer and family network protocol SHNP (Simple Home Networks Protocol). The electrical appliances through the RS232 connection and the S1C33-WebServer connection, turn on Internet by way of EEthernet.

        After the analysis, S1C33209 and the RTL8019AS read-write succession is compatible, moreover the MCU read-write latency is much smaller than RTL8019AS. MCU and RTL8019AS connection as shown in Figure 2. The RTL8019AS working voltage is 5V, but the S1C33209 working voltage is 3.3V, therefore the RTL8019AS data line output needs the level the transformation. Selects 2 8 (use 16 bit data main lines) has bidirectional data transmission function 74HC245 to complete, because the S1C33209 power output meets the RTL8019AS input level requirement, therefore the address wire may direct connected, but does not need the level switch, the RTL8019AD signal of stop (INT0) is the high level is effective, selects the port interrupt input in S1C33209 the K60 port to be connected with it. Because the S1C33209 interrupt effective way (high, low level or pulse) may act according to register’s establishment adjustment), therefore does not need to INT0 to make reverse or the level switch.

    2 simplify TCP/IP agreement stack’s realization

    The construction S1C33-Stack movement in take S1C33209 embedded CPU as in the foundation hardware platform, is many kinds of Internet agreement composition which a group may dispose. These agreements according to the layer protocol stack’s way organization, including application layer HTTP, DHCP, SMTP, transmission level’s TCP, UDP, network level’s IP/ICMP, ARP, (for example Ethernet) carry on the data through the link level and the physical level the interaction. S1C33-Stack structural model as shown in Figure 3. S1C33-Stack processes the TCP/IP data packet using the S1C33 high speed handling ability, has avoided in limited capacity RAM the buffer mass data, causes the controller to be possible to process compared to the internal RAM main line more data packets. Using inserting S1C33-Stack, Webserver can through Hypertext Transfer Protocol(HTTP) with any browser correspondence, be able to provide each type the resources, like HTML, picture document and so on. These resources may use one kind of special filing system URI, is deposited in the capacity is in 4MB Flash. This kind of filing system may contain willfully many tables of contents, has not limited to the URL length.

        Considered embedded system’s available resource is limited, uses in this after reduction TCP/IP agreement stack - uIP. the uIP agreement mainly includes in the TCP/IP agreement group four basic agreements: ARP, IP, ICMP, TCP. Link level agreement, if PPP, actuates as the equipment in the uIP first floor to realize. The application layer agreement, like HTTP, FTP, SMTP realize as the application procedure in the uIP upper formation.

    (1) Address Resolution Protocol ARP

    This agreement IP address mapping ethernet MAC address. In uIP, the ARP execution dependence maintains a table to complete the IP address and the MAC address mapping. When has a IP data packet must transmit to the ethernet on, from the ARP table inquires the corresponding MAC address. If could not find the IP address in the ARP table to send out the corresponding ARP request. After the goal main engine receives the ARP request message, transmits the MAC address which ARP the REPLY text will request to send out. After receiving ARP REPLY, ARP coating renewal. Every other 10s, ARP table new time, the old ARP table item will be deleted. Each ARP table life cycle is 20min.

    (2) between net agreement IP

    In uIP, the IP level’s code has two functions: Confirmation arrival IP text masthead accuracy, and implements the divergence to TCP and the ICMP text. Because does not consider IP the lamination and the reorganization, in uIP IP level code unusual simplification.

    (3) between net text controlling agreement ICMP

    In uIP, one type’s ICMP information is only realized: ICMP ECHO mainly uses in application procedure ping, the inspection network whether to connect. In uIP, ICMP ECHO usually carries on processing by one very simple way; Changes “REPLY” the ICMP type by “ECHO”, simultaneously adjusts the ICMP verification, the exchange transmitting end and the receiving end IP address.

    (4) transmits controlling agreement TCP

    In order to reduce to the memory use, in uIP, TCP does not use the sliding window to receive and the transmission data, arrives the TCP text does not carry on the cushion, but immediately gives the application program processing. But the application procedure itself may to transmit the procedure itself may to the data which must transmit carry on the cushion, because each time connects usually has certain TCP text to transmit. uIP network service modular structure as shown in Figure 4.

    The network service needs to want the first floor RTL8019AS driver the support, refers to RTL8019AS and the S1C33209 material explanation documents, the compilation removes the acupuncture needle regarding the systematic RTL8019AS actuation.

    the uIP buffer does not arrive data packet, when in the network has the data packet (in here pointed out specially when too frame) arrives at the network card, the network card driver will temporarily store in the network card buffer data packet, transmits by the DMA form to the goal board on RAM. By now will have section of codes to arrive in goal board RAM the data packet to duplicate in overall situation array uip_buf[], the uIP agreement stack procedure carried on the operation afterward to the uip_buf[] data.

    when the upper formation application procedure or the agreement stack procedure has produced the data packet which transmits to the network, also puts in the data packet uip_buf[]. Then the transfer network card driver, reads the uip_buf[] in data in network card’s buffer, afterward transmits to the network.

    In this must explain the agreement stack and between the network card driver, the application procedure synchronized machine-made question. In system initialization, provides system call vcre_tsk() through the operating system to found three duties: A duty (task1), uIP agreement stack; Duty two (task2), electrical appliances monitor routine; Duty three (idle_task), idle duty. But the network card driver as the hardware interrupt, from “examines the network to upload the data packet” the event to stimulate.

    Entire agreement stack program flow diagram as shown in Figure 5.

    A duty priority is highest, the duty two next bests, the duty three priorities are lowest. When the system starts moves, the duty one first enters the RUN condition, in the one joins system call wai_flg() in the duty, because does not have the network to request, the duty one enters the WAIT condition afterward. This time the duty binary enters the RUN condition. When in the network has the data packet to arrive, the network card driver starts as the hardware interrupt to carry out. Before withdrawal interrupt, through system call set_flg(), a duty expectation flag bit setting. After interrupt returns, because a duty wait condition already satisfied, a duty priority is higher than the duty two, as soon as therefore the duty enters the RUN condition, namely the uIP agreement starts to process the data. If in the network has had the data packet to arrive, then duty one and interrupt routine unceasing cut. When network end of mission, returns assuming the post serves two break points to continue the downward execution.

    As a result of uIP not buffer network data, therefore in a duty execution’s process, namely uip_buf[] is being operated time, will close all interrupts. This may avoid the data diaper destroying, the shortcoming was timely bad some, but satisfied this system request.

    3 operating systems

    This system use’s operating system is ROS33V31 which provides by EPSON Corporation. ROS33 is one kind of embedded real-time operating system which S1C33 series MCU provides, conforms to the uITRON 3.0 standards. Uses ROS33 to be possible rapid, to develop effectively in view of the printer, PDA as well as each kind of control device’s embedded application procedure.

    ROS33 has the following characteristic:

    * supports the uITRON 3.0 standards - - to conform to this standard S level * biggest duty number is 255, uses the priority dispatch mechanism, supports 9 kind of different priorities, provides the signal light, the mailbox, the news cushion and so on many kinds of correspondence mechanisms:

    * the essence first and compact - - smallest may be 1.7K;

    * responds the quick - - quickest dispatch response time for 7.8μS (the CPU basic frequency is 33MHz, similarly hereinafter), biggest interrupt mask time for 4.3μs;

    * higher order language support - - besides assembly language, but also supports based on ANSI the standard C language programming.

    Annotation: μITRON divides into the system function four levels. The R level (essential level) only provides the basic system call which including real-time, multi-duty OS needs; The S level (standard level) provides all standards the system call; E level (expansion level) including additional and expansion system function; C level (CPU dependence level) the system function relies on concrete CPU and the system realizes the way.

    The ROS33 basic essence according to the function division is 6 major parts:

    * the task management - - is responsible for in the system the task status vicissitude;

    * the duty related synchronization management - -/awakens, hangs up/operations and so on Xie Gua through the sleep, between the processing related duty and the duty synchronized relations;

    * the synchronization and the correspondence - - through correspondence mechanisms and so on signal light, event, mailbox, realize between the independent task synchronization and the correspondence;

    * system administration - - to system environment management;

    * clock management - - calendar clock, timer, fixed time duty and so on management;

    * the interrupt management - - opens/closes the interrupt.

    Figure 6 has given the ROS33 essence conceptual model.

    4 Web servers and upper formation application procedure frame

    The WEB server uses the way is called uip_connect, compared to usually the Socket sleeve joint character which uses in the design suits under the embedded system is the WEB server’s frame roughly.

    #include<uip.h>

    void http_listen_init(void) {

    uip_listen(80);

    } //http listen initialization

    void listen_init(void) {

    http_listen_init();

    }

    void application(void) {

    if the if(uip_connected()) // the current connection condition is connected

    switch (uip_conn->lport) {

    case htons(80):

    httpd; if // 80 PORT has the data to arrive, then transfers HTTP to process the HTML document the transmission

    }

    }

        First, the server and the client establishment connection, through intercepts the port again 80, judges whether to have the customer to request to arrive, if will have will transfer application procedure httpd to carry on corresponding processing, otherwise, will continue to intercept. Httpd is uses in processing the HTTP request the application procedure, the concrete design has the description in agreement stack uIP. uip.h is an agreement uIP document.

    Realizes the simple WEB server function on the application software, it mainly constitutes by two modules: First, user debarkation module; Second, electrical appliances monitoring module. The user debarkation module needs to solve user’s validity check, namely the receive user input’s user name and the password, carry on the verification, gathers the principle to enter the family only monitoring page, the non-principle sends out warns the page. The electrical appliances monitoring module in view of various electrical appliances’ hardware situation, collects the information electrical appliances’ condition code, and through homepage form demonstration.

    In two modules, some partial similarity processing, namely carries on the analysis to the input data. After now defining array htmlinputs deposits the analysis information. After synchronizing watches the single input data carries on the analysis, its name value and the value value separately deposits in htmlinput_struct.name and htmlinput_struct.value, is advantageous for the later processing. In variable htmlinputcount depositing form input variable integer. Defines as follows:

    struct htmlinput_struct htmlinputs[100];

    int htmlinputcount=0;

    Eliminates in addition, defining function get_inputs() and translate() carry on processing to the input data.

    Int get_inputs(); // will install separately from the form input’s data to the corresponding name/value data team

    Void translate(char*sourcestr); // explanation codes the URL character

    The concrete program code no longer much states in this.

    Entire upper formation application procedure’s flow chart as shown in Figure 7.

    5 subtotals

    The ethernet as the connection, take the S1C33 series microprocessor as the hardware platform, using software’s simplification embedded TCP/IP, can realize the HTTP service. Certainly under system mature condition, but may also consider the ethernet connection replace for the wireless network interface. This article turned on Internet for the information electrical appliances network to provide one kind not to need extra PC or the gateway equipment’s solution. This kind of low cost, the high performance plan, has, the nimble characteristic reliably, is suitable in the correspondence speed not too, the permission latency is bigger than 1s, and needs to connect Internet the household automation equipment. In addition according to the user may also according to the need, according to the method, construct own network server, may for the ordinary electrical equipment or the system like collective services equipment, the family healthcare equipment, the industrial automation system and so on, entrusts with turns on Internet the ability.

    Share/Save/Bookmark

    Tuesday, October 14th, 2008 at 00:54
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

TOP
Copyright © 51 Research and Design, Electronic Engineers website - Embedded Systems, MCU, DSP, EDA, Test and Measurement, Components, Communications, Power, Microelectronics, Semiconductors
Powered by WordPress | Theme by mg12 | Valid XHTML 1.1 and CSS 3