mio-serial
mio-serial copied to clipboard
Invalid stop bits setting encountered
let mut rx = serialport::new(&args.port, args.baud_rate).open_native_async()?;
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);
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?
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.
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.
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?