Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not working on OSX #11

Closed
santiago opened this issue Apr 19, 2011 · 32 comments
Closed

not working on OSX #11

santiago opened this issue Apr 19, 2011 · 32 comments

Comments

@santiago
Copy link

Hi, running test_read.js on OSX 10.6, using an Arduino, crashes/freezes the machine, which makes me to reboot.

@voodootikigod
Copy link
Collaborator

Did you update for your serial port path ALSO is your arduino configured to
transmit? More are not by default. It works on OS X as thats what I am
developing on.

On Mon, Apr 18, 2011 at 11:00 PM, santiago <
reply@reply.github.com>wrote:

Hi, running test_read.js on OSX 10.6, using an Arduino, crashes/freezes the
machine, which makes me to reboot.

Reply to this email directly or view it on GitHub:
#11

Chris Williams
Twitter: http://twitter.com/voodootikigod

The things I make that you should check out:
OurParents: http://ourparents.com
PromoteJS: http://promotejs.com
JSConf US: http://jsconf.us
Minute With: http://minutewith.com
JSConf Live: http://jsconflive.com

@santiago
Copy link
Author

it actually shows me the first two bytes of the Arduino's stream and then the machine freezes. Using the same code in the same macbook but running ubuntu instead works as expected.

@voodootikigod
Copy link
Collaborator

How did you install node.js on the mac? Homebrew?

On Mon, Apr 18, 2011 at 11:22 PM, santiago <
reply@reply.github.com>wrote:

it actually shows me the first two bytes of the Arduino's stream and then
the machine freezes. Using the same code in the same macbook but running
ubuntu instead works as expected.

Reply to this email directly or view it on GitHub:
#11 (comment)

Chris Williams
Twitter: http://twitter.com/voodootikigod

The things I make that you should check out:
OurParents: http://ourparents.com
PromoteJS: http://promotejs.com
JSConf US: http://jsconf.us
Minute With: http://minutewith.com
JSConf Live: http://jsconflive.com

@santiago
Copy link
Author

from sources. running 0.4.4 on OSX and 0.4.6 on ubuntu
on both installed serialport via npm

@voodootikigod
Copy link
Collaborator

try upgrading your osx to 0.4.6

It does work on OSX. I have heard of various oddities though. Also check
your FTDI driver and ensure that it is the latest

On Mon, Apr 18, 2011 at 11:25 PM, santiago <
reply@reply.github.com>wrote:

from sources. running 0.4.4 on OSX and 0.4.6 on ubuntu
on both installed serialport via npm

Reply to this email directly or view it on GitHub:
#11 (comment)

Chris Williams
Twitter: http://twitter.com/voodootikigod

The things I make that you should check out:
OurParents: http://ourparents.com
PromoteJS: http://promotejs.com
JSConf US: http://jsconf.us
Minute With: http://minutewith.com
JSConf Live: http://jsconflive.com

@robotconscience
Copy link

I'm having the same issue, both with 0.4.6 and 0.4.7 on OSX (10.6.7).
I have the newest FTDI drivers installed from the Arduino package, and have tried doing both Serial.print(); and Serial.println();. Each only gives me 1-2 readings then just hangs.

@voodootikigod
Copy link
Collaborator

Can you do me a favor and switch to using the raw process and send raw
packets back and forth with suffixing "\r" character to the transfer. I
would love to see if it is the printline code versus the SerialPort code
itself.

Thanks,

Chris

On Tue, Apr 26, 2011 at 1:28 PM, robotconscience <
reply@reply.github.com>wrote:

I'm having the same issue, both with 0.4.6 and 0.4.7 on OSX (10.6.7).
I have the newest FTDI drivers installed from the Arduino package, and have
tried doing both Serial.print(); and Serial.println();. Each only gives me
1-2 readings then just hangs.

Reply to this email directly or view it on GitHub:
#11 (comment)

Chris Williams
Twitter: http://twitter.com/voodootikigod

The things I make that you should check out:
OurParents: http://ourparents.com
PromoteJS: http://promotejs.com
JSConf US: http://jsconf.us
Minute With: http://minutewith.com
JSConf Live: http://jsconflive.com

@robotconscience
Copy link

Hi,

I'm having the same problem. Here's my arduino code (just sending a dummy
value for now):

void setup(){
Serial.begin(9600);
};

int inByte = 0;

void loop(){
Serial.print(inByte);
Serial.print('\r');
delay(500);
};

and then my js code:

var serialport = require("serialport");
var SerialPort = serialport.SerialPort; // localize object constructor
var sys = require("sys"), repl = require("repl");

var port = "/dev/tty.usbserial-A9005fr8";
//var port = "/dev/tty.usbserial-A6007zeJ"; // RFID reader

var serial_port = new SerialPort(port, {
baudrate: 9600,
parser: serialport.parsers.raw//,
//parser: serialport.parsers.readline("\n")
});

serial_port.on("data", function (data) {
console.log("new data");
sys.puts("here: "+data);
});

repl.start("=>");

On Apr 26, 2011, at 1:33 PM, voodootikigod wrote:

Can you do me a favor and switch to using the raw process and send raw
packets back and forth with suffixing "\r" character to the transfer. I
would love to see if it is the printline code versus the SerialPort code
itself.

Thanks,

Chris

On Tue, Apr 26, 2011 at 1:28 PM, robotconscience <
reply@reply.github.com>wrote:

I'm having the same issue, both with 0.4.6 and 0.4.7 on OSX (10.6.7).
I have the newest FTDI drivers installed from the Arduino package, and have
tried doing both Serial.print(); and Serial.println();. Each only gives me
1-2 readings then just hangs.

Reply to this email directly or view it on GitHub:
#11 (comment)

Chris Williams
Twitter: http://twitter.com/voodootikigod

The things I make that you should check out:
OurParents: http://ourparents.com
PromoteJS: http://promotejs.com
JSConf US: http://jsconf.us
Minute With: http://minutewith.com
JSConf Live: http://jsconflive.com

Reply to this email directly or view it on GitHub:
#11 (comment)

@pixelspark
Copy link

Might be related to the flaky FTDI drivers for OS X. I experienced panics when unplugging the FTDI device without properly closing the connection...

@robotconscience
Copy link

I've seen that as well... However, the main issue we're having is that it doesn't continuously read for some reason. We get one reading and then it just sits.

@lowjumpingfrog
Copy link

I am using a FTDI usb serial adapter on OSX and I saw the problems, mentioned above, using serialport on node.js .4.7 However, using v0.5.0-pre I was able to get a updating feed from the serial port using test_read.js
With that warm fuzzy I attempted to send the serial data to a web browser using web sockets I installed latest Socket.Io module.
My code is something like this ...

var http = require('http')
, url = require('url')
, fs = require('fs')
, io = require('../')
, sys = require(process.binding('natives').util ? 'util' : 'sys')
, SerialPort = require("/node_modules/serialport").SerialPort
, server;

server = http.createServer(function(req, res){
// your normal server code
}),
server.listen(8080);
var io = io.listen(server);

io.on('connection', function(client){
// Read from /dev/tty and send it to the browser.
var serial_port = new SerialPort("/dev/tty.usbserial-FTCYH5DD");

serial_port.on('error', function (exception) {
client.send({announcement: 'Exception: ' + exception});
});

serial_port.on('data', function (data) {
client.send({html: data});
});
});

When trying to run this:
$ sudo node server.js
17 May 13:56:00 - socket.io ready - accepting connections
17 May 13:56:12 - Initializing client with transport "websocket"
Assertion failed: (b[1] == 0), function DecodeWrite, file ../src/node.cc, line 1212.
Abort trap
It seems there is a problem with decoding the data? I am rather new at node.js Any ideas? Is there a different way to send serial data to the browser? My device is a GPS sending out text.

@soundanalogous
Copy link

@lowjumpingfrog
unfortunately there is a bug in the latest version of node.js for sockets so that's why you're getting this error: Assertion failed: (b[1] == 0), function DecodeWrite, file ../src/node.cc, line 1212. As you also discovered, serialport does not work in v0.4.7 (but sockets do). So until someone fixes the bug in the latest version, websockets and serialport won't work simultaneously.

@jamesduncombe
Copy link

Had the same issue here too on OSX 10.6.7, Node 0.4.7. I was trying to get updates from an Arduino but experienced the same pause after the first result.

I'll have a look at FTDI drivers and maybe rolling node back to 0.4.6.

@jamesduncombe
Copy link

Ok, I've just tried this with the Virtual Serial Port software (http://code.google.com/p/macosxvirtualserialport/) and that works fine so it does seem to be something to do with the FTDI drivers & Node. I tried updating those to the latest version (2.2.16) and tried again with the Arduino but still no luck. I'm going to try rolling back Node to check that next.

@jamesduncombe
Copy link

Got it working with Node v0.5.0-pre :)

So, just to confirm that's OSX 10.6.7, Node v0.5.0-pre, FTDI USB serial driver v2.2.16

@voodootikigod
Copy link
Collaborator

@robotconscience I finally got an arduino, can you try the following PDE: https://gist.github.com/1001784 and this JS file: https://gist.github.com/1001785

Thanks.

@jamesduncombe
Copy link

I think @soundanalogous is right. When I upgraded to node 0.5.0 pre it worked fine. I did also update my FTDI drivers but I think it was probably node.

@mbilokonsky
Copy link

I'm running into the same problem. I'm on OSX, latest version, new iMac less than two weeks old. I'm running a brand-new version of node (node -v tells me "v0.5.0-pre") and I just updated my FTDI drivers.

I have no problem reading/writing to my arduino board via a python script or via the Arduino IDE, so I don't think it's an FTDI issue.

@voodootikigod I looked at the gists you linked above and tried them out - what happens is, I get the first batch of data (a "0") and that traces out as expected - and then the application quits.

In an attempt to add some persistence, I added a standard basic http server to the same script. Now it no longer quits after outputting the data, but nothing else happens. It just sits there, and if I let it sit long enough it hangs in a way that won't let me kill it. Seemed to be immune even to sudo kill -9, so I rebooted. If, after a few seconds of inactivity I just ctrl-C it then it goes away just fine.

So, that sounds to me like maybe some kind of buffer overflow? The new data is being collected somewhere and it's just not coming out?

Any other information I can provide that might help you track this down?

@jamesduncombe
Copy link

That's very strange. When it happened with me it didn't quit, it just stopped.

You're right though, sounds like a buffer overflow or something...

@voodootikigod
Copy link
Collaborator

@mbilokonsky if it is quitting without an exception that means that the event loop has emptied. Any way I could ssh into your system? Ping me voodootikigod on any IM/IRC channel. Quick question are you running node as built from source?

@voodootikigod
Copy link
Collaborator

Can someone who has had/still has an issue with this please attempt installing these FTDI drivers: http://www.ftdichip.com/Drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_2_16.dmg and verify if the issue is still present. If it is please IM me directly so we can work to figure out what is going on and hopefully fix it. I am limited at this point as I have tried it on 4 different Macs (MacPro3,1, MacMini3,1, MacBookAir3,2, Latest MBP, MacMini2,1) and cannot for the life of me recreate.

I will buy a beer for the first to help out (when we are in proximity and I can purchase a beer or send you money).

@mbilokonsky
Copy link

I am out of town this week but I will give this a try over the weekend and get back to you!

Sent from my iPhone

On Jun 8, 2011, at 21:03, voodootikigodreply@reply.github.com wrote:

Can someone who has had/still has an issue with this please attempt installing these FTDI drivers: http://www.ftdichip.com/Drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_2_16.dmg and verify if the issue is still present. If it is please IM me directly so we can work to figure out what is going on and hopefully fix it. I am limited at this point as I have tried it on 4 different Macs (MacPro3,1, MacMini3,1, MacBookAir3,2, Latest MBP, MacMini2,1) and cannot for the life of me recreate.

I will buy a beer for the first to help out (when we are in proximity and I can purchase a beer or send you money).

Reply to this email directly or view it on GitHub:
#11 (comment)

@michaltaberski
Copy link

Hi,

I still got the same error, or I do something wrong. I already have installed FTDI...2_2_16, and node v0.4.8.

my JS code (coffeescript notation)

sys = require("sys")
repl = require("repl")

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

serial = new SerialPort "/dev/tty.usbmodem411"

serial.on "data", (data)->
  console.log 'event'
  console.log data

serial.on "error", (msg)->
  console.log "error: #{msg}" 

setInterval ()->
  console.log 'still alive'
, 1000

repl.start( "=>" )

and this is my Arduino code

float temp;

void setup() {
  Serial.begin(9600);
}

void loop () {
  temp = analogRead(0);
  Serial.println(temp);
  delay(1000);
};

I get just one on_data event in the begining, and nothing more, even if I send data every 1 s form Arduino.

My output looks like this:


<Buffer 78 80 80 00 80 80 78 00 80 00 80 78 00 80 78 78 80 78 f8 80 78 f8 80 80 78 00 80 00 80 78 00 80 78 00 80 78 78 80>
still alive
still alive
still alive
still alive

on Arduino's Serial Monitor works fine.

Any suggestion ?

@michaltaberski
Copy link

I tried once again to connect Arduino with node by node-serialport.

It seems there is a problem with Buffer.

When I run node, node-serialport recive just few first chars form serialport (each time different lenght). Even if I send new data every 5 seconds, the event "on data" is no triggerd anymore.

Below I include my coffee code.

PATH = "/dev/tty.usbmodem411"

serialport = require("serialport")
SerialPort = serialport.SerialPort
sys = require('sys')
repl = require("repl")

serialPort = new SerialPort PATH, {baudrate: 9600, parser: serialport.parsers.raw }

serialPort.on "data", (data)->
  console.log data
  console.log data.toString()


repl.start('=>')

and console output

tesla@mac-book ~/Sites/NodeJS/serial $ coffee serial.coffee 
=><Buffer 53 74 72 69>
Stri

=>tesla@mac-book ~/Sites/NodeJS/serial $ coffee serial.coffee 
=><Buffer 53 74 72 69 74 0a>
Strit

tesla@mac-book ~/Sites/NodeJS/serial $ coffee serial.coffee 
=><Buffer 53 74 65 73 74 0a>
Stest

tesla@mac-book ~/Sites/NodeJS/serial $ coffee serial.coffee 
=><Buffer 53 20 74 65 73 74 0a>
S test

=>tesla@mac-book ~/Sites/NodeJS/serial $ coffee serial.coffee 
=><Buffer 73 74 0a>
st

tesla@mac-book ~/Sites/NodeJS/serial $ coffee serial.coffee 
=><Buffer 53 74>
St

@voodootikigod
Copy link
Collaborator

Author:

Please stop adding +1 comments without providing OSX Version, FTDI Driver Version, Laptop Model and Arduino board model. It is working on OS X for certain cases and the issue is not the serial port code, its the node.js event loop not seeing the read hook. I am working to identify and resolve, but need specifics not "doesn't work for me". Keep nerding!

@michaltaberski
Copy link

** My setup: **
Mac BookPro 13" Mid 2009
Mac OS X 10.6.7
Arduino UNO
Node.js v0.4.8
serialport@0.2.4

about FTDIUSBSerialDriver is a bit strange, because I installed this one: http://www.ftdichip.com/Drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_2_16.dmg
but when I run script

#!/bin/sh
#
# Report information about the FTDI USB serial driver
#
echo "[Extensions]"
for KEXT in `ls -d /System/Library/Extensions/*FTDI*` ; do
    echo $KEXT
    find "$KEXT" -name InfoPlist.strings -exec cat {} \;
done

echo "[Devices]"
ls /dev/*usb*

echo "[System logs]"
bzgrep FTDI /var/log/system.log* 

I get

[Extensions]
/System/Library/Extensions/FTDIUSBSerialDriver.kext
??/* Localized versions of Info.plist keys */

CFBundleName = "FTDIUSBSerialDriver";
CFBundleShortVersionString = "2.2.14";
CFBundleGetInfoString = "2.2.14, Copyright (c) 2005-2009  FTDI Ltd.";
NSHumanReadableCopyright = "Copyright (c) 2005-2009  FTDI Ltd.";
[Devices]
/dev/cu.usbmodem411 /dev/tty.usbmodem411

voodootikigod pushed a commit that referenced this issue Jun 27, 2011
… conditions for all code samples from ticket #11.
@voodootikigod
Copy link
Collaborator

If you were having this issue, please test now with version 0.2.5 on node version 0.4.8. Version 0.2.5 is the current version available in NPM. There is a known issue with node version 0.5.0-pre which is awaiting for 0.5.0 to stabilize before changing to handle. Please post if it works OR if it does not work.

@mbilokonsky
Copy link

Using node 0.4.8 and using a freshly installed instance of node-serialport from NPM I'm still getting the exact same issue - it'll spit out the first value then quit. O_o

my_mac:NewTest mykola$ node -v
v0.4.8
my_mac:NewTest mykola$ node test.js
new data
here: 0
my_mac:NewTest mykola$

@voodootikigod
Copy link
Collaborator

Converted from node.js IOWatcher to node.js fs.ReadStream. Please test on your local systems version 0.2.6 if all good will rev up to 0.3.0.

@mbilokonsky
Copy link

That seems to have fixed it for me! Thanks man!

@voodootikigod
Copy link
Collaborator

I am closing this ticket until/unless someone comes forward expressing that 0.2.7 doesn't fix their issue.

@baiej214
Copy link

Can run on Windows?
Or can you let it do that?
Thanks.

@lock lock bot locked and limited conversation to collaborators Apr 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

10 participants