# DEVELOPMENT of embedded system for running EPICS IOC by using Linux and Single borad computer

A. Uchiyama^\#^, SHI Accelerator Service Ltd., Shinagawa, Tokyo, Japan\
M. Komiyama, M. Kase, RIKEN, Nishina Center, Wako, Saitama, Japan

Abstract

The purpose of our development was to implement the EPICS (Experimental
Physics and Industrial Control System) IOC (Input/Output Controller) box
which has high durability, high reliability and high usability, in RIKEN
RI-Beam Factory (RIBF) control system. The developed EPICS IOC box is
consisted of a single board computer (SBC) installed embedded Linux. In
the implementation test, we have confirmed the effectiveness of the IOC
box. For this reason, PC-based IOCs were replaced with these embedded
IOC boxes in November 2006 for the RIBF control system.

## INTRODUCTION

We constructed a control system based on the EPICS for the RIKEN RIBF.
Nowadays, the PC-based EPICS IOC is used in many laboratories because it
is available for use on the Linux x86 platform since EPICS was upgraded
to version R3.14. Recently, a lot of network devices, such as the PLC
(Programmable Logic Controller) and N-DIM (Network-Device Interface
Module) of RIKEN\'s original device, are used in our facility for
controlling the beam diagnostics and vacuum system \[1\]. These network
devices must be controlled by PC-based IOCs, because it is available for
simpler setup and lower cost than VME IOCs. When the number of device
increases, the probability of troubles rises dramatically. Because some
parts of PC, such as the fan, hard disk drive, and built-in power
supply, is often broken for lomg term operation. Furthermore, if a large
number of desktop PCs are used for running IOC, it is very hard to
maintain them by small number of engineers. We expected we could solve
the problems described above using a diskless and fanless embedded SBC
for running IOC and managing IOC in the fileserver. For this reason, we
developed a compact and simple embedded Linux specialized for running
IOC and installed it in a SBC.

## TARGET BOARD

In our control system, the IOC box should be constructed by high
durability hardware, and it should be kept to implement with simple
maintenance for a long term. Furthermore, considering a development
difficulty and cost performance, we chose WRAP (Wireless Router
Application Platform) made by PC Engines GmbH. as a target board (see
Fig. 1) \[2\]. The WRAP is one of the most suitable for our system using
EPICS, because it is a SBC optimized in embedded system for network,
such as router, VPN, and firewall. The characteristics of WRAP are as
follows.

-   Disk less and fan less

-   Low cost

-   Operating system and software to be supplied by a lot of customer

-   Cross compile environment is not necessary for development (x86
    platform).

    ![](media/image1.jpeg){width="1.45in" height="1.0770833333333334in"}
    ![](media/image2.jpeg){width="1.4222222222222223in"
    height="1.0770833333333334in"}

Figure 1: Photograph of the WRAP (left figure), the WRAP in the case
(right figure)

We bought a WRAP for about US\$120 in Aug 2006 in Japan, and the total
cost was about US\$150 which includes price of a 256MB compact flash
(CF) and an AC adapter. The reasons for selection of x86-compatible
platform CPU are as follows:

-   It is not necessary to have the cross compile environment.

-   We can use libraries and drivers implicitly from kernel source.

-   It is effective method in order to shorten turnaround time for the
    system development process.

The hardware specifications are summarized in Table 1

Table 1: WRAP Specifications

  ------------------ ----------------------------------------------------
  CPU                233MHz AMD Geode SC1100

  Memory             128 MB SDRAM

  Storage            Compact Flash (256MB)

  Connectivity       1 Ethernet channels, 1 Serial port

  Power Supply       AC adapter
  ------------------ ----------------------------------------------------

The WRAP does not have a VGA connector, so that the serial port is used
for console.

**SYSTEM SPECIFICATION**

### Operating System

In the facility of RILAC/RRC in RIKEN before RIBF project started,
namely RIKEN Accelerator Research Facility, EPICS was used in
combination with Linux \[1\]. Therefore, it was natural that we
considered using Linux for embedded IOC box\'s operating system. By
contrast, major Linux distributions, for example Fedora core, Scientific
Linux, and CentOS, were not suitable for WRAP\'s one, because system
size is too big. At first, we tried to design the compact Linux
minimized for embedded IOC box using the Fedora core. However, it was
difficult to remove a lot of libraries and programs to resolve
dependencies simultaneously. Consequently, we decided to develop the
compact embedded Linux as own new distribution with the method of LFS
(Linux From Scratch) \[3\]. This method is to build own Linux from
kernel source and the necessary packages. In order to build the embedded
Linux, we followed the procedure developed by administrator of
"pochinet.org \[4\]" and build it on CentOS 4.2. On the other hand, the
safety of system security in this operating system is not considered,
because the network of control system is stand-alone in RIBF. The
packages implemented into the embedded Linux are shown in Table 2. These
packages, Linux kernel, programs and libraries for running IOC, are
almost all in this embedded Linux. The Linux consists of small number of
programs compared with those of the other distributions by using BusyBox
\[5\].

Table 2: Packages of the embedded Linux

  ------------------------------------------ ----------------------------
  **Package**                                **Version**

  Linux kernel                               2.6.13

  GRUB                                       0.9.5

  glibc                                      2.3.6

  glibc-linuxthreads                         2.3.6

  BusyBox                                    1.10

  Apache                                     2.0.58

  bash                                       3.0.16

  utelnetd                                   0.1.9

  NTP                                        4.2.2

  PHP                                        4.4.4

  EPICS base                                 R3.14.7
  ------------------------------------------ ----------------------------

The characteristics of the Linux are listed as follows.

-   Booting kernel 2.6 from 256MB CF

-   Small and compact size Linux (about 120MB)

-   Not available to change the physical disk by using RAM-Disk

-   Optimized for running IOC

-   Automatically running IOC process after booting

### EPICS Base

Before development of embedded IOC box, we used EPICS version R3.14.7 on
desktop PC, and it was not necessary to upgrade EPICS version. The
environment to compile EPICS programs and the environment to run EPICS
IOC need to have same libraries. For this reason, we compiled the same
version source code to EPICS programs on the PC used for operating
system development. For managing IOCs, it is not necessary for all of
the boxes to have EPICS programs in the CF. EPICS programs installed in
the fileserver are shared by all of IOC boxes for managing IOC (see Fig.
2) \[6\]. In addition, we provided the function that IOC process runs
automatically after turning on, in order to maintain more easily.

![](media/image3.jpeg){width="2.0416666666666665in" height="1.2in"}

Figure 2: IOC shared with embedded boxes

### Web application

In implementation test, the following problems were found.

-   It is difficult to watch the running process of IOC on the terminal,
    because the WRAP dose not has VGA connector.

-   We would like to restart IOC process more easily.

-   In trouble, the parameters in this system should be configured again
    by all accelerator operators as soon as possible.

To resolve the above problems, we developed web applications written by
PHP language.　The user interface (UI) of the web applications was
designed like a router\'s one. Almost of router\'s UI can help to
configure system easily for every user without knowledge of the
system.　Thereby, we expected that all accelerator operators can not
only watch the running process, but also recover the system from some
troubles using the simple manual. The screen shot is shown in Fig. 3.

![](media/image4.jpeg){width="3.1444444444444444in"
height="1.8958333333333333in"}

Figure 3: Screen shot of web application

## RECOVERY TEST

It is one of the most important concepts that all of accelerator
operators can recover the IOCs quickly, if the system has rare hardware
trouble. Therefore, the operator, who does not have the knowledge about
system specification in detail, tried the recovery test alone with the
simple manual and CF with operating system. The recovery sequence is
summarized as follow.

1.  Remove the SBC from the case of IOC box

2.  Change with the CF

3.  Put on the case

4.  Turn it on

5.  Configure the system parameters from the default value with browser.

6.  Check to run the IOC after the system restarted.

As a result, the recovery test succeeded for about 10 minutes only with
ease.

## SYSTEM SCALABILITY

Since February 2007, PC Engines GmbH. stopped to produce the WRAP due to
the running out of AMD SC1100 as the CPU of this SBC. It might be a
serious problem for our laboratory even though we had enough SBCs in
stock at that time. We needed to check that our Linux was available for
booting by other hardware,　because in the future, we will keep using
this system. For this reason, we tried to implement the Linux on the
other hardware.　The hardware were PFU AR2000 \[7\], and CC/NET \[8\]
made by TOYO Corporation, both of them are embedded computer with
x86-platform and available to boot from CF. As a result of unit test,
the embedded Linux can boot and run IOC on these hardware, though it is
necessary to rebuild Linux kernel and to edit "/boot/grub/grub.conf" and
"/etc/inittab".

**STATUS**

In November 2006, we started implementation test of the WRAP installed
embedded Linux of version 1.0. Afterwards, we repeated to upgrade the
Linux many times and eight IOCs were implemented in RIBF control system
without serious trouble till September 2007 \[6\]. Three WRAPs set in
the case of 1U panel (see Fig. 4). The numbers of the EPICS record and
the number of network device connected with the WRAP are shown in Table
3.

![](media/image5.jpeg){width="2.479861111111111in"
height="1.8798611111111112in"}

Figure 4: Three WRAPs set in the case of 1U panel.

Table 3: Devices connected with the WRAP and EPICS record in RIBF
control system.

\* V: Vacuum system. B: Beam diagnostic system.

  ----------- -------------- -------------- ---------- -------------------
  WRAP        Device         Number of      Use        Number of EPICS
                             device                    record

  1           N-DIM          14             V          112

  2           N-DIM          21             B          454

  3           N-DIM          37             V, B       960

  4           N-DIM          27             B          491

  5           PLC            5              V, B       363

  6           N-DIM          34             V, B       1721

  7           N-DIM          44             B          873

  8           PLC            4              V, B       556
  ----------- -------------- -------------- ---------- -------------------

**CONCLUSIONS**

The purpose of our work was to design high durability and easy
maintenance system for running IOC, and to develop one using SBC and
embedded Linux. As a result, it was successful to develop embedded Linux
using method of LFS, to run IOC on SBC. By contrast, it will be
difficult to implement the system using a lot of PC-based IOCs without
trouble, because the system will be complicated to have a lot of network
devices in RIBF control system. However, above problems are resolved by
implementing embedded IOC with low cost. In this test, it was confirmed
that our developed system was useful in RIBF control system. We expect
it is not easy to be broken, even if it has some rare hardware trouble,
almost all of accelerator operators can configure system to recover one
quickly without administrator.

**ACKNOWLEDGMENTS**

The author would like to thank J. Odagiri and N. Yamamoto in KEK for
supporting the construction of system, and all of accelerator operators
and RIBF commissioning members for cooperating with implementation test.

## References

\[1\] M. Komiyama, et al., in: Proc. of ICALEPCS2003, Gyeongju, Korea,
2003, p. 109

\[2\] http://www.pcengines.ch/

\[3\] http://www.linuxfromscratch.org/

\[4\] http://www.pochinet.org/

\[5\] http://www.busybox.net/

\[6\] M. Komiyama, et al., No. TPPB1 in this Proceedings.

\[7\] http://www.pfu.fujitsu.com/prodes/product/ar/

\[8\] http://www.toyo.co.jp/daq/ccnet/index.html