Development of Control system in electromagnetic acquisition station based on ARM and Linux Qiu Jieting
Chen Rujun
He Zhanxiang,
Qiu Kailin
School of Info-physics and Geomatics Engineering Central South University
Postdoctoral Research Station
Non-seismic Survey
Non-seismic Survey
Changsha, China
[email protected]
BGP,CNPC Zhuozhou, China
[email protected]
Abstract-Due to the operation environment in field exploration, low-power consumption and high reliability is a basic requirement for developing control system of electromagnetic acquisition stations. In this paper, we propose the design of the control system based on AT91RM9200 microprocessor and linux2.6.21 operation system. The hardware design and the OS porting were introduced and the key points in device drivers of UART, SPI, I2C, DS1307 real time clock and serial synchronous controller (SSC) were depicted. Finally, the control system was tested by the acquisition station. Tests show that the control system’s power consumption is low and its other specifications also meet requirements. Keywords-control system; AT91RM9200; Linux; device driver; electromagnetic acquisition station
I.
INTRODUCTION
Electromagnetic acquisition station is an acquisition system used to survey and record the distribution of natural or artificial alternating electromagnetic field in mineral resources exploration domain or other domains. With the promotion of electromagnetic survey in mineral resources exploration and hydrological engineering exploration, etc, electromagnetic acquisition station was getting increasing attention [1]. The control system is the control center in electromagnetic acquisition station. Upon its failure many jobs in the station such as the intercommunication, data acquisition and logging will fail too. So the reliability of the control system is essential. Low power consumption is another essential specification for the station since it will work continuously for dozens of hours in field exploration. So lower power consumption and high reliability is key points in designing and implementing the control system in electromagnetic acquisition station. Currently in the development of control system in EM acquisition station wherever domestic and abroad, employing the X86 series processor and DOS/Windows series OS is main stream [2,3]. The disadvantages of such control system include: (1) high power consumption; (2) poor interactive performance for DOS OS; (3) The high cost of copyright clearance and poor customizability for Windows OS. In consideration of the benefits of ARM processor such as small scale, low power consumption and low cost, of Linux
978-1-4244-2833-5/10/$25.00 ©2010 IEEE
BGP,CNPC Zhuozhou, China
[email protected]
BGP,CNPC Zhuozhou, China
[email protected]
OS such as higher reliability, resource richness, and open source and cost free [4-8], this work implements an embedded control system based on AT91RM9200 microprocessor with embedded Linux OS. This system has plenty of hardware interfaces including SPI, UART, SSC, I2C, USB, Cable & Wireless Network Interface and Large-capacity memory. It fully meets the requirements of EM acquisition station such as low power consumption, high reliability, perfect signal processing and data recording performance. II.
OVERALL DESIGN OF EMBEDDED CONTROL SYSTEM
The block diagram of EM acquisition station is showed in figure 1. It is divided in 4 parts including DSP Acquisition Channel board, GPS system board, Power Board and Control system board. The role of DSP Acquisition Channel board is to convert acquired analog electrical and magnetic signal into digital signal. GPS system board outputs clock, synchronization and navigation signal and ensures all system units work synchronously. Power board provides power supply for the whole system. Control system board acts as the brain of the station. Its main function includes: 1. To control DSP Acquisition Channel board and Power board after receiving Host computer’s control signal and then decoding the signal. 2. To receive the measurement signal from DSP Acquisition board and send the signal to Host computer or save the signal in local memory. 3. To control the power on/off status of all power units in power board. 4. To receive the GPS signal from GPS system board, from which the information such as clock, location and the number of traceable navigation satellites was decoded and extracted.
DSP acquisition SSC UART0
SPI
Power system
ZigBee
Control system
UART2
Ethernet/RS232
UART3
PC
GPS system
Figure 1. Block diagram of EM acquisition Station
III.
HARDWARE DESIGN OF CONTROL SYSTEM
According to the system design requirements, hardware design employs the 32 bit embedded ARM microprocessor AT91RM9200 as the main controller. Other hardware resources including memory, UART interface, cable network interface, ZigBee wireless communication, USB, Temperature sensor, RTC clock, SPI, I2C and SSC interface. Thus a multiple functional embedded control system was constructed. Ethernet Reset circuit ZigBee (UART1) SSC & UART0 SPI
Debug_U & UART3 CPU AT91RM9200
SDRAM MT48LC16 32MB(1)
Buffer1
Buffer2
RTC DS1307
UART2
Temperature LM75
USB
NOR flash S29GL064 8MB
SDRAM MT48LC16 32MB(2) NAND K9K8G08 1GB
B. Memories Memories include SDRAM and Flash memories. In order to fully utilize the 32-bit CPU data processing capability, two pieces of 16 bit SDRAM chip MT48LC16M16A2 are connected in parallel to construct a 32 bit SDRAM memory system. Total SDRAM memory size is 64MB which is adequate for the application. 8MB NOR Flash memory is used to store boot load program, Linux kernel and user applications. 1GB NAND Flash memory is used to store field acquisition data. The buffer 74LVCH1162445 is placed between memories and AT91RM9200 to improve driving capability and isolate noise. C. Peripheral Devices As depicted in figure 2, the embedded ARM system was armed with SSC, SPI, UART0~UART3 and Debug UART, 10M cable network and USB interface. • SSC is designed to communicate with ESSI in DSP acquisition channel board and receives the digital EM signal from the board. •
SPI is designed to communicate with digital filter CS5376A’s SPI interface in DSP Acquisition board, so that signal magnification, Signal Generator and working status of digital filter CS5376A can be controlled.
•
UART0 is designed to communicate with SCI in DSP Acquisition channel board and thus the chip DSP56309 will be controllable. UART1 interface connects to ZigBee wireless network so that the acquisition parameters and status will be monitored in real time and autonomous networking and data transferring among multiple stations will be realized. UART2 communicates with serial port in power board, acquires the battery status information and controls the working status of all power units in power board. UART3 receives navigation information from GPS board. Debug UART is designed to communication with host computer so that embedded Linux OS will be upgraded and maintained.
•
10M cable network interface communicates with host computer, though which the surveyed data will be retrieved and testing information will be exchanged.
•
USB interface is designed to read from and write to USB devices.
•
Reset circuit provides reset function both in booting session and runtime.
•
The only power supply support from outside control board is 5V. The board has built-in 5V-3.3V and 5V1.8V conversion module.
Power +5V 5V 3.3V 5V 1.8V
Figure 2. Functional modules of acquisition station control system
A. Features of the CPU The CPU used in the control system is AT91RM9200 manufactured by ATMEL. It is based on ARM920T which is a high performance and low power consumption 16/32 bit microprocessor with RISC. A substantial number of peripheral resources are integrated in the CPU. It quite fits the industrial control application which has high requirement of rich peripheral resources, low power consumption and high stability. Compared to most of the control systems in EM acquisition stations using X86 as CPU, this control system using AT91RM9200 as the CPU has the advantages such as: 1. Low power consumption. For example, the current in VDDCORE is 30.4mA in normal working mode and only 3.1mA in idle mode. 2. Supporting memory such as SDRAM, static memory, burst flash, compact flash and Nand flash etc. 3. Providing a series of industrial standard peripheral interfaces such as UART, SSC, SPI and I2C. 4. PDC (Peripheral Data Controller) provides DMA for all serial peripherals. So data can be transferred directly between peripherals and on-chip and off-chip memories.
D. PCB design PCB design is critical for high speed ARM system board. In this work we employed the design of six layer PCB board. The first layer is a signal layer, followed by ground layer,
0x10000000
signal layer, power layer, ground layer and signal layer. In power layer there are three power nets. They are 1.8V, 3.3V digital power net and 3.3V analog power net. The 3.3V analog power net provides power for Ethernet transceiver chip, DM9161. In the PCB design the following measures were taken: Some important clock lines and signal lines are isolated with ground. Y-branch structure is used in two SDRAM chip layouts to constraint the length of clock lines and signal lines. IV.
0x10030000
uImage 2MB 0x10230000 Jffs2root 4MB 0x10630000
KEY POINTS IN SYSTEM SOFTWARE DEVELOPMENT
A. Porting of Linux OS Currently the operation systems used in control systems in EM acquisition station include WinCE, Windows95 and DOS etc. Although technically these OSs can fulfill the job, but meanwhile the copyright clearance issues must not be ignored. This work uses Linux-2.6.21 as the OS in control system. It has the advantages such as: 1. open sourced and supports a lot of more open source software resources, 2. favorable development environment and the continuous development of tools, 3. Most questions can obtain solutions through the Technical Forums quickly and free of charge. The porting of Linux OS roughly was divided into six steps. 1. Preparations works, including source code downloading and cross compilation environment setting. 2. Configuration and compilation of U-Boot (boot loading system). 3. Configuration and compilation of Linux kernel. 4. Porting of YAFFS file system supporting 1GB NAND Flash into Linux kernel. 5. Configure Ramdisk to mount the root file system. 6. Writing flash and debugging. If failure happens, return to step 2. Download U-boot cord
Config uboot
Download Linux cord
Download YAFFS cord
Config Linux
Config Ramdisk
cross-platform comiler
load uboot
load Linux Image
0x10800000
load Ramdisk
ARM platform
Figure 3. Flow chart of porting of Linux OS
Jffs2disk 1.8MB
Figure 4. Memory allocation map
The allocation of 8 MB NOR Flash was depicted in figure 4. Boot loader binary files were allocated at 0x10000000~ 0x10030000. It will be executed upon power on and will initialize hardware devices and build memory mapping. Linux OS file was allocated at 0x10030000~0x10230000. The root file system including programs and libraries which is necessary for Linux running was allocated at 0x10230000~ 0x10630000. The remaining 1.8MB space was user space. B. Device driver design Device drivers for UART, SPI, I2C and DS1307 were modified according to system requirements. This work also writes driver programs for SSC interface devices supported by AT91RM9200 since linux2.6.21 doesn’t provide the driver. a) UART device driver In the design all 5 UART serial ports of AT91RM9200 were utilized, which means that 5 serial port drivers need to be registered in Linux-2.6.21(see table 1). By default only RX (receiving signal) and TX (sending signal) is registered in Linux-2.6 kernel. In our design SCK also need to be registered and the CLKO bit in register US_MR under UART mode must be set since UART0 connecting SCI in DSP acquisition board will utilized SCK signal.
Download busybox
Config YAFFS
bootloader 192KB
TABLE I.
UART FUNCTION ALLOCATION
UART Assignment
Device Name in Linux System
Function
Debug UART
/dev/ttyS0
System configuration and software debugging
UART0
/dev/ttyS1
Connecting SCI in DSP acquisition board and providing SCK0 clock
UART1
/dev/ttyS2
Communicating with ZigBee
UART2
/dev/ttyS3
UART3
/dev/ttyS4
Acquiring battery power information from Power Board Acquiring GPS navigation information from GPS synchronization board
b) SPI device driver In the design AT91RM9200 communicates with digital filter CS5376A through SPI interface. Data transferring through SPI of CS5376A happens in Clock falling edge, which is a fixed mode. But data transferring through SPI of AT91RM9200 is programmable. To ensure data is transferred between SPIs, NCPHA in chip selector CSR in AT91RM9200 must be set to 1. The highest frequency of SCK in SPI of CS5376 is 4.096MHz. But this value in SPI of AT91RM9200 is 6MHz. So it needs to be reduced. In this work it was set to 1.024MHz. c) I2C device driver (LM75 temperature sensor driver) LM75 temperature sensor communicates with AT91RM9200 using I2C protocol. So the options of “I2C support” and “I2c device interface” need to be selected in the configuration of Linux2.6 kernel. The current temperature value can be read if the device file “/dev/i2c-0” was open during system running. The major and minor device number of “/dev/i2c-0” is 89 and 0 respectively. d) RTC real time clock driver In our design the build-in RTC driver for chip DS1307 in Linx2.6 kernel was utilized. So the only operation we need is to configure chip DS1307 and get clock from it. e) Serial Synchronous Controller (SSC) Driver[9] SSC is used for the serial synchronous communication between AT91RM9200 and DSP56309. DSP56309 sends frame sync data to AT91RM9200. AT91RM9200 receives the data through SSC. However there is no build-in SSC driver support in Linux2.6.21 kernel. So we write the SSC driver on our own. Insmod SSC
SSC0_open SSC0_init
User program
SSC0_ioctl SSC0_read File_operations Platform_driver
At91_add_device_ssc
SSC0_resource
Rmmod SSC
SSC0_device
SSC0_close SSC0_exit At91_ssc.c
provides file operations including the file operation functions such as open(), read(), ioctl() and close() to user spaces. V.
EXPERIMENTAL RESULTS
A. Control system test First the control system was individually tested. The test process can be depicted as following steps. To log onto the system by telnet. To check disk space using command df. From figure 6 it is clearly shown that 3 NAND blocks were successfully mounted (/dev/mtdblock1-/dev/mtdblcok3). The total capacity is 1GB. Temperature information was retrieved using ./lm75 command. The temperature at the moment was 29.5℃. The over-temperature was 80.0℃. The temperature hysteresis is 75.0℃.
Figure 6. Command line test interface
Date and time information was retrieved using ./test rtcex –r command. The information at the moment was 19:30:19 at Oct 10, 2009 on Saturday. To control chip CS5376A by running ./testspi command. To ensure that acquisition data can be stored normally, this work provides both NAND Flash storage device and USB storage device. To improve the reliability, storage components with better reliability and industrial-grade were used. The hardware of control system is shown in figure.7.
Board-dk.c SSC0_pins At91rm9200_device.c
SSC cotroller
Figure 5. The framework of the SSC driver program
The framework of the SSC driver program is shown in figure 5. It is divided into 3 levels. The bottom level (file At91rm9200_device.c) gets the SSC device bus address and IRQ number and enables SSC pins. The interlayer (file boarddk.c) registers SSC device during system booting so that the upper level program (file At91_ssc.c) can obtain access to SSC hardware. The upper level implements the initialization of the SSC device and DMA controller, the registration and cancellation of the device number and IRQ number, as well as
Figure 7. Control system
B. System integration test All PCB boards including ARM system board, DSP acquisition channel board, GPS board and power board were integrated and tested (see figure 8). In the test sine waves were fed to three instead of four channel inputs. The other channel was short to ground. Thus interchannel crosstalk could be observed in case it takes place. Chip CS5376 was given the instruction of working in 2400Hz sampling rate by control system through SPI interface. And then AT91RM9200 received the digital acquisition signal from DSP board through SSC and the data was saved in a flash disk with 8 Giga bytes capacity which was analyzed later. The acquisition process lasted for 58 hours, which is much longer than normal field electromagnetic acquisition procedure. During acquisition all functions in control system were working normally, which includes ambient temperature monitoring, battery power monitoring and extracting GPS navigation information such as lock status, time, date, latitude, longitude, altitude and number of navigation satellites(see figure 9), etc. And interchannel crosstalk never took place during acquisition process. Furthermore the reliability of the OS booting was tested by repeating power down and restart procedure for 150 times. Linux worked still fine under the test.
listed in table 2. Startup power was measured upon Linux system boot up. Running power was measured when acquisition process was running, during which the digital acquisition data from DSP board was received and saved and the information such as GPS status, ambient temperature and battery power was collected. Standby power was measured when Linux system has booted and there was no running acquisition and monitoring process in the system. TABLE II.
POWER CONSUMPTION TABLE
Platform
Startup power consumption
Running power consumption
Standby power consumption
Control system
1.575W
1.34W
1.02W
VI.
CONCLUSION
In this work the control system was designed based on AT91RM9200 and Linux OS. It complements the station’s measurement system perfectly. The hardware design based on ARM9 processor has high scalability and low power consumption. The software design based on Embedded Linux OS has high reliability and great flexibility. The combination of AT91RM9200 and Linux OS has overcome many deficiencies of the traditional combination of X86 processor and DOS/Windows OS and reduced the cost of the instrument. Currently the control system was integrated into the whole acquisition station and the test shows that the function, power consumption and reliability meet the design requirements. REFERENCES [1]
[2] Figure 8. Testing of the integration system
[3] [4] [5]
[6] [7]
[8] [9] Figure 9. Acquiring GPS navigation information from UART3
The startup power, running power and standby power consumption of the control system board was measured and
Esben AuKen, Lousie Pellerin, Niels B. Christensen, and Kurt Sorensen, “A survey of current trends in near-surface electrical and electromagnetic methods,” in Geophysics, vol. 71, NO. 5, pp. 249-260, Setpember 2006. Phoenix Geophysics. The MTU Receiver: Satellite synchronized data acquisition units . Canada: Toronto. 2008. pp. 1-2. Zonge Engineering. Geophysical Data Processing Receivers: GDP-32II multi-function receiver. USA: Arizona. 2007. pp. 1-2. Goodacre, J, and Sloss, A.N. “Parallelism and the ARM Instruction Set Architecture,” in Computer, vol. 38, NO. 7, pp. 42 – 50, July 2005. Zhang X, and Song L M. “Implementation of Video Data Transmission Between ARM and DSP Through Embedded Linux,” in Embedded Software and Systems Symposia, 2008. ICESS Symposia '08. International Conference, China: Sichuan, July 2008, pp. 292 – 295. Zhang D F, Guo Y, Wang Y, and Chen X Q. “Toward Efficient Aspect Mining for Linux,” in Software Engineering Conference. Japan: Aichi, Dec. 2007, pp. 191 – 198. San-Pil Moon, Joo-Won Kim, Kuk-Ho Bae, Jae-Cheon Lee, and DaeWha Seo. “Embedded Linux implementation on a commercial digital TV system,” IEEE Transl. J. Consumer electronics, vol. 49, pp. 14021407, Nov. 2003. Thakur S, and Conrad J M. “An embedded linux based navigation system for an autonomous underwater vehicle,” IEEE proceedings. SoutheastCon, USA: Richmond VA, March 2007, pp. 237-242. Qiu J T, Chen R J, He Z X and Qiu K L. “Development and applicaltion of serial synchronous communication driver in Linux2.6”, in Journal of computer applications (In Chinese), Vol. 30 No. 3, pp. 850-853. March 2010