3 Replies Latest reply on Apr 8, 2016 2:52 PM by ortizvinicius

    "illegal instruction" when accessing serial port

    poseid

      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);

        });

        }

      });