Design of remote data monitoring & recording system based on arm

1,449 views
1,391 views

Published on

For more projects visit @ www.nanocdac.com

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,449
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Design of remote data monitoring & recording system based on arm

  1. 1. 2010 2nd International Conference on Industrial and Information SystemsDesign of remote data monitoring and recording system Based on ARMBoQuSchool of Electronic &Information EngineeringSoochow UniversitySuzhou, Chinaqubo@suda.edu.cnAbstract- The system of remote data monitoring andrecording is designed based on the core processors ofLM3S8962 in the paper. A small HTTP SERVER is builtin LM3S8962,it connected with the remote monitoringterminal via Ethernet.The data can be recorded in the SDCard through SPI interface. At the same time, for the sakeof the versatility, the FAT file system is built in the SD Card.So, a Ethernet-enabled remote data monitoring system withthe ability of data recording is built. This design has theadvantage of cost-effective, easily realized, stable andreliable transmission and so on.Keywords:remote data monitor;FreeRTOS; FatFS;ARM;TCP/IP protocol StackI. INTRODUCTIONCurrent years, along with the rapid development oftechnologies, more and more electronic products affect ourlife either directly or indirectly, and permeates to variousindustries. With the increase of these electronic products,new problems about data transmission and equipmentmanagement arise. In the process of environment remotemonitoring, the spot collecting areas are sporadic, thecommunicating conditions are weak, the data obtainingand auto-collecting are difficult, so more effectivemonitoring and higer level equipment management arenecessary.This paper proposes the solution for above remoteapplication issues: the monitoring and recording terminalis designed and connected to the PC through Ethernet. Atthe same time, we can connect multiple monitoringterminals to the Ethernet, because the Ethernet is a kind ofstandard open network based on TCP / IP and it has thecharacters of commonality, easily networking, remote datatransmitting, using the protocol of CSMA /CD!l]. Figure 1shows that PC can monitor at real time and manageunitively the sporadic data collecting spot simultaneously.Moreover, these terminals are equipped with good abilityof individual data recording.monitor WEB hostEthernetMonitor and record the terminalFigure 1. network topological graph978-1-4244-8217-7/10/$26.00 ©201O IEEE252Daowei FanSchool of Electronic &Information EngineeringSoochow UniversitySuzhou, Chinadaoweofan@126.comII. HARoWARE PLATFORMThe microcontroller designed in this paper using theLM3S8962 chip which is microprocessor with 32-bitCortex-M3 nuclear being equipped with real timeemulating and tracking. Integration the CAN and 10 1100Ethernet controller ,256KB high speed flash memory, 4commonly timer and 2 industrial standard UART port isappropriate to used on the project of low cost and lowpower consumption but higher performancerequirement!2].The platform using LM3S8962 as the core processor isas below the figure 2 which contains analog quantity input:to transform the analog signal by AD converter carried onLM3S8962; digital quantity input: to deliver toLM3S8962 directly; the realization of the Ethernetcommunicating: to form the Ethernet communicatingterminal by using Ethernet MAC and PRY carried onLM3S8962; the realization of data memory: to form theSDCard read-write circuit. The serial port is used to adjustthe system.Ethernet interfaceRJ45 interfaceSPI BusSD Card InterfaceFigure 2. systematic hardware diagramIII. FREERTOS TRANSPLANTA FreeRTOS operation system functionFreeRTOS as the open-source light weight real-timeoperating system, achieves the management on thereal-time dispatching, semaphore, aligment and storageand relieves from the authorization fees.To adopt theembedded real-time operating system (RTOS) can achievethe aim of multitask, which can take use of the CPUresource more reasonable and more effective. At the sametime, it can simplify the design of the utility software andshorten the time of system exploit, which will ensure thereal-time and reliability.The realization of FreeRTOS is constituted bydocuments of list.c, queue.c, croutine.c and tasks.c.Figure 3 shows: list.c is the realization of the linked listsupporting the dispatcher of the internal core; queue.c isthe realization of the alignment, supporting thelIS 2010
  2. 2. discontinued environment and semaphore control;croutine.c and task.c are the realization of the organizationform of the task. As to croutine, all the task share onestorage place, which reduce the demand of RAM and limitstrictly on its application. Task is the traditional realization,all the task apply their own storage place, supporting thePreemptive dispatching.Top-lev el applicationIitFreeRTOS promeFreeRTOSC oniJg.ltFreeRTOS Core PromeLisLe list.ltTasks.c task.kQueue.c q ueue.kCroutine.e eroutine.ltHeap_x.e sempkr.kFreeRTOS Portab Ie Pro iIlePort.c portasm. s portmacro.hFigure 3. FreeRTOS structure of hierarchical graphB The transplant of FreeRTOSSam e with uC/osn13], the transplant of the FreeRTOSis realized by 3 files: one .h to identify the relevant datatype of compiler and interruption processing macrodefmition; one .c file to realize the storehouse initializationof the task, the management of systematic heartbeat andthe request of the task change; one .s file to realize thespecific task change.I) PORTMACRo.H macro definition:It is based on the configuration of the processor andmainly contains:a) all the relevant data type of the definitioncompiler.b) relevant definition of framework , thestorehouse increasing direction of Cortex-M3 is fromhigh address to low address, the heartbeat times, bytevisiting SRAM are aligning.c) to define 2function that the user dispatch theinternal core initiatively. They are: force the context tochange, use in the task environment dispatch#define portYIELDO vPortYieldFromISRO,force the context to change , use in the taskenvironment dispatch#defmeportEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) vPortYieldFromISRO;d.) to define the managing function in criticalarea.Interruption allowed and closed:#defme portDISABLE_INTERRUPTSO253vPortSetInterruptMaskO#defme portENABLE_INTERRUPTSOvPortClearInterruptMaskOcritical area enter and exit:#define portENTER_CRlTICALOvPortEnterCriticalO#define portEXIT_CRlTICALOvPortExitCriticalOInterruption allowed and closed used in interruptionenvironment:#defme portSET_INTERRUPT_MASK]ROM_ISROvPortSetInterruptMaskO#defmeportCLEAR_INTERRUPT_MASK]ROM_ISR(x)vPortClearInterruptMaskO;(void)x0If) PORT.C C port:a) storehouse initializationportSTACK_TYPE *pxPortlnitialiseStack(portSTACK_TYPE *pxTopOfStack,pdTASK_CODE pxCode, void *pvParameters)b) start task dispatchingportBASE_TYPE xPortStartScheduler( void)c) release use of MCV initiativelyvoid vPortYieldFromISR( void)d) When entering into the critical area, closed theinterruption first: when exit from all critical area, makethe interruption work.void vPortEnterCritical( void)void vPortExitCritical( void)e) function of heartbeat clock processervoid xPortSysTickHandler( void)III) PORTASMS assembly processing:a) request to change the task: xPortPendSVHandler:used to save the text in its task control areab) the realization of interruption allowed and close, toshield the relevant interrupt source of the priority levelthrough BASEPRI:vPortSetInterruptMask:c) to change the task directly, used on the initializethe storehouse and register of vPortStartFirstTask at thefirst time start.vPortSVCHandler;d) to start the assembly realization fo the first task.vPortStartFirstTaskAll the 3 files realize the bottom port needed on theinternal core dispatching of FreeRTOS, the relevant codeare very consice.IV. UIPPROTOCOL STACK TRANSPLANTA uIP protocol stack introductionuIP is exploited by Adam Dunkels who come fromcomputer science department of Sweden(networkembedded system team). It is TCPIIP protocol stackdesigned especially for embedded microcontroller, it hasgood interoperability and abide by RFC standard. uIPprovides the protocol that is integrant for network
  3. 3. communicating. The code of itself and the memory inusage are very little, at the same time, uIP is an opensource software written completely by C language, its fileand source code can be used in commercial andnon-commercial field. Main characters of uIP are asbelow: ..to support ARP, SLIP, IP, UDP, ICMP(ping)and TCP protocol TCP and protocol IP following RFCstandard, including flow control, segment division andretransmission overtime estinate..to provide exampleprocedure: web server, web terminal, SMTP ternimal,Telnet server, DNS hostname analysis procedure and soon. HttpServer is extended on routine. The systemstructure of UIP is as figure 4.Application(HTTP,FTP)Network device driver(Ethernet)Figure 4. system structure of UIPB UIP transplantWe can see from above the figure: the transplantlocation of UIP is mainly at the port Of driver and the portof application of uIP.There are 2 functions in the internal core of uIP thatneed the help of substrate equipment driver[41. One isuip_inputOo When a data package is picked up by theequipment driver on the network laye, the function need tobe transferred. The equipment driver should put the datapackage into uip_buf[] , package length should beuip_len, then uip_inputO will process0 When return tothe function, if uip_Ien is not 0, it means there are out ofband data (eg:SYN, ACK )need to be transferred. Whenthe support of ARP is needed, ARP list should be updatedor send request and response. The other function need thesupport of driver is uip-periodic(conn). This function isused for the internal core timing robin of uIP, so a timingprocedure supported by hardware is needed to do thetiming robin. It is generally used for check whether thereare data need to be transfer from the PC, if there are, theIP package should be structured.In order to connect the users application to uIP, themacro UIP_APPCALLO should be defined the functionname of the real application procedure. Thus, when acertain uIP event occurs, the internal core will use thisfunction to process. If the procedure status is needed, themacro UIP APPSTATE SIZE should be defined to the- -length of the application procedure status structure. In thefunction of application procedure, the method of testingfunction depending on uIP to determine the way ofprocessing can be divided into different sorts by judgingthe No. of connecting port.254V. WEB SERVER REALIZATIONUsers can visit remote terminals through browser andrealize remote monitoring by building small Web Server.This Web server open the monitor of 80 port, oncethe user request to be connected, uIP will distrbute aconnection item, then when receiving the "GET HTTP. . ."request from user IE browser [51, the data collected willbe filled into network module and generate a newwebpage for user. The size of this webpage is larger thanthe MSS of uIP, so the first time only MSS byte are sentout, the rest byte will be sent out when next turning robincomes. New press-button control are added to control thecopyright, once the user click the button, the browserwill sent the CGI request automatically, the WEB Serverwill sent this information to the newest webpage. If uIPcan test this mark when it receiving ACK, it will test thismark automatically and generate a new webpage and sentit to user. Once the browser is closed by the user, uIP willdetect this issue.( the application procedure can useuip_closedO to detect), and release connect item.The following code should be added into the webpagewhen he webpage needed to be renovated:<bodyonLoad="window.setTimeout(&quot;location.href=dusk.shtml&quot;,2000)">.VI. FAT DOCUMENT SYSTEM TRANSPLANTA Fat document system introductionThe media need to be stored is the system want torecord data. SDCard with its easy -to-be-carried characteris chosen in this design. But document system should bebuilt to realize the independence reading and writing onSDCard. The data will be stored according to the FATdocument system format.This FAT document system which is free of charge onopen source is especially used on embedded systemexploit. It is written by standard ANSI C and separatedfrom storage medium driver. The feature is that it iscompatible with the FAT document system of Windowsand has the individual hardware platform and easy to betransplanted. System structure is shown as figure 5:IAppli"tio"IFatFs moduleLow level disk 1/0 fRTCllSD. ATA. USB. NANDI �. . ..�B�Figure 5. Fat document system structureB Fat document system transplantFatFs system is formed by 8 documents: diskio.c anddiskio.h are hardware layer; ff.c and ff.h are FatFs
  4. 4. document system layer and document system SPI layer;integer.h is the defmition of data type used by documentsystem; ffconfig.h the is the configuration files for thewhole system. The document system structure is shown asfigure 6. We can see from the figure the amendment onthe configuration files and the written of SD card driver inthe prcess of FatFs transplant.Applications-=] r=--FatFs File SystemFatFs Profileffconfig.h integer.hFatFs Implementationff.c ff.hdiskio.c diskio.h-=] r=--SD card driver filespi_card.c spi_card.hFigure 6. document system structureThe amendment on configuration files: the first is thedata type, which can be defined in integer.h. the second isconfiguration. Open the ff.h , _MCV_ENDIAN andchoose your CPV (big ending or little endding) ,generally, little ending is used. 1 is little ending while 2 isbit endingo Here, the FatFs can be cut out according tothe configuration of hardware.The realization of driver function contains: I ,disk_initialize, initialized hardware storing equipment. 2disk_status, return to the status of the equipment. 3,diskJead, read the sectors. 4, disk_write, write thesectors. 5, disk_ioctl, need to response to CTRL_SYNC,GET SECTOR COUNT, GET BLOCK SIZE, if it is- - - -right, it will return to 0 which is RES_OK, if it iswrong, it will return to RES_ERROR. The function ofdisk_ioctl is only used when initialized, turn it to 0 wll beok when adjusting read and write. 6, getjattime - obtainthe system time.The operation of SPI on SDcard is inSPI SD driver.clh, while operation of the transplantfile diskio.c of FATFS on the disk will use the function atthe buttom.FATFS document system has high transportability.According to the test, the read speed is 300K/s and thewrite speed is more than IOOk/s, based on the STM3218MSPI clock. That is to say, it basically fulfill theembedded application and the speed request on read andwrite.VII. ApPLICATION EXAMPLEThis design has been used on the remote temperaturecontrol and record in a energy saving company. Thetemperature signal is collected and measured by AD590and enlarged and done the filtering processing. The signalis transformed by using the AD converter carried byLM3S8962.The workers can open the webpage browser atany time to look over the temperature. At the sam e time,the SD Card is recording the data all the time for data255back-up. The equipment has the advantage of installedeasily and data transforming& recording reliably.REFERENCES[1] Fred Halsall, Data communication, Computer Networks and OpenSystems [M].beijing: Machinery Industry Press, 2004, pp.572·580[2] ZLG, etc., Cortex·M3 Development Guide · Based on LM3S8000[M], Guangdong: Guangdong Zhiyuan Limited ,2008:87·347[3] Labrosse J ean lJlCIOS·I I-Open source real·time embeddedoperating system [M].beijing : China Electric Power Press ,200I.pp.l25·132[4] The uIP Embedded TCP/IP Stack The uIP 1.0 Reference Manual[Z]. Adam Dunkels, Swedish Institute of Computer Science, 2006:34·37[5] Xin·Feng Xiao, Song Qiang, Wang Lixin, etc.. Protocols andnetwork management standard tutorial [M]. Beijing: TsinghuaUniversity Press ,2007:150·161

×