Latest Posts

Thursday, October 19, 2017

Build the Tiny SecsGem base on the secsdriver.

With the SecsDriver, we can build the SECSGEM (E30) application base on it, called TinySecsGem.

OS and Hardware

- Raspberry Pi (ARM APU) with raspbian OS
- Window or Linux OS. 

The middle layer of TinySecsGem include

- Database: Mysql
- Script control language: Lua script
- Communication: TCP/IP or RS-232
- Setting Equipment Control: Web application, bootstrap, mysql, php, apache.
- Communication with equipment sensor, device.. via TCP/IP.
- and SecsDriver.

SEMI Std supported:

- E30 GEM
     + Establish Communications: Eqp send establish communication and Eqp attempts to establish communication.
     + Data Collection: Grant multiblock, Dynamic Event Report Configuration.
     + Variable Data Collection
     + Trace Data Collection
     + Limits Monitoring(S2F45, S2F47)
     + Status Data Collection
     + On-line Identification
     + Alarm Management
     + Remote Control Command
     + Equipment Constants
     + Process Program Mng
     + Material Movement (Not support yet)
     + Equipment Terminal service (stream 10)
     + Error Message
     + Clock

Saturday, September 30, 2017

Secsdriver: Access the SECS-II message which not been defined in XSML file.

When we build the Tiny SECS/GEM, we got the issues like this.
The S2,F15 New equipment const send, it send from host to equipment to define the equipment const.

secsdriver provided the method to process. In lua script file, we have the new function named "EQPReceivedMsg"

So, with the S2F15 message, all of data item will be accessed by the index look like Jquery Selected. Example code:
After receive the ECID and ECID value, we can process to save this ECID to database, and do reply the secondary message S2F16 with the ACK OK to host. The secsdriver support the API to send message on the fly.

Email me if you have the issue !

We are building the Tiny SECS/GEM on the raspbery Pi. Keep connect with us to see more...
Thank you.

Monday, August 21, 2017

SecsDriver on Raspberry Pi3

The raspberry Pi, is the tiny computer which is built on the ARM CPU architecture. So we have to rebuild the c++ source code for ARM  architecture.

We try a lot with the cross compiler for ARM, but it still get stuck with the LUA library. Finally, we bring the source code into the Raspberry Pi...and we solved it.

You can try it now.

Step by step to install the SecsDriver system on Raspberry Pi

1. Assumption you already have the Pi (we already test with the Jessie image, can be download here

2. Get the secsdriver4pi by download here: 

3. Upload and unzip to pi at /home/pi/secs

4. Run 
./secsdriver secsdriver.ini

Enjoy it
* Establish Communication Request
s1f13 = S1F13_S w output
s1f14 = S1F14_R input
           = commack

Saturday, April 29, 2017

Tutorial: SECS-II Message definition in the XSML file.


To communication with the semiconductor equipment, you have to use the E5 SEMI standard (SECS-II). We can define the SECS-II message in the file, and the SecsDriver can process it.

With the host controler, we have to kind of messages. One called the solicited message, and the other is unsolicited messages.

Solicited message 

That means, you know exactly the sending primary message and the receiving secondary message, with the structure and data type also.
** On Line Data
S1F1 = S1F1_AREYOUTHERE w output
        <A 'Test eqp'>          = mdln
        <A 'SecsDriver-1.0'>    = softrev
S1F2 = S1F2_R input
    <U[4] 1>
    <U[4] 22>
In this example, the SecsDriver know the sending message S1F1, and expected to receiving S1F2 with the empty LIST datatype.
To send this message, in the SecsDriver supported the API, named SendRecvMessage
SendRecvMessage ("S1F1_AREYOUTHERE");
Before sending, we can set data by calling the API
SetValue( "S1F1_AREYOUTHERE", "mdln", "VARIAN_KESTREL" );
SetValue( "S1F1_AREYOUTHERE", "softrev", "Version1" );
The completed script code:
-- set value to mdln variable
SetValue( "S1F1_AREYOUTHERE", "mdln", "VARIAN_KESTREL" );
-- set value to softrev variable
SetValue( "S1F1_AREYOUTHERE", "softrev", "Version1" );
-- send S1F1 and wait for the S1F2
SendRecvMessage ("S1F1_AREYOUTHERE");
-- End
One more example with the Remote Command S2F41
* Host Command Send
s2f41 = S2F41_F42_GO_REMOTE_COMMAND w output
        <A 'GO_REMOTE'>
s2f41 = S2F41_F42_CLAMP_COMMAND w output
        <A 'CLAMP'>
                <A 'LOC'>
                <b[1]>              = loc         
s2f41 = S2F41_F42_CANCEL_JOB_COMMAND w output
        <A 'CANCEL_JOB'>
                <A 'MID'>
                <a[22]>             = mid1
s2f42 = S2F42_R input
        <B[1]>                          = hcack
        <L[max 10 index i] 
                <A[10]>                 = cpnames[i]
                <B[1]>                  = cpacks[i]
        >    count n_params
In this case, the message
- S2F41_F42_GO_REMOTE_COMMAND this don't have any paparameter.
S2F41_F42_CLAMP_COMMAND have the parameter named loc.
If you want to lock the LOAD port 1, should be sent the message with value 01.
-- Set the load port 01
SetValue( "S2F41_F42_CLAMP_COMMAND", "loc", "1" );
-- Send the remote command
SendRecvMessage ("S2F41_F42_CLAMP_COMMAND");

Is this easy ? :D

Friday, April 28, 2017

Tutorial: How to build the Host Request GoOnline


Host want to send the GoOnline Request to the semiconductor equipment. The scenario likes that:


1. SecsDriver had been run in the VirtualBox: See last post how to install in virtualBox

2. Download or compile the HostExample. The binary and source code which can download from:

3. The SecsDriver Controler. Can be download source code and binary from here


1. SecsDriver and SecsDriver (tool Simultor) run on VirtualBox
2. HostExample run on Host PC
3. SecsDriverControler run on HostPC


The default configuration:
1. SecsDriver Host
- Host port: listening on port 5555 (Waiting connection from HostExample)
- Service port: listening on port 6666 (Waiting connection from SecsDriver Controler)
- CONTROL0=Type=HSMS-SS;Log= 0log;DeviceId=0;LUA=lua2.lua;XSML=varian_host.xsml;Port=9000;IpAddress=;Mode=Passive;Role=HOST;T3=10;T5=5;T6=10;T7=10;T8=10;TCA=5

2. SecsDriver Tool (simulator)
- Host port: listening on port 5557 (Waiting connection from HostExample)
- Service port: listening on port 6667 (Waiting connection from SecsDriver Controler)
- CONTROL0=Type=HSMS-SS;Log=0log_tool;DeviceId=0;LUA=lua2.lua;XSML=varian_tool.xsml;Port=9000;IpAddress=;Mode=Active;Role=HOST;T3=10;T5=5;T6=6;T7=10;T8=10;TCA=5


From virtualBox:

1. Run SecsDriver Host


2. Run SecsDriver Tool (Simulator)


3. Run SecsDriverControler (MSC.exe)

Connect to SecsDriver Host, by IP of Virtualbox and port 6666 (port 6666 is the service port of SecsDriver Host)

4. Run HostExample
Connect to the SecsDriver Host, by IP of VirtualBox and port 5555.

Tip: How to get the IP of the VirtualBox ?
run the linux command 

In this example, the IP of VirtualBox is

Now we go to the main tutorial, how to build the GoOnline Request from host

Build the GoOnline Request

First, use the MSC connect to the SecsDriver Host (port 6666), then try to send the S1F1 (are you there) by click on the SEND MESSAGE from the MSC. (See the image)
You can see the S1F1 has been sent and get back the reply S1F2 from SecsDriver simulator

Update the host script control

OK, so now we get the script and change some thing. From MSC, Control_0 tree node, right click and choose GET SCRIPT

And you will get back the script of the Control_0.

The MSC.exe have the very bad of text editor :( i am sorry :) so you can copy all to your text editor.
This is the LUA script language (

Check the script here

function MESRequest(xmlRequest, ctlId)
    print("MESRequest Begin ctlId="..ctlId.." currentControlId="..ControlID.."\n");
    xml = xmlParser( xmlRequest );
    if (xml==nil or xml[1]==nil or xml[1].xarg==nil) then
    print "NULL"
    do return end
    print_r( xml );
    requestname = xml[1];
    requestControlId = xml[1].xarg.controlId;
    -- Check the control Id...
    if(tonumber(requestControlId)~=ControlID) then
        print("If this is not the same Control ID, do not process...\n")
        print("MESRequest END...")
    -- print( "SIZE="..#xml[1] );
    for i=1,#xml[1] do
    print( "Request Name: ["..requestname.."]\n" );
    print( "Parameter:\n-----------------" );
    print_r( param );
    print( "-----------------\n" );

    if( requestname=="GoOnline" ) then
        GoOnline( param );
    elseif( requestname=="GoOffline" ) then
        GoOffline( param );
        WriteLog( "LUA CALL WRITE STRING " );

    print("MESRequest End\n");

All host request will be came from the function MESRequest.

String: xmlRequest: is the XML (or JSON) from the HostExample
String: ctlId : is the control Id. (integer value)

If the requestname = "GoOnline" it will call to the GoOnline

function GoOnline(param)
-- SEND S1F1 message - and wait for getting back S1F2.
SendRecvMessage( "S1F1_F2_ARE_YOU_THERE" );
-- Report to HostExample
HostReport[[<HostReport name="GoOnlineRpt"><param name="resultText">Send GoOnlineReq to Equipment Sucessful</param></HostReport>]];

In the MSC, find the GoOnline function, and replace by this code above
Then, click on SAVE SCRIPT. MSC will update the lua script in the SecsDriver Host. (on virtualbox)

So now, from HostExample, connect to SecsDriver Host, then BuildReq and finally send the request to SecsDriver Host.

You can see the request had been sent to SecsDriver Host.
Then SecsDriver Host, send S1F1 to tool and wait to get back S1F2
Then, SecsDriver Host send the HostReport to hostExample.

Enjoy !

Monday, April 24, 2017

The SecsDriver Controller Application (with source code)

See article:
1 SecsDriver, the demo in virtualbox image
2 SecsDriver, the cross-flatform SECS-II driver


The SecsDriver Controller, is the tool to view the SecsDriver.


You can download the source code from



In the master configuration file of SecsDriver, secsdriver.ini we have the session

# SERVICE_TCPPORT: SecsDriverControler will connect to this port

The SecsDriver will listen on the port 6666, and the SecsDriverControler will connect to this port

How to run the demo

1. Run the SecsDriver on VirtualBox (see the last post

2. In virtualBox linux, run the command to start SecsDriver as the Host Role


It will run the SecsDriver with the master configurtion file at: /mnt/sda1/secs/secsdriver.ini

3. Get the IP of the virtualbox machine by run the command:


Example, the IP is

4. Run the SecsDriverControlerApp on another PC (or the virtualbox host pc, Windows OS)

5. Connect to IP, Port 6666

You will see

SecsDriver, the demo in virtualbox image

Download the demo virtualbox image

Step by step to run the SecsDriver demo

1. Download virtualBox, and install virtualbox into your computer.

2. Download the virtualbox image. This is the linux distro Tinycorelinux, also includes LUA, lualib, and SecsDriver.

After download, unzip into the VDI file, tce72.vdi

3. Create new VirtualBox machine from the vdi file.

Choose the tce72.vdi file

Bridge Adapter
4. Start the VirtualBox Image.

The linux distro is Tinycorelinux, download from
After start, right click mouse to open the terminal. Then do step by step (check the screen image above)

Step 1: Update the lastest secsdriver binary.

sudo ./

Step 2: When try to run the secsdriver by command:


You will see the message like that, MacGET = []: ec:55:f9:f4:6d:2d So you need to get the new reg.dat file from our website

Step 3: Open the Chominium browser, go to
Then upload the file reg.dat from /mnt/sda1/secs; and get back the download file reg.dat.
Usually, the download file reg.dat will be stored in /home/tc/Downloads/reg.dat.

Step 4: Start secsdriver. The script also have the copy command to copy the reg.dat file from Downloads folder to /mnt/sda1/secs.


Start secsdrive ./

About Me

Work as the developer. c++, cpp, java, c#...

Popular Posts

Search This Blog