Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Modbus package:“illegal instruction" error


Modbus package:“illegal instruction" error


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:  for windows  for Linux ARM without hardware FPU.

- (extracted from the starter kit of

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

-Modbus package


TWEMS MODBUS  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 = "",       <---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


config_file_path = /opt/microserver/etc

log_level = DEBUG

rap_host =

rap_port = 8000

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

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

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

script_resource_host =

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,



Re: Modbus package:“illegal instruction" error

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/ (this came from ThingWorx )

(2)/usr/lib/lua/5.1/socket/ (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



Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!