Reply
Posts: 4
Registered: ‎07-23-2013

USBXpress are per character read/write timeouts available

It appears that Si_SetTimeouts() specifies timeouts for the entire transfer. Is it possible to set a re-triggerable per-character timeout? For example, at 9600baud, a 50 character read will take at least 50mSec. I would like to keep reading as long as characters are available, but return if there is a 10 mSec gap.
Posts: 525
Registered: ‎10-12-2004

Re: USBXpress are per character read/write timeouts available

Hi wrl,

You are correct. The timeouts with USBXpress are transfer-based, and if the entire transfer doesn't complete in the allotted time, then the transfer will time out. USBXpress does not have a character-by-character timeout feature since the USB packets are always received 64 bytes at a time.

On the CP210x side, the device will send an incomplete (i.e. less than 64 bytes) packet to the host if there is a long enough delay between characters. The timeout length is 1 ms or (18/BaudRate), whichever is shorter.

Regards,
~Tabi
Tabitha Parker
MCU Applications and Support Manager
Silicon Laboratories
Posts: 4
Registered: ‎07-23-2013

Re: USBXpress are per character read/write timeouts available

Tabi,

Thank you. I've been able to approximate the desired behavior by performing a series of shorter reads (with shorter timeout) instead of one longer one.
Less efficient, but at 19200, CPU load is still negligible.
Highlighted
Posts: 525
Registered: ‎10-12-2004

Re: USBXpress are per character read/write timeouts available

You're welcome! =)

~Tabi
Tabitha Parker
MCU Applications and Support Manager
Silicon Laboratories