Fazecast/jSerialComm

Unexpected timeout (500-1000ms+) in sending bytes

arstagaev opened this issue · 1 comments

Hello!

I have unexpected timeout (500ms+) in sending bytes. When I use function writebytes() i have delay/timeout, but I did`t set this in my kotlin/java code. Example of my code:

var serialPort: SerialPort = SerialPort.getCommPort("COM10")
serialPort.setComPortParameters(500000,8,1, SerialPort.NO_PARITY)
serialPort.setComPortTimeouts(SerialPort.TIMEOUT_NONBLOCKING, 0, 0)
serialPort.openPort()

val send = byteArrayOf(0x71,0xFF.toByte(), 0x00,0x00, 0x00,0x00, 0x00,0x00)
serialPort.writeBytes(send,send.size.toLong())

I defined that delay by LED of my electronic board. And another program in C# send bytes without delays to same electronic board. I have equal baudrates in electronic board and in my program java/kotlin code

My PC config: Windows 10, x64, 4GB RAM. Version of lib: jSerialComm v2.9.3

How can I fix that?

I solve this issue: just use callback for get bytes instead of using blocking function. And also I have problem with my serial-bytes protocol