-
Notifications
You must be signed in to change notification settings - Fork 128
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
Serial port doesn't properly open on Windows 11 #204
Comments
I've noticed this issue does not happen on Linux |
Hello @danijourdain, at a first glance it might be the case that the data gets written from the applications perspective and just not makes it onto the serial wire. Just writing and closing the serial port (by dropping it at the end of
Sounds likely as Linux cares very much for getting your data on the wire is this scenario ( |
Hi @sirhcel. Thank you so much for your quick response. Neither of those suggestions ended up working. However, I did end up finding a solution! Adding this line along with a delay seems to do this trick. port.write_data_terminal_ready(true)?;
std::thread::sleep(Duration::from_millis(1500)); |
Great to hear that you managed to resolve this issue on your own! In my bubble a serial interface is often just RX/TX and I would have expected the same for an Arduino device. Just for curiosity: How does your serial setup/wiring look like? Are you using a UART with all the control lines? Or a USB serial stack on the Arduino device? |
I'm using a Teensy4.1 running Teensyduino to appear and behave as an Arduino device. I wonder if that's part of the strange behaviour. I didn't have an Arduino available to confirm that unfortunately. I'm using the microUSB port included on the Teensy for all data being sent by the computer. I have a UART to USB converter that I connect to the control pins for Serial1 on the Teensy to use for debugging/extra logging info in more complicated applications. |
I'm writing a program to communicate with an Arduino over a serial port. Immediately after flashing the Arduino or plugging it into a computer my Rust code doesn't actually open the serial port. The code runs without error but I receive nothing from the Arduino.
Here is the Arduino code. It should just echo back what I'm writing into Serial1, which I am monitoring using TeraTerm.
And here is the Rust code I'm using.
When I run the Rust code, it executes successfully but I see nothing on TeraTerm. When I write to the serial port using Arduino's serial monitor or a Python script the expected output is seen on TeraTerm. I've also tried using
.open()
instead of.open_native()
as well as using "COM10" instead of "\.\COM10".If I open the serial port using some other method (Arduino IDE, Python, etc.) and then run the Rust code, it works as intended. Is there a way I can get it to work in Rust without opening the port some other way first?
The text was updated successfully, but these errors were encountered: