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

Windows serial data issues #1291

Closed
kealist opened this issue Aug 8, 2017 · 10 comments
Closed

Windows serial data issues #1291

kealist opened this issue Aug 8, 2017 · 10 comments

Comments

@kealist
Copy link
Contributor

kealist commented Aug 8, 2017

  • SerialPort Version: 6.00beta1 & 5.00

  • NodeJS Version: v6.11.2

  • Operating System and Hardware Platform: Windows 10 64 bit

  • Have you checked the right version of the api docs?: yes

  • Are you having trouble installing and you checked the Installation Special Cases docs? no

  • Are you using Electron and have you checked the Electron Docs?: no

Summary of Problem

I think I was actually using a previous version (don't know #) of the module that had worked, but on starting over with the new beta, I'm seeing some bizarre data coming through. I am working with a robot, but I use an Arduino + LCD to see what data actually comes out. With whichever previous version, this appeared to be working fine, but after updating, now getting some weird issues. Upon opening the serial port. I automatically get two bytes sent out: 0xFEFE.

Steps and Code to Reproduce the Issue

The following sends out 0xFEFE to my Arduino (I haven't written anything to the serial port):

var SerialPort = require('serialport');
// callback approach

var sp = new SerialPort('COM5',{
    baudrate: 57600,
    dataBits: 8,
    stopBits: 1,
    hupcl: false,
    parity: 'none'
}, function (err){if (err){return console.log('Error: ' + err.message)}});

The following script outputs 0xFEFEE0:

var SerialPort = require('serialport');
// callback approach

const dataToSend = Buffer.from([0x81, 0x84]);

var sp = new SerialPort('COM5',{
    baudrate: 57600,
    dataBits: 8,
    stopBits: 1,
    hupcl: false,
    parity: 'none'
}, function (err){if (err){return console.log('Error: ' + err.message)}});


sp.write(dataToSend, function (err, result) {
  if (err) {
      console.log('Error while sending message : ' + err);
  }
  if (result) {
      console.log('Response received after sending message : ' + result);
  }
  console.log('message written');
});

I'm not sure which functional version I was using before I updated, but seems from the issues list that many folks have been having trouble with Windows serial comms.

@reconbot
Copy link
Member

reconbot commented Aug 9, 2017

Windows has been troublesome over the years but it's in good shape. serialport@4 would be the last major version before some of the recent cleanup. Can you see if something has regressed between the two versions?

@kealist
Copy link
Contributor Author

kealist commented Aug 9, 2017

Do you have serial devices you are controlling from the Windows side on v 5 or 6?

@reconbot
Copy link
Member

reconbot commented Aug 9, 2017

Yeah, an arduino and a log of people tested v5 on all sorts of stuff. - Some stuff changed some stuff between v5 and the v6 beta with regards to open options. #1277

@kealist
Copy link
Contributor Author

kealist commented Aug 9, 2017

Yes, I was the one who made the changes.

@reconbot
Copy link
Member

reconbot commented Aug 9, 2017

Oh duh, sorry I was deep into support mode. There are no writes being made for an open call, nothing that should be sending 254, 254, but we do perform some operations (eg flush) on the port as part of the setup. Testing with 4x would be helpful because only a few things would have changed between the the two versions in our c++ open code.

@reconbot
Copy link
Member

reconbot commented Aug 9, 2017

And for the record our integration tests work with any arduino and will echo data through the ports and test reading and writing in a few different ways. I'm happy to expand how that's tested.

I don't know if you have an arduino handy but reproducing the issue on one of those (make sure to load arudino-echo.ino from this repo) would also help shed some light on the bug you're hitting.

@reconbot
Copy link
Member

Would you be able to test with serialport@beta (the soon to be 6x release)? The windows read/write subsystem has been rewritten and is in much better shape, pulls much less cpu, and we'd like to get some feedback on it so we can cut a release.

@reconbot
Copy link
Member

reconbot commented Sep 24, 2017

I figured it out baudrate needs to be camel case, I'm going to add a throw when that happens.

@kealist
Copy link
Contributor Author

kealist commented Oct 19, 2017

I know this was closed for a while, but I finally found my lost arduino. I have this working now on v6, so thank you.

@reconbot
Copy link
Member

Glad it worked out

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

No branches or pull requests

2 participants