We have a device attached to an FT232. FTDI driver version 2.12.28. Using D2XX with communication parameters:
- FT_SetUSBParameters 2048, 2048
- FT_SetBaudRate 921600
- FT_SetDataCharacteristics 8, 2, 0
- FT_SetFlowControl 0, 0, 0
- FT_SetLatencyTimer 2
We have been using the same code for over 10 years in production, over a hundred deployments. Recently on one device we were having a problem with communication stalling: we call FT_write and it does not return, for minutes, until unplugging the cable. After plugging back in things work normally again. Reason yet unknown; given the age of both the device and the FTDI chip (about 7 years we guess) we assume wear in a cap's value or so, hard to tell and not worth yet investigating.
The stalling is problematic though, the software should just report an error and retry the connection. So we added a call to FT_SetTimeouts configuring 10000mSec timeout. This approach works so now FT_write returns after 10 seconds when the problem occurs.
However FT_purge still has the same problem: it stalls and just doesn't return until unplugging the cable.
I couldn't find a documented remedy for that. Is there a way to setup a timeout for FT_purge, or another software solution which makes it not stall?
Thanks in advance!