Giter Club home page Giter Club logo

Comments (32)

voodootikigod avatar voodootikigod commented on May 21, 2024

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 <
[email protected]>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

from node-serialport.

santiago avatar santiago commented on May 21, 2024

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.

from node-serialport.

voodootikigod avatar voodootikigod commented on May 21, 2024

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

On Mon, Apr 18, 2011 at 11:22 PM, santiago <
[email protected]>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

from node-serialport.

santiago avatar santiago commented on May 21, 2024

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

from node-serialport.

voodootikigod avatar voodootikigod commented on May 21, 2024

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 <
[email protected]>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

from node-serialport.

robotconscience avatar robotconscience commented on May 21, 2024

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.

from node-serialport.

voodootikigod avatar voodootikigod commented on May 21, 2024

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 <
[email protected]>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

from node-serialport.

robotconscience avatar robotconscience commented on May 21, 2024

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 <
[email protected]>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)

from node-serialport.

pixelspark avatar pixelspark commented on May 21, 2024

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

from node-serialport.

robotconscience avatar robotconscience commented on May 21, 2024

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.

from node-serialport.

lowjumpingfrog avatar lowjumpingfrog commented on May 21, 2024

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.

from node-serialport.

soundanalogous avatar soundanalogous commented on May 21, 2024

@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.

from node-serialport.

jamesduncombe avatar jamesduncombe commented on May 21, 2024

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.

from node-serialport.

jamesduncombe avatar jamesduncombe commented on May 21, 2024

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.

from node-serialport.

jamesduncombe avatar jamesduncombe commented on May 21, 2024

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

from node-serialport.

voodootikigod avatar voodootikigod commented on May 21, 2024

@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.

from node-serialport.

jamesduncombe avatar jamesduncombe commented on May 21, 2024

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.

from node-serialport.

mbilokonsky avatar mbilokonsky commented on May 21, 2024

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?

from node-serialport.

jamesduncombe avatar jamesduncombe commented on May 21, 2024

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...

from node-serialport.

voodootikigod avatar voodootikigod commented on May 21, 2024

@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?

from node-serialport.

voodootikigod avatar voodootikigod commented on May 21, 2024

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

from node-serialport.

mbilokonsky avatar mbilokonsky commented on May 21, 2024

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, [email protected] 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)

from node-serialport.

michaltaberski avatar michaltaberski commented on May 21, 2024

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 ?

from node-serialport.

michaltaberski avatar michaltaberski commented on May 21, 2024

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

from node-serialport.

voodootikigod avatar voodootikigod commented on May 21, 2024

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!

from node-serialport.

michaltaberski avatar michaltaberski commented on May 21, 2024

** My setup: **
Mac BookPro 13" Mid 2009
Mac OS X 10.6.7
Arduino UNO
Node.js v0.4.8
[email protected]

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

from node-serialport.

voodootikigod avatar voodootikigod commented on May 21, 2024

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.

from node-serialport.

mbilokonsky avatar mbilokonsky commented on May 21, 2024

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$

from node-serialport.

voodootikigod avatar voodootikigod commented on May 21, 2024

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.

from node-serialport.

mbilokonsky avatar mbilokonsky commented on May 21, 2024

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

from node-serialport.

voodootikigod avatar voodootikigod commented on May 21, 2024

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

from node-serialport.

baiej214 avatar baiej214 commented on May 21, 2024

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

from node-serialport.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.