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

support 921600 baudrate #176

Open
alonarbel opened this issue Nov 27, 2024 · 2 comments
Open

support 921600 baudrate #176

alonarbel opened this issue Nov 27, 2024 · 2 comments

Comments

@alonarbel
Copy link

alonarbel commented Nov 27, 2024

Hi,
We are using the library in our application and have encountered an issue. Our devices operate at a baud rate of 921600, but it seems that the maximum baud rate supported by the library is 256000.
When we attempt to send long commands at 921600 baud, the commands are being truncated. We suspect this might be due to a buffer overflow.
Could you please confirm if this is the case and let us know if it's possible to address this issue? Your assistance would be greatly appreciated.
Thank you!

Edit: as mentioned in #177 this issue as reported occurs on Windows.

@hiddenalpha
Copy link

hiddenalpha commented Nov 28, 2024

Having a look into jssc code, to me it seems that the underlying implementations already support 921600 (see the two jssc.cpp files). There is just no constant defined on java side for it.

Maybe it's worth a try to pass the baud rate as a naked int. But make sure to check the returned value for errors. Maybe this could give us a hint. Disclaimer: I did not try this myself ever. So I do not know if this works.

boolean ok;
ok = serialNativeInterface.setParams(
    handle, 921600, dataBits, stopBits, parity, setRTS, setDTR, flags);
if( !ok ){
    whops();
}

I don't know about the described truncation issue.

@tresf
Copy link

tresf commented Dec 1, 2024

Maybe it's worth a try to pass the baud rate as a naked int. But make sure to check the returned value for errors. Maybe this could give us a hint. Disclaimer: I did not try this myself ever. So I do not know if this works.

Just updating this thread with information gathered from #177, quoting:

... we [do] use [the] setParam function and provide any baud rate parameter they choose, not just the predefined ones in [this] library.

However, we've encountered an issue when users send very long commands (via the writeBytes function) at 921600 baud. The commands are being truncated even if they use rts/cts flow control.(when the command are with regular size the command are sent fine, for example a command that truncated has 980 characters).
Our OS is windows.

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

No branches or pull requests

3 participants