Issuu on Google+

ISSN: 2250–3676

RASMITHA.KOTHAPALLI* et al. [IJESAT] INTERNATIONAL JOURNAL OF ENGINEERING SCIENCE & ADVANCED TECHNOLOGY

Volume - 2, Special Issue - 1, 10 – 14

AN INNOVATIVE COST EFFECTIVE ETHERNET GATE WAY BASED ON EMBEDDED SERIAL DEVICE Rasmitha.Kothapalli1, Suman.M 2 1

Research Scholar, Dept. of E.C.M, K.L. University, A.P, India,rasmitha.kothapalli@gmail.com 2 Associate Professor, Dept. of E.C.M, K.L. University, suman.maloji@ gmail.com

Abstract This work describes the development An Innovative cost effective Ethernet gate way based on embedded serial device a new type of gateway for data inverting from serial ports to Ethernet based on embedded system According to the complex demand of communication between computer and variety of components which are monitored by data links,. In the hardware design ARM7 microprocessor, LPC2368, from NXP is used. In this paper, hardware and software design of gateway are designed, a way employ Real-Time library to achieve Ethernet communication is depicted and data flow is analyzed last. This method not only resolves practical project but also provides a low-cost resolution for traditional serial devices connecting Internet through a standard TCP/IP protocol. A novel concept of Gateway sends frame format data of the serial ports into the computer before upload, at the same time, control commands of the computer monitor through the gateway of the Ethernet frame format will be converted into serial frames format, and then sent to each serial device. In which Ethernet uses standard Ethernet protocol, RS232 serial communications mode. Gateway processor is LPC2368, there is need for serial expansion because of the inadequate serial ports of the chip. LPC2368 core is ARM7TDMI-S processor, can work with 72MHz operation frequency, on-chip Flash program memory; Static RAM; external memory controller support such as Flash and SRAM static devices, LPC2368 includes a 10/100 Ethernet MAC, USB2.0 full speed interface, four UART, two CAN channels, an SPI interface, two synchronous serial ports (SSP), including the 8-bit data bus and 16-bit address bus.

Index Terms: ARM processor; interface; Ethernet; SPI --------------------------------------------------------------------- *** -----------------------------------------------------------------------1. INTRODUCTION The design objective is to build new type of gateway for data inverting from serial ports to Ethernet based on embedded system. The goal of a low-cost, easy to use, and scalable solution for Serial devices. Both RS232 and Ethernet are world widely used in various fields. Especially, the Ethernet is incredibly spreading out to our life now. And recently the needs of linking between the RS232 interface and Ethernet is increasing so that the RS232 devices can be controlled by Ethernet. Also it can creates lots of new application which using both RS232 and Ethernet interface. But the Ethernet interface is quite different from RS232 interface, so it is not easy to convert between serial ports to Ethernet. If we design a new system to link both interfaces, the cost and complexity will be increased. But using „Serial port to Ethernet converter‟, it is low cost and fast without changing system. So I decide to implement a „Serial port to Ethernet converter‟

RS-232 has been used as the connector for DTE ((Data Terminal Equipment) and DCE (Data Circuit terminating Equipment) in the telecommunication field for a long time. Since PC came out RS-232 has been the standard for serial communication. Serial communication is being widely used even until now. Since the wide spread of internet now, TCP/IP has been the most used internet protocol. Due to the recent growing internet environment, the need of communication between internet and other communication devices with an interface has increased. It is the same case with internet and serial communication devices. If Ethernet and RS-232 is connected, serial devices can be controlled through the internet, and use the internet service. Also, data collected from various serial sensors can be received via the internet.

IJESAT | Jan-Feb 2012 Available online @ http://www.ijesat.org

10


ISSN: 2250–3676

RASMITHA.KOTHAPALLI* et al. [IJESAT] INTERNATIONAL JOURNAL OF ENGINEERING SCIENCE & ADVANCED TECHNOLOGY

Volume - 2, Special Issue - 1, 10 – 14

Figure 2: Conceptual diagram of sensor network. Figure 1 Implementation Diagram Several asynchronous serial interfaces, including RS-232, RS422 and RS-485 are currently in use to connect various types of devices, such as sensors, card readers, and meters. Here the concentration is on products and applications that require access to RS-232 interface devices via an Ethernet connection, since these three serial interfaces are the most widely used in industry. TCP connection with out serial-to Ethernet converter solution has a data acquisition server to be responsible for controlling the serial device. Other database servers or remote displays can query the data acquisition server or the database to share the serial data. If the data acquisition server crashes, the whole system fails as well. TCP connection with serial to Ethernet converter can use a serial device connected to Ethernet to support up to “n” transparent tunnels on the Ethernet to receive the same serial data. All of these “n” hosts can both receive from and send data to the serial device. This function is also helpful for remote displays or monitoring applications

The characteristics of sensor networks operate in ATM or cable networks and the sensor network gateway exists between sensor network devices and existed networks. The gateway handles a various information obtained from sensor network. Figure 2.1 shows that the system structure of the gateway communicates with the host computer using the web or CDMA. The gateway of implementing in this paper are composed of ARM7 core of RISC families, a processor compatible with communication hub or router, 4 Mbyte(x2) flash ROM, 16 Mbyte(x2) SDRAM, 10/lOO based Ethernet and two's serial port with sensor nodes and CDMA module. Also, The one supports 4 UART serial interface and wireless Zigbee. The main processor operates in 50 MHz, the ernet transceiver operates in 25 MHz. Two system is connected with DMA(data memory access), use DMA interrupts and detects physically 10 Mbps or 100 Mbps. UART#1 is connected to the sensor network devices with 900 MHz and UART#2 is connected to the sensor network devices with 2.4 GHz. OS use a Embedded Linux.

2. IMPLEMENTATION OF GATEWAY In general, most of electric home appliances have a sensor network device and a sensor network gateway to control the digital electric appliances through it. Such a sensor network device transmits the integrated status data to the gateway. Figure 2 shows the structure of sensor network concept

Figure 2.1 Diagram of the gateway

IJESAT | Jan-Feb 2012 Available online @ http://www.ijesat.org

11


ISSN: 2250–3676

RASMITHA.KOTHAPALLI* et al. [IJESAT] INTERNATIONAL JOURNAL OF ENGINEERING SCIENCE & ADVANCED TECHNOLOGY

Volume - 2, Special Issue - 1, 10 – 14

3. COMMUNICATION MODULE DESIGN

3.2 Ethernet Interface:

3.1 SPI Interface:

In the Ethernet interface module, Ethernet controller is divided into two layers according to its functions and it is shown in Fig. 3.2 One is media access controller (MAC) layer and the other is network physical (PHY) layer. They correspond to Layer 2 and Layer 1 in ISO model. MAC layer provides the treatment on data sending and receiving. It also provides an interface to PHY through an internal medium independent interface.

SPI interface is used to realize synchronous serial data transmission between CPU and low-speed peripheral devices by way of full-duplex communication. Its data transfer rate is up to several Mbps. SPI interface works in master-slave mode and it includes four signals: SCLK, MOSI, MISO, and / SS. SCLK is the common clock in the entire SPI bus, MOSI is the master output, slave input, MISO is the host input, slave output and / SS is used to mark slave. In two devices which communicate with each other via SPI bus, the slave is low level and host is high level in / SS pin. In the design, because the front-end RF transceiver module nRF24E1 can only be used as host in SPI communication, the microcontroller LPC2368 is used as a slave and the mode of a single master and multi-slave are adopted, which is shown in Fig. 3

Figure 3.2: Ethernet controller and Ethernet interface In this design, Lpc2368 supports Ethernet interface and network transformer HR601680 which is connected between Microcontroller Lpc2368 and connector RJ45 is used to improve the signal anti-interference capability. HR601680 is a 1:1 transformer with a smaller package and it supports 10M/100M Ethernet. Figure 3: SPI Bus Interface

4. SOFTWARE DESIGN The interface circuit of LPC 2368 and nRF24E1 is shown in Fig. 3.1 Through the SPI interface, the maximum rate achieves 2Mbps which meets the majority of applications. As nRF24E1 reads input data at rising edge of SCLK and reads output data at falling edge of SCLK, the 00 pattern of LPC2368 is selected. So the data outputted from nRF24E1 is inputted into LPC2368 after half a clock cycle in the contion of synchronization status.

Figure 3.1 SPI interface circuit between LPC2368 and nRF24E1

4.1. μC/OS-П Transplanting For the transplanting of OS μC / OS-П, its main task is to rewrite the codes which are associated with the processor and compiler. The codes include the following: re-definition of compiler-related data type, interrupt-switching code, stack growth direction, the initialization function for task stack, task-switching function and so on. The transplanting is completed in the following environments: the compiler tool is IAR FOR ARM and EasyARM8962 development board is used as target board. In order to transplant μC / OS-П into the ARM processor LM3S8962, three ARM architecture-related documents: OS_CPU.H,OS_CPU_A.ASM and OS_CPU_C.C are modified. 1) Configuration of the file OS_CPU_A.ASM: The constants, macros and data types which are required by μC / OS-П are re-defined. The ARM processor-related contents are modified. For example, the stack of ARM Cortex-M3 is configured from high addresses to low addresses in the growth direction.

IJESAT | Jan-Feb 2012 Available online @ http://www.ijesat.org

12


ISSN: 2250–3676

RASMITHA.KOTHAPALLI* et al. [IJESAT] INTERNATIONAL JOURNAL OF ENGINEERING SCIENCE & ADVANCED TECHNOLOGY

Volume - 2, Special Issue - 1, 10 – 14

2) Configuration of the file OS_CPU_A.ASM: Five simple functions are programmed by assembly language in the transplanting process. OS_ENTER _CRITICAL( ) is to close the interrupt source. OS_EXIT_CRITICAL( ) is to re-open the interrupt source. OSStartHighRdy( ) is to run the current highest priority task. OSIntCtxSw( ) is used to switch interrupt task and it will be called in process of exiting the interrupt service function OSIntExit( ). OSCtxSw( ) will be called if a task wants to give up the use right of CPU. 3) Configuration of the file OS_CPU_C.C: In the functions defined by OS_CPU_C.C, OSTaskStkInit( ) is associated with CPU and it needs to be modified in μC / OS-П transplanting. It is called to initialize the stack in the task initialization phase. After the work above, three files: Startup.S, Target.C, Target.H in Target directory need to be programmed according to the actual situation in target board. And then μC / OS-П can be run on the microcontroller Lpc2368. Figure 4: System tasks for transmitting data

4.2. Data Transmission In order to transmit the data from SPI serial to Ethernet, two system tasks are established in OS μC / OS-П. One is to receive front-end data through SPI interface and the other is to transmit data to Ethernet. 1) SPI receiving task: For the case that the data are transmit to Ethernet, the data which have been arrived at SPI port are stored into SPI sending buffer and packaged according to TCP/IP protocol and then are added IP and UDP message head on the condition that the PC with SPI interface is set to SPI slave mode and the SPI interface is enabled. At last, the converted data are sent to the host through the corresponding UDP port. This process is shown in Fig.4 2) Ethernet receiving task: In the Ethernet task, in order to receive the data from Ethernet in the system, the local IP address and subnet mask must be set firstly, and the appropriate UDP port is opened to monitor whether there are data in UDP port. As UDP packet, the data which have been reached the UDP port, are analyzed according to TCP/IP protocol and then stored into SPI receiving buffer. At last, the analyzed data are sent to the SPI serial device through SPI interface driver. In the process above, an infinite loop is used and the process is shown in Fig.4.

5. SYSTEM TESTING After the software and hardware designs have been completed, the ultimate generated codes are compiled and downloaded to the target system for testing. The codes include hardware system startup code, μC / OS-П kernel, TCP/IP protocol stack , SPI port driver and part of the application. In the testing, PC is used as SPI port device which is connected with nRF24E1 and the host respectively. The crossover cable is used to connect the host and RJ45 ingarget system. IP address and subnet mask are set in both computers to ensure that the communication between them is in the same network. When the IP address of host is inputted by ping command, the results show that the Ethernet is connected betwen the computer and ARM Cortex. When TCP & UDP test software and UDP communication program are run in the host, the test results also show that the communications from both sides are successful

6. CONCLUSION Serial to Ethernet is the natural next step, allowing simple, cost effective systems integration into existing infrastructure. By centralizing monitoring of these systems, it enables business decisions to be made more efficiently and ultimately reducing complexity and cost. Through the analysis of the results of the Project, we will extend the parallel data of ARM7 embedded processor to serial, multi-serial to Ethernet conversion. The communication between the monitoring computer and the number of serial Equipments is made very simple. CPU efficiency of the monitoring system is ensured With some external hardware implementation other serial

IJESAT | Jan-Feb 2012 Available online @ http://www.ijesat.org

13


ISSN: 2250–3676

RASMITHA.KOTHAPALLI* et al. [IJESAT] INTERNATIONAL JOURNAL OF ENGINEERING SCIENCE & ADVANCED TECHNOLOGY interfaces RS-422 and RS-485 including RS-232 can be accessed through this design. In future by using Wi-Fi gateway replacing Ethernet gateway then speed and communication area automatically increased.

Volume - 2, Special Issue - 1, 10 – 14

[9] C.Li, l.Xiao, "Embedded Linux Technology and Application Development”, Beijing: Publishing house of electronic industry, 2007.pp.l68-172.

ACKNOWLEDGEMENT We thank to our principal, Prof. K. Raja Shekar Rao, for providing necessary facilities towards carrying out this work. We acknowledge the diligent efforts of our Head of the Department Dr.S.Balaji in assisting us towards implementation of this idea.

REFERENCES [1] CHEN Guo-ju, “Design of a monitoring system based on ARM and Etherne applied to AC motors,” Journal of Nanjing Institute of Technology (Natural Science Edition), Magn. China, vol.7(2), pp.46- 51, Jun. 2009.YU Cheng-bo, LIU Jie, and TAO Hong-yan, “Research on remoto monitor technology of equipment,” Information and Control, Magn. China, vol.31(3), pp.236-240, June 2002.

[2] YU Cheng-bo, LIU Jie, and TAO Hong-yan, “Research on remoto monitor technology of equipment,” Information and Control, Magn. China, vol.31(3), pp.236-240, June 2002. [3] LIU Hong-li, “The Research and Experiment of the Embedded System μC /OS-II on PC,” Journal of Shanghai University of Electric Powe, Magn. China, vol.5(7), pp.275248, June 2009. [4] ZHANG Shi, DONG Jianwei, SHE Lihuang, “Design and development of ECG monitor‟s software system,” Computer Engineering, Magn. China, vo33(9), pp.277-279, May 2007. [5] L.Y.Quan, "Serial Server and its application in industrial Ethernet" Fujian PC, vol. 4, 2008. pp. 84-79. [6] B.Xi,YJ.Fang, "Application of embedding technology in networking of serial-port devices", Electric power automation equipment, 27(8),2007.pp.99-101. [7] Z.D.Wang,P.F.Wang,Q.L.Yao,"Embedded linux Programming and Applications", Publishig house of china electric power,2007.pp.99-103. [8] Z.SXu, Z.C.Zhan, Z.L.Liu, "Embedded Linux applications developing detail solution", Beijing: Publishing house of electronic industry, 2007.pp.213-216.

IJESAT | Jan-Feb 2012 Available online @ http://www.ijesat.org

14


IJESAT_2012_02_SI_01_03