1 Reply Latest reply on Feb 5, 2016 3:29 AM by khorie RSS
    khorie Newbie

    Modbus package:“illegal instruction" error

    Hi,

     

    I met the “illegal instruction"error when I run the luaSciptResouce in WebSocket EMS + modbus package.

    It happens on Linux ARM (not HFPU.), but does not happen on Windows10 with the same configuration.

    It happens in Modbus/TCP, but does not happen in Modbus/RTU.

     

    Did anyone see this error ?  If so, could you tell me how did you solved?

     

    I searched the google and some Linux article is saying it could happen by when it was built for different CPU/OS type, or divided by zero.

    Off course I installed the correct version of distribution depend on the OS and CPU type.

     

    <distribution used>

    -Web Socket EMS:

    -MicroServer-5-3-0-539-Win32.zip  for windows

    -MicroServer-5-3-0-539-Linux-ARM.zip  for Linux ARM without hardware FPU.

    - http://marketplace.thingworx.com/downloads/netcomm-wireless-6200-01/

      MicroServer_80.zip (extracted from the starter kit of NetComm-6200-01.zip)

           This is the original one which my edge device was certified as ThingWorx Ready.

     

    -Modbus package

    https://community.thingworx.com/community/developers/blog/2015/12/13/modbus-plc-simulator

    TWEMS MODBUS Package_Linux_ARM.zip  for Linux ARM

    TWEMS MODBUS Package_Windows.zip  for windows

     

    <config.lua >

    This error happens when I specify the Modbus/TCP as follows.

     

    scripts.modbus_handler = {

    file = "modbus_handler.lua",

    name = "modbus_handler",

    host = "192.168.10.50",       <---This specify TCP

    }

     

    This error does not happen when I specify the Modbus/RTU as follows.

     

    scripts.modbus_handler = {

    file = "modbus_handler.lua",

    name = "modbus_handler",

    serial_port = "ttyUSB0",     <-- This specify RTU

    baud_rate = "9600",

    read_timeout = "1000"

    }

     

    <Exact error message>

    (initial part of log are abbreviated)

    Persisted Props:

    file = thingworx.lua

    max_run_time = 20

     

    GlobalProps:

    config_file_path = /opt/microserver/etc

    log_level = DEBUG

    rap_host = 127.0.0.1

    rap_port = 8000

    script_clib_path = ***************** (abbreviate)

    script_directory = ***************** (abbreviate)

    script_library_path = ***************** (abbreviate)

    script_resource_host = 127.0.0.1

    script_resource_port = 8002

     

    [DEBUG] 2016-02-01 20:32:10,688 luaScriptProxy::runScript: Starting Script

    [DEBUG] 2016-02-01 20:32:10,689 luaScriptProxy::getStatus: Script Thingworx status = Ready

    [FORCE] 2016-02-01 20:32:10,699 httpServer: starting http server port=8002

    [DEBUG] 2016-02-01 20:32:10,700 httpServer: http server bound to port=8002.

    [DEBUG] 2016-02-01 20:32:10,701 luaScriptProxy::execute: Script Thingworx now executing

     

    Illegal instruction      <---This error!

    #

     

     

    Thank you,

    Kunio

      • Re: Modbus package:“illegal instruction" error
        khorie Newbie

        HI .

         

        I could solved this error.  Here I report how I solved this .

         

        The solution is as follows.

        I replaced the file (1) by (2) , then the error was not happen , and Modbus/TCP seems working fine as of now.

        (1)microserver/etc/thingworx/community/clibs/socket/core.so (this came from ThingWorx )

        (2)/usr/lib/lua/5.1/socket/core.so (this is part of original firmware of my M2M device ( NetComm Wirelss NTC6200) .)

         

        I hope this helps someone who meet similar issue in future.

        Thank you

        Kunio