Hey ![]()
I got an Arduino Uno connected via USB to my Windows PC.
To identify the correct COM-Port to which my device is connected I send a certain "Identify-yourself"-byte via serial to all COM-Ports in series and wait a certain amount of time for an answer.
For this, the serial port is opened, the byte is sent and the PC waits 50msec for an answer byte.
With C# that was a procedure of milliseconds, opening the port, sending identify-request, arduino sends identifier back. All fine.
Due to several reasons I am forced to port my code to Java. I wrote nearly the same procedure (Java and C# are pretty similar) using the jSerialComm-library for serial connection.
After several hours of debugging I found out, that every time the Java serial port is opened on the correct COM-Port, the Arduino resets and takes 2 seconds before it is able to receive any identify-request, this definitely doesn't happen with C#.
I was able to fix this by just waiting, but with 3 COM Ports this already means 6 seconds+ on startup.
And as already mentioned, due to my prior experience with C#, I know that this time is not necessary. >:(
Both programs work with the exact same serial parameters:
Baudrate: 57600
Stop Bit: 1
Data Bits: 8
Parity: none
and finally: all Flow Control (especially DSR) - disabled
Much results when searching the internet point to an enabled DSR or other flow control mechanisms, but as said, every settable parameter is the same for C# and java and flow control is disabled (as far as I can see that)
Yes, it would be possible to connect the Reset Pin to GND with a capacitor and yes, this is not very hard to manage, but I don't want to do this if there is a software-based solution.
If anyone ever solved this problem, I would appreciate your help ![]()
Best Regards
PS: I don't think code is necessary here, as there are only 3 lines in C# and 4 in java (due to the sleep-call) and the Arduino sketch has nothing to do with the problem, on startup it just does "Serial.begin(57600)". If code could help, I can post it later.