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

Invalid stop bits setting encountered #41

Open
chenxuuu opened this issue Aug 29, 2023 · 4 comments
Open

Invalid stop bits setting encountered #41

chenxuuu opened this issue Aug 29, 2023 · 4 comments

Comments

@chenxuuu
Copy link

chenxuuu commented Aug 29, 2023

let mut rx = serialport::new(&args.port, args.baud_rate).open_native_async()?;

error on this line

Error: Custom { kind: Other, error: "Invalid stop bits setting encountered" }

some software serialport doesen't support this (like esp32c3's usb software serialport)

I change that line code to this, then it's ok

let stop_bits = port.stop_bits().unwrap_or(StopBits::One);
@DerAndereJohannes
Copy link

I am getting the same sort of error, but for the DataBits rather than the stop bit. It only happens on my Windows PC though and the current solution works great on my linux machine. I posted something similar to this issue over on tokio-serial too (berkowski/tokio-serial#71). With your suggestion (just putting it on the data_bits), I managed to get this to work too.

I feel like a quick and dirty solution for this would be to keep the builder within the SerialStream struct and do an .unwrap_or(...) for each of the variables afterwards. Thoughts?

@chenxuuu
Copy link
Author

I no longer use this library. I still use the blocking library serialport.😂

many software serialports(emulate by mcu/soc) are very strange on windows.

@DerAndereJohannes
Copy link

Ah I see! May I ask how you are using the serial port? For me I have a signal of around 1Hz and I need my program to react to it with minimal latency (hence why I am interested in async to get around wasting a core). The example here with your changes and a buffer of 1 seems to be doing the job well enough, but I do question the reliability based on your comment.

Since we are on windows, would you recommend me to use some C# tooling instead? Or does that not matter?

Thank you for your time.

@Skgland
Copy link

Skgland commented Jun 18, 2024

Might be related to serialport/serialport-rs#195, as 1.5 stop bits appears to be currently not supported, maybe it somehow ends up with 1.5 stop bits?

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