OpenSCADAWiki: Home Page En/Using/LP5xxx ...

Home | Index | Changes | Comments | Users | Registration | Login  Password:  
 
This is an old revision of HomePageEn/Using/LP5xxx from 2011-12-10 12:41:44..

Building OpenSCADA and firmware for ARM-controllers of ICP DAS company (LP-5141)

Name: LP-5xxx
Start: august 2011
Finish: september 2011
Version: 1.0.0
Performers: Roman Savochenko
Description: The project is dedicated to building the OpenSCADA and firmware for ARM controllers of the LP-5xxx and LP-8x{3|4}x series of the ICP DAS company.
Materials: ftp://ftp.oscada.org/OpenSCADA/PLC/LP5xx1


Contents

Introduction

The ICP_DAS company produces the controllers on ARM architecture processors for quite a long time with OS Linux as preinstalled environment, which makes interesting the creation or OpenSCADA build or the new firmware with OpenSCADA.


Until the last moment there were a number of reasons that prevent the creation of an OpenSCADA build for ARM-controllers of the ICP DAS:


At the moment, all of these obstacles have been eliminated. So, thanks to Peter Litkovets we got the LP-5141 controller, and by this time OpenSCADA was largely already adapted to work on ARM-architecture, through processing and stabilization on the handheld computer of Nokia company - N800. Later during the same work with the LP-5141 controller it has been eliminated the last obstacle by updating the original software environment while maintaining the original functionality.


In general, the goal of this project is to develop the mechanisms and the creation of OpenSCADA building for the ARM family of the controllers of "ICP DAS" company, as well as the creation of a firmware for the "ICP DAS" controllers, which will fall into the hands of OpenSCADA developers.

1. PLC LP-5141

PLC (Fig. 1) is designed in the monoblock form-factor that does not include built-in computer-process interface, and the connection of the external one is made through the built in RS-485, for example, in the form of modules I-7000 of the the "ICP DAS" company.



Fig. 1. PLC of the LP-5xxx series.

CPU of the controller has the following specifications:

CPU PXA270 or compatible (32-bit and 520MHz)
SDRAM 128 MB
Flash 64 MB
EEPROM 16 KB
Data storage: 40 years; 1,000,000 delete/write cycles.
Extended Flash memory microSD socket with a 2GB microSD card (can support 16 GB microSDHC card)
64-bit serial number of the equipment Present
Dual Watchdog Timer Present
VGA 800 × 600
Ethernet ports RJ-45 x 2, 10/100 Base-TX Ethernet controller (Auto-negotiation, auto MDI/MDI-X, LED indicator)
USB 1.1 (õīńņ) 1
COM1 (/dev/ttySA0) RS-232 (RxD, TxD and GND); not isolated
COM2 (/dev/ttySA1) RS-485 (D2+,D2-); 2500 VDC; isolated
COM3 (/dev/ttySA3) RS-232 (RxD, TxD and GND); not isolated
Operating temperature -25 ~ +75 °C

2. Software environment based on OpenSCADA.

Software environment, based on the Linux operating system for ARM controllers of ICP DAS usually includes: the Linux kernel 2.6.19, GLibC 2.2.5 and GCC 2.95. To build a third-party software the ICP DAS provides an SDK with the cross-compiler, set of libraries and headers for them (Linux toolchain). As you can see, the version of GCC and are very old, namely it is the 2001 year. OpenSCADA building in this environment is actually impossible. If the using of the GLibC of 2.2.5 version is still possible, the GCC of version 2.95 has the C++ compiler, which crashes during the building of the OpenSCADA code, and the standard C++ library or STL is extremely limited and it requires the significant and senseless adaptation. For this reason, it is necessary to update the original software environment to version for at least 3 of GCC compiler and C++ library.


Because internal flash memory has a relatively small capacity (64 MB), and a full rebuild of the original software environment of the controller - a very laborious process, it was decided to ensure the compatibility of the basic libraries of old and new environments. Namely, the ability to use libraries like fontconfig, i8k from the source environment and the work of the source environment programs with the new libraries.


In the process of selecting a new software environment for the PXA-270 processor of the "ICP DAS" controller several options have been tried because some of them had one or other disadvantages:


Building OpenSCADA with use cross-compiler make next:

# Unpack instruments archive
$ cd /
$ tar --lzma -xvf lincon.tlz
# Initialize build environment
$ . /lincon/linpac_new.sh
# Go to sources tree of OpenSCADA, configuration and build
$ cd /lincon/OpenSCADA
$ ./configure --host=arm-linux --enable-CrossCompile --disable-QTStarter --disable-QTCfg --disable-Vision --disable-MySQL --disable-FireBird --disable-PostgreSQL --disab
le-AMRDevs --disable-BFN --disable-SoundCard
$ make


The resulting environment of the controller with OpenSCADA was formed by replacing the original environment core libraries on the libraries from the "Voipac" set of tools, building of the OpenSCADA and placing the OpenSCADA files to source environment tree.


OpenSCADA was built with disabling of the number of libraries and modules. So, it were build and tested the following modules and functions of OpenSCADA:


For the purpose of convenient distribution and use of the resulting OpenSCADA build for ARM-controllers of "ICP DAS" the parsing of the firmwares format for these controllers and the formation of a new one, including OpenSCADA were completed. The firmware of the "ICP DAS" ARM-controllers is a binary file with a name like "lp5x4x_1.1.bin". Structurally, this file contains the kernel and root file system - JFFS2. You can get their exact location by using the commands in the original environment of the controller, for example, for LP-5141:

$ cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00020000 "Bootloader"
mtd1: 00040000 00020000 "Bootloader Param"
mtd2: 00280000 00080000 "Kernel"
mtd3: 03c80000 00080000 "JFFS2 Filesystem"


From the obtained result of the command you can conclude that the connection point of the image kernel and filesystem is placed at 0x280000 offset of the firmware file, and the size of the erase flash block is 0x80000 (512kB). With this information we can extract the firmware and make changes to the image of its file system:


# Extracting the source images of the kernel and root file system
$ dd if=lp5x4x_1.1.bin of=kernel_orig bs=1K count=2560
$ dd if=lp5x4x_1.1.bin of=jffs2_orig bs=1K skip=2560

# Connecting the the source image of the file system
$ modprobe mtdram total_size=65536 erase_size=512
$ modprobe mtdblock
$ dd if=root_orig.img of=/dev/mtdblock0
$ mount -t jffs2 /dev/mtdblock0 /mnt/tmp
# Copy the changes and OpenSCADA files to the root file system of the controller
# Create a new file system with changes.
$ mkfs.jffs2 --root=/mnt/tmp --pad=$((61952*1024)) --eraseblock=512 --output=root.img
# Build the new firmware image
$ cat kernel_orig.img root.img > lp5x4x_oscada_1.0.bin


Thus we get the new firmware with OpenSCADA in the file lp5x4x_oscada_1.0.bin, which can be downloaded to the controller in the standard way, described in the "ICP DAS" documentation.

3. Remarks

As it turned out that the operations with real numbers are performed by the FPA co-processor instructions (Float Point Acceleration), which is not present in this processor, and calls of the commands themselves are made through an imitation of an exception in the Linux kernel, then the performance of mathematical calculations is extremely low, even compared to the direct "Software FP", "VFP". For example, the calculation of a single operation sin(pi) is about ~200 ms, compared to ~20 ms for N800 with VFP and ~2 ms at x86, detailed in next table. So, this controller shouldn't be considered as the platform for at least any serious calculations! Moreover, the real numbers when working with FPA are stored in a different way - namely, the special big-endian, which requires a transformation in the case of the binary external exchange to the typical little-endian representation, for example for DAQ.OPC_UA.


Device Operation sin(Pi) (in JavaLikeCalc), mcs Operation pow(Pi,2) (in JavaLikeCalc), mcs
ICP DAS LP-5141 (PXA270, FPA) 100 (200) 51 (152)
Segnetics SMH2Gi (ARM926EJ-S, SoftVFP) 23 (44) 12 (31)
Nokia N800 6 (15) 6 (17)
Nokia N900, N950 3 (6) 2 (6)
AMD Athlon X2 3600+ 3 (3) 3 (3)
AMD Turion L625 1.6 3 (4) 3 (4)
Intel Core2 Duo 1.6 2 (2) 2 (3)

A significant difference in computing time on an ARM with a direct call to the mathematical operations and from a virtual machine JavaLikeCalc may be related to unaligned reading from the memory when reading the instructions the virtual machine, with which it makes sense to find out later and maybe somehow compensate.


In the initial configuration the COM1 port (/dev/ttySA0) is used as a console, which is initialized by the kernel command "console=/dev/ttySA0". However, after adjustment this is not necessary and is often desirable to release another one COM-port for other purposes. It is possible to release COM1 from work for a console by reassigning the other device for this role, for example by: $busybox setconsole /dev/tty1. However, this method does not fully release the COM-port and requests are lost, reading by the parallel connection.

4. Conclusion

The result was the building of OpenSCADA for Linux controllers of ARM-architecture of "ICP DAS" company. The building can be loaded directly on any Linux-ARM controller, unpacking it at the root of the original operating system. In this case, however, the duplicates of the old core libraries (/lib/*) will remain, which can be removed after a successful restart.


For family of controllers LP-5x4x the firmware with the building OpenSCADA was created, which can be downloaded in the standard for these controllers way, which is described in the original "ICP DAS" documentation. Firmware for LP-5x4x can possible fit for the LP-5x3x, but it is not checked!


Due to outdated and non-optimal initial building of the Linux environment from "ICP_DAS", which imposes the restriction on freedom of building the optimal environment, after the completion of the project it is planned to apply for support to "ICP_DAS" with the request to correct this situation.

Links


Referring pages: HomePageEn/Doc/OpenSCADA072
HomePageEn/Doc/OpenSCADA080
HomePageEn/Using/LP5xxx
HomePageEn/Using/NokiaLinux
HomePageEn/Using/PLC/firmwareARM


 
There are no files on this page.[Display files/form]
There is no comment on this page. [Display comments/form]