I have run into the same issues as mentioned in this thread:
https://forum.pjrc.com/threads/3198...ransfer-over-USB?p=90685&viewfull=1#post90685
It is more critical for my use case to have complete and reliably transferred messages, than keeping up the speed at all costs. With lost or garbled messages I need to add additional error checking, and the protocol becomes a lot more complex.
Reliable message delivery also allows to convey "type" information by using the order in which it arrives. Think of structs/arrays.
This also allows an implicit flow control, because essentially data is sent as fast as possible from both sides, but if buffers are full/one side does not respond fast enough, the stalling automatically slows down the sender as needed.
Suggestion:
There are already settings for the baud rate. There could be an overload of Serial.begin() that can set TX_TIMEOUT in usb_serial.c (making it a variable instead of a constant), and additionally a parameter/flag/option to disable the timeout completely.
Disabling it would be equivalent to disabling the lines quoted in the above post:
Similarily, it would be very useful if the timeout or blocking behavior for Serial.readBytes() and related reading functions could be set.
https://forum.pjrc.com/threads/3198...ransfer-over-USB?p=90685&viewfull=1#post90685
It is more critical for my use case to have complete and reliably transferred messages, than keeping up the speed at all costs. With lost or garbled messages I need to add additional error checking, and the protocol becomes a lot more complex.
Reliable message delivery also allows to convey "type" information by using the order in which it arrives. Think of structs/arrays.
This also allows an implicit flow control, because essentially data is sent as fast as possible from both sides, but if buffers are full/one side does not respond fast enough, the stalling automatically slows down the sender as needed.
Suggestion:
There are already settings for the baud rate. There could be an overload of Serial.begin() that can set TX_TIMEOUT in usb_serial.c (making it a variable instead of a constant), and additionally a parameter/flag/option to disable the timeout completely.
Disabling it would be equivalent to disabling the lines quoted in the above post:
Code:
if (++wait_count > TX_TIMEOUT || transmit_previous_timeout) {
transmit_previous_timeout = 1;
return -1;
}
Similarily, it would be very useful if the timeout or blocking behavior for Serial.readBytes() and related reading functions could be set.