From OpenSCADAWiki
Jump to: navigation, search
This page contains changes which are not marked for translation.

Constr.png The translation moving and actualizing

Single board computer Tion-Pro270 of the firm ZAO ZEO
Begin: 11 (November) 2011
Participants: Roman Savochenko
Description: Single-Board Computer "Tion-Pro270" is a highly integrated computational-control system, based on the Marvell PXA270 processor with XScale ARM core from the ZEO company. This card was given to the developers of the OpenSCADA project by Alex Popkov in order to adapt OpenSCADA for it.
Materials: http://ftp.oscada.org/OpenSCADA/PLC/TionPro270

Tion-Pro270.png

The board is supplied by the equipment manufacturer with preinstalled software environment based on Linux™ or Windows CE©. Besides all the source materials of the software environments are available in Wiki-resource of the manufacturer.

We got the board with the minimal software environment for which it was not possible to build OpenSCADA, so the new software environment has been fully loaded to the board. Download the software environment to the flash-memory was made with the help of [WikiPedia:JTAG JTAG]-adapter OLIMEX ARM-USB-OCD and OpenOCD program of version 0.5.0, building of which should be configured with the "--enable-ft2232_libftdi" parameter.

For downloading to board's flash memory it was used ready boot buildings UBoot-1.3.3 (file of the image is u-boot-1.3.3_svn886_520mhz_tion_pro270_64m.bin) and kernel Linux-2.6.22.19. JFFS2 RFS filesystem image was built with the help of "BuildRoot" and "PTXDist", see below.

Flashing of the equipment with help of "OpenOCD" was made from root by the following command:

  • $ openocd -f interface/olimex-arm-usb-ocd.cfg -f tion270.cfg

"tion270.cfg" script of the flash and image files of the software environment specified in the flash script "tion270.cfg", should be placed in the current directory. The flash script "tion270.cfg" includes:

# Tion270 and Tion-Pro270 Openocd config

set CHIPNAME tion270
source [find target/pxa270.cfg]

jtag_khz 2000

jtag_nsrst_delay 10
jtag_ntrst_delay 10

reset_config trst_and_srst separate

# Works for J3, P33 flash
# flash bank <name> <driver> <base> <size> <chip_width> <bus_width>
flash bank 0 cfi 0x0 0x2000000 2 4 $_TARGETNAME

init
reset halt
flash probe 0

flash protect 0 0 1 off
flash erase_sector 0 0 2
puts "(1/3) Flashing u-boot ..."
flash write_image u-boot-1.3.3_svn886_520mhz_tion_pro270_64m.bin
puts "(2/3) Flashing linux kernel image ..."
flash write_image erase uImage-2.6.22.19_svn818_tion-pro270_eabi 0x00080000
puts "(3/3) Flashing root filesystem ..."
flash erase_sector 0 17 127
flash write_image rootfs_TionPro270_buildroot.jffs2 0x00480000

1 Building of the RFS in the BuildRoot

In order to avoid multiple build problems associated with the build from the beginning, the configuration "buildroot-2009.08" was taken directly from the Git-repository of the equipment manufacturer: [[1]]. In order to build in the "BuildRoot" environment the configurations were created in the directory "./package/" for the "LibGD" library and OpenSCADA.

Result RFS was loaded to the flash memory of the board and started successfully. However, at start it became clear that the "uCLibs" version 0.9.30.3 does not implement the function clock_nanosleep(), as well as crashes in the function timer_settime() for the type of notification SIGEV_THREAD. The the clock_nanosleep() function can be replaced by nanosleep(), but it is impossible to solve the problem of the timer_settime() function within this version of "uCLibs".

Next, an image of the current version of the "BuildRoot" on 16.01.2012 was taken, and the building of OpenSCADA with "uCLibs" version 0.9.32.1 were made. The building was successful after some adaptation of the building environment. OpenSCADA started successfully with some problems that have been resolved.

Following list describes problems encountered during building and operation of OpenSCADA on uCLibC of different versions:

  • There is no implementation of the usleep() and msleep() functions in the typical configuration — it is created and widely used the system-wide function for OpenSCADA sysSleep() with the implementation based on nanosleep().
  • < 0.9.32: it can't be built due to the lack of a number of functions, as well as OpenSCADA can't start:
(+) the lack of the clock_nanosleep() function's implementation — it is necessary to use the version >= 0.9.32 or to change it to nanosleep().
(-) 0.9.30.3: crash in the timer_settime() function for the SIGEV_THREAD notification type — Actual.
  • 0.9.32: building was done successful, with some solved problems when starting the OpenSCADA:
(+) The OpenSSL library "libssl" contains no dependence on the "libcrypto" — the direct dependency on the "libcrypto" library is added to the "OpenSCADA.Transport.SSL" module.
(+) Family of printf() functions incorrectly circumvent the problem of hanging characters '%' — line of the message is fixed "Last: %s. Load: %3.1f% (%s from %s)".
(+) Different from the GLibC processing of the interblocks within a single thread in the RW-lock functions — the interblocking is fixed in the OpenSCADA.UI.WebVision module, and function of sessions' check was moved to the service call procedure.

2 RFS build in the PTXDist

Learning the PTXDist for building environment on TionPro270 was made using the experience of the following link http://www.emb-linux.narod.ru/tion-pro-270/index.html. However, the article was written a long time ago and it was used the ptxdist-1.1.1 version for building, which actually doesn't work on the modern software environments, and also part of the libraries needed for OpenSCADA can't be built there easy. At end it was based on version ptxdist-2011.11.0 and the building was made using this version.

Before the building of RFS the ToolChain configuration for this board was created arm-xscale-linux-gnueabi_tion270.ptxconfig on the basis of the existing arm-xscale-linux-gnueabi_gcc-4.6.2_glibc-2.14.1_binutils-2.21.1a_kernel-2.6.39-sanitized.ptxconfig with the following programs' versions:

  • GLIBC_ENABLE_KERNEL="2.6.19", because the actual kernel is 2.6.22 version, and to work with him GLibC should be given less than or equal version;
  • KERNEL_HEADERS_VERSION="2.6.30.5", kernel version for the headers;
  • CROSS_GCC_VERSION="4.5.2".

Next was created PTXDist "OSELAS.BSP-Pengutronix-Generic" project's clone in directory "TionPro270_RootFS" with the configuration platform "arm-qemu-2011.01.0". To build OpenSCADA following configuration files was created openscada.in and openscada.make, which were placed in the local configuration directory of the project rules/. It was adapted the configuration of the udev program, which version was very big for the original version of the kernel Linux-2.6.22, ie it was used the udev of 141 version. New configuration files of udev were also placed in the directory rules/, thus defining their usage instead of the original configuration.

The RFS was successfully built and jffs2 image of FS was received. The resulting RFS was successfully loaded onto the board and started. OpenSCADA started and work correctly as well.

3 Adaptation

This board contains a number of hardware interfaces interesting to adaptation for OpenSCADA, so this section will be focused on the adapting process.

The board contains a chip converting signal levels from RS232 to RS485, which, however, is not clear to send requests from the software. Namely:

  • to send a request you need to set the RS232 interface signal "RTS" at zero;
  • it is necessary to read interface for waiting the echo package of the request, after receiving of which the RS232 signal "RTS" should be set to true, the echo package should be dropped and then you should waiting for direct response.

To the specific solve the OpenSCADA module Transport.Serial has been improved for this kind of hardware flow control support.

Using this extension, validation was made and presence of [../LP5xxx#h1078-5 LP-5141] controller's software environment problem was confirmed.