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

modbus - baudRate 115200 - does not work #561

Open
robert-beecloud opened this issue Aug 12, 2024 · 2 comments
Open

modbus - baudRate 115200 - does not work #561

robert-beecloud opened this issue Aug 12, 2024 · 2 comments

Comments

@robert-beecloud
Copy link

robert-beecloud commented Aug 12, 2024

Hi,
node-modbus-serial works only when baudRate is 9600.
When I change it to 19200 or 115200 - it does not work :(

It is very important for my project. Serial port is working with my NFC card reader on 115200 and I need to connect to my diagnostic tool over modbus with the speed higher then default: 9600.

My simple code below. I tested it also with serialPort object and without it

var {SerialPort} = require("serialport");
var serialPort = new SerialPort({ path: "/dev/ttymxc2", baudRate: 115200, autoOpen: false});

// create an empty modbus client
var ModbusRTU = require("modbus-serial");
var client = new ModbusRTU(serialPort);

// open connection to a serial port
//client.connectRTUBuffered('/dev/ttymxc2', { baudRate: 9600}, run);

client.open(run);

function run() {
client.setID(1);
if (client.isOpen)
client.readInputRegisters(0, 10, function(err, data) {
if (err) {
console.log(err);
}
else {
console.log(data.data);
}
});
}
setInterval(run, 1000);

Thanks for any help!

@yaacov
Copy link
Owner

yaacov commented Aug 12, 2024

Hi, thank you for the issue, I added a help wanted flag so people that may help will know to look here

@robert-beecloud
Copy link
Author

Hi,
I have tested my configuration and I solved it!
node-mobus-serial is not a problem - it works perfect ;)
Problem was with USB-RS485 converter!
Everybody should know that working with USB-RS485 converter for 5 USD is not a good idea.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants