• Asynchronous serial interface and ethernet server’s connection

     Abstract: Easily provides one kind, the economical method, realizes the serial interface equipment and ethernet’s connection through the TINI platform. Once the device attachment ethernet, can provide TINI the Web service.

        Key word: Ethernet serial interface TINI

    The many electronic installation use serial interface carries on the correspondence with other equipment, including the attemperator, POS machine, the long-distance monitoring meter, the bar code scanner, the bill printer, the radio frequency label transceiver, the blood pressure to take into account other field use the test facility and the new automatic equipment. The majority equipment are carry on with the exterior correspondence through the serial port, cannot the direct connection large-scale computer network, be unable to satisfy the TCP/IP connection and the ethernet correspondence demand. As a result of the cost and the time question, very little have the candidate to choose a partner the system to carry on again equipment’s way. Introduces using this article based on DS80C390 or DS80C400 the micro controller’s TINI platform, may the serial device which isolates connect the ethernet.

    1 TINI and network

    TINI (micro net connection) was Dallas the Semiconductor development one kind of technology platform, the goal is assists the user fast conformity DS80C390/DS80C400 network micro controller’s research and development, TINI to define a chip set, contained an embedded operating system, the conformity passed through the Java movement environment which optimized highly. The Java programmer may from obtains the formidable function which in the general embedded development not sees: The multithreading, does not have with the unit collection, the succession, the virtualization, cross platform ability, the formidable network support, as well as - but is very finally important - the massive free development kit. The TINI use does usually not directly faces the assembly code. However, to optimize the strict request speed the channel or visits the first floor hardware, simultaneously also supported and encourages the local language subroutine (TINI operating system to write with local code, therefore, the serial I/O turnover rate and modern PC did not have obvious difference). Besides supports the java.net package completely, TINI the Java movement environment also contains the javax.com subsystem which realizes completely. May visit TCP/IP and the serial port effortlessly through Java, therefore, the TINI system may use for to realize the serial port - ether bridge very easily.

    In the following example, the TINIm390 confirmation module (lays aside in the E10 slot) is DS80C390 TINI develops the platform the hardware part (TINIm400 is coordinates the DS80C400 manufacture). Except SRAM, Flash, the ethernet, the CAN main line, 1-Wire and so on, the system also has four serial ports, the DS80C390 interior including two UART, other two is the expansion (uses one piece 16550 to choose fitting). What needs to pay attention, on the E10 plug’s two serial couplings have been received both serial0, they are only have a difference in the DTE/DCE pin arrangement. The detailed material please refer to “the TINI Characteristic And Development Guide”, the PDF document may download from http://www.ibutton.com/TINI/book.html.

    2 models

    Following introduced that two concrete applications, and extract the fragment from an ordinary serial port - ethernet procedure to come out. After revises, it may adapt nearly in each kind of application. These models become using the TINIm390/400 confirmation module build, as shown in Figure 1.

    May regard as the TINI confirmation module “the black box”, will be many a serial device to hang receives the ethernet. According to the final equipment’s need, TINI may let the data stream go nonstop to, also by carries on the analysis, the translation or the revision to the data. Although the designers may move these models in the TINIm390/400 development outer covering, but more reasonable procedure its presence in memory, after the power failure, can also be self-starting, and causes the final product using other TINI structure technology to be sturdier. If wants to revise these models, needs to have some basic network knowledge and the programming experience. The type example work code may also Dallas Corporation ftp stand (ftp://dalsemi.com) download.

    (1) hypothesized modem

    The hypothesized modem (Modem) uses TINIm390/400 and the TCP/IP connection, the substitution special modulator and the telephone line. Supposes has an old equipment, for instance some factory “the machine state monitoring device”, it uses a modem, within one day the digit dialing to a central server, reported machine’s condition, the load and the efficiency data several times. In order to reduce the modem storehouse which the server end grows day by day, and connects equipment’s telephone line using the existing LAN substitution, we may rewrite the server software to support TCP/IP, and substitutes for on each machine with the TINI hypothesized modem the original modem. Thus, the machine state monitoring device does not need to make any revision again, speaking of the final equipment, the hypothesized modem’s use and a true modem are completely same.

    Except the above disposition, the hypothesized modem certainly may also form a pair the use. If both sides use the hypothesized modem, does not need to the server software to make any modification, the TINI module may replace the existing modem directly. When this situation, the hypothesized modem each time receives “AID” the modem digit dialing order, what actual establishment is the TCP connection. “ATH” the separation order closes the TCP connection. The software also realizes a series of other classics AT modem order, and so on network system is recognized as by such as Microsoft the Windows really the modem, in addition, the hypothesized modem may also intercept the TCP port, when receives “the call” the signal, sends out “the ringing” to the terminal device.

    The following code fragment had demonstrated how to carry on the initialization to the TINIm390 serial port:

    public static void man (String args[]) {

    TINIOS.setSerialBootMessagesState(false);

    TINIOS.setDebugMessagesState(false);

    TINIOS.setConsoleOutputEnabled(false);

    System.out.println (”Connecting to serial0 at 9600bps,” “listening on TCP port 8001″);

    try {

    CommPortIdentifier portId=CommPortIdentifier.getPortIdentifier (”seria10″);

    SerialPort port=(SerialPort)=(SerialPort)portId.open (”VmodemTINI”, 10000);

    TINIOS.estRTSCTSFlowControlEnable(1, false);

    TINIOS.setRTSCTSFlowControlEnable(0, true);

    TCPSerialVirtualModem modem=new TCPSerial VirtualModem (port,/*Comm speed */9600,/*TCP Port */8001);

    Modem.processIuput();

    }

    catch (Excepiton e) {

    System.out.println (”Exception: e.toString());

    }

    }

    This section of codes first forbid to possess from the TINI OS debugging output - - TINI standard convention. After obtaining a port number, turns on this port (, if port by another application use, how long the second parameter is being indicated waits for), then, establishes the hardware class control state. Because TINIm390 only has a set of RTS/CTS line to use in the serial port 0 and 1, before the goal port uses them, the procedure first should switch off on other port’s class control, is a Java hypothesized modem model.

    The hypothesized modem contains a AT order interpreter (not to show similarly in this, although so far, it is in this model a most major part) and the network code. The following code uses for to establish the serial port bit rate, the data and the stop position, as well as odd and even position. May see, the processing inputting connection is what kind simple:

    /** Creates a new VirtualModem connected to a serial port on

    * one end and a TCP port on the data side.

    * serial –the serial port this VirtualModem talks.

    * speed –the speed the serial port should be set.

    * tcpport –the TCP port this VirtualModem listens on.

    * throws IOException when there’s a problem with the serial or TCP port.*/

    public TCPSerialVirtualModem (SerialPort serial, int speed, int tcpport)

    throws IOException

    {

    super(serial);

    try {

    serial.setSerialPortParams (speed, SerialPort.DATABITS_8,

    SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);

    }

    catch (Unsupported CommOperationException e) {

    throw new IOException();

    }

    serverSock=new ServerSocket(tcpport,1); //backlog of one listenThread=new listenInbound();

    listenThread.start();

    }

    Finally, the listenThrad() fragment may accept an arrival the connection to request:

    public void run() {

    int rc;

    Socket s;

    While (running) {

    s=null; //No incoming connection request

    try {

    answered=false;

    s=serverSock.accept();

    //Discard incoming connection if already connected

    if(connected)

    throw new IOException();

    sock=s; //for answer()

    (2) UPS monitoring device

    The second example is connects TINIm390/400 to a UPS’s serial port. The software must use the network UPS tool agreement, allows many client sides to examine UPS in many kinds of platforms the condition. This project stems from needs not to have serial port new Macintosh by one computer surveillance existing UPS power source’s demand. At present has two kind of basic UPS equipment, namely so-called intelligence and simple (or “mute”). Simple UPS on many serial pins instructed that its active status, it in fact outputs any ASCII data. Because does not have too many serial pins, thus it can only instruct that several groups of limited information, like Table 1 arranges in order.

    Table 1 

    Letter    Number Italy    Righteousness
    RTS (from UPS) The battery is low
    TD (from UPS) Uses the battery
    CTS (goes to UPS) Closes the UPS power source

    Realizes the part to see the network supplement version specifically (http://www.dpj.com.cn).

    3 conclusions

    The existing equipment only supports the asynchronous serial communication, however, the current many applications request the ethernet and TCP/IP network ability. Uses the formidable Java movement environment and based on DS80C390 and DS80C400 the micro controller’s TINI technology, develops a serial port - ethernet switch very easily in the extremely short time.

    Share/Save/Bookmark

    Sunday, October 5th, 2008 at 07:34
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