Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor II
1,292 Views

"illegal instruction" when accessing serial port

Hi,

I wanted to play with the serial ports of an Intel Galileo Gen. 2.

I am using the SD card image with Node.js.

When I run my Node.js script, I get:

root@galileo:~/serialtest# node openport.js

Illegal instruction

Now, the script is simply opening the port and waiting for data:

var SerialPort = require("serialport").SerialPort;

var modem='/dev/ttyS0'; // or other ports

var serialPort = new SerialPort(modem, {

baudrate: 115200

}, false); // this is the openImmediately flag [default is true]

serialPort.open(function (error) {

if ( error ) {

console.log('failed to open: '+error);

} else {

console.log('open');

serialPort.on('data', function(data) {

console.log('data received: ' + data);

});

serialPort.write("ls\n", function(err, results) {

console.log('err ' + err);

console.log('results ' + results);

});

}

});

3 Replies
Highlighted
Employee
13 Views

Hello poseid,

Which library are you using? Did you remember to enable the serial port muxes. In case you didn't, you will find the instructions o how to do it in: .

Peter.

Highlighted
Employee
13 Views

Hi poseid,

Have you been able to use the Serial port of the board? Did you try with Peter's suggestion? You can also try to use the port with the http://iotdk.intel.com/docs/master/mraa/ MRAA library

Regards,

Charlie

0 Kudos
Highlighted
Beginner
13 Views

Have you been able to do this? I got the same issue

0 Kudos