-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Parity Error Under Linux #219
Comments
Do you have a suggested patch? What is the hardware environment you're using to monitor? Looks like you're using a protocol analyzer? |
Yes, I hardwired to computer's serial port and I am using a protocol analyzer. I am pretty sure about the result. I am electronics engineer using such measurement tools long time. http://www.saleae.com/logic I have also looked at tests included in source. They use parity 'none'. I think echo test will fail when 'even' parameter is selected. |
This should fix it: #220 |
Can you verify this with the latest 1.2.1 release? |
I have got some unexpected results at first sight. I will share my feedback after further investigation. |
Please find my latest test results below. This is latest version 1.2.2 I matched Windows version with Linux version. Windows version produces all results correctly. It looks like setting parity has effect on databits. Before releasing a new version, if you need me to test, I would gladly contribute to the project. |
@ergousha how did you generate those graphs? |
Results measured with logic analyser hardware connected to computer's serial port. Then this measurements interpereted when I enter expected parameters, so it tries data to split into frames and shows errors. |
yes i find this bug last year. |
We are aware of the issue, we are working on a fix that doesn't break On Thu, Oct 31, 2013 at 10:49 AM, qindl [email protected] wrote:
Chris Williams @voodootikigod http://twitter.com/voodootikigod | The things I make that you should check out: Help me end the negativity on the internet, share |
@ergousha can you try out this branch: https://github.com/voodootikigod/node-serialport/tree/databits Thank you, |
The new branch gives an error at the serial port opening. (even with default opening parameters) events.js:72 |
Can you please provide the code snippet you are using? I am not seeing Thank you, On Sun, Nov 3, 2013 at 4:29 AM, Ergin Akin [email protected] wrote:
Chris Williams @voodootikigod http://twitter.com/voodootikigod | The things I make that you should check out: Help me end the negativity on the internet, share |
var serialport = require("serialport"); var SerialPort = serialport.SerialPort; var sp = new SerialPort("/dev/ttyAMA0"); sp.on("open", function () { sp.close(); Or var serialport = require("serialport"); var SerialPort = serialport.SerialPort; var sp = new SerialPort("/dev/ttyAMA0", { sp.on("open", function () { sp.close(); |
Move the close into the .on open callback and it will work fine On Sunday, November 3, 2013, Ergin Akin wrote:
Chris Williams @voodootikigod http://twitter.com/voodootikigod | The things I make that you should check out: Help me end the negativity on the internet, share |
I confirm that problem is fixed 👍 Tested under Linux with 19600 baud rate. |
parity: "even" ERROR ;could not used log: readtest.js code: var portName = '/dev/ttyS3'; serial_port.on("open", function () { serial_port.on("data", function (data) { serial_port.on("error", function (msg) { |
Merged in. @robinxc looks like an error in your code. |
what error? show me :) |
My declared problem solved by databits branch. |
I am using this simple code to send a byte through serialport. And I watch the result with a logic analyser hardware. As it seems below, same code produces expected correct result under Windows, but it gives a parity error under Linux (Raspberry Pi)
I intended to use 'even' parity which is apparently the problem. Windows version interprets correct, but Linux version fails and using default value 'none'.
When I use parity default value 'none' I got same result for both Windows and Linux.
var sp = new SerialPort('/dev/ttyAMA0', {
baudRate: 19200,
dataBits: 8,
parity: 'even',
stopBits: 1,
flowControl: false
});
var serialBuffer = new Buffer([0x01]);
sp.write(serialBuffer);
The text was updated successfully, but these errors were encountered: