FTDI Community

General Category => Discussion - Software => Topic started by: Josiah on April 22, 2021, 10:23:15 AM

Title: Software hangs at FT_AbortPipe or FT_Close after FT_ReadPipeEx - FT60X
Post by: Josiah on April 22, 2021, 10:23:15 AM
Good day,
I am developing a high-speed USB 3 continuous data READ application using FTDI D3XXX Library.  The application is multi-threaded, with one thread ('FTDIDataStreamer' class) solely responsible for reading in the USB packets.  Briefly the logic of the class is as follows:

Initialization:
1. FT_Create
2. FT_InitializeOverlapped on 4096 buffers
3. FT_SetStreamPipe on 0x82
4. Queue up initial batch of requests: FT_ReadPipeEx 4096 buffers each with a size of 8192 bytes

Execution (continuous loop over 4096 buffers):
1. FT_GetOverlappedResult
2. If (1) was successful and 8192 bytes were read, then resubmit on specific buffer to keep requests full: FT_ReadPipeEx.

Clean-up:
1. If FT_Status is FT_IO_PENDING, then FT_GetOverlappedResult otherwise FT_AbortPipe
2. FT_ClearStreamPipe on 0x82
3. FT_ReleaseOverlapped on all 4096 buffers
4. FT_Close


Now the problem I have is that the thread fails to quit because it gets stuck/hangs indefinitely at either line 1 (FT_GetOverlappedResult or FT_AbortPipe) or line 4 (FT_Close) in the Clean-up stage.  This happens regardless of whether it enters the Execution stage or not.  After debugging I realized that this happens when FT_ReadPipeEx is called in either the Initialization stage or the Execution stage.  Once this happens, the only way I get the thread to quit is if I unplug the USB3 FTDI device, which is bad and not ideal for my application.

Any idea what the issue might be?  Any help would be appreciated.

Kind regards,
Josiah

Title: Re: Software hangs at FT_AbortPipe or FT_Close after FT_ReadPipeEx - FT60X
Post by: j.pflaum on July 21, 2021, 12:29:47 PM
Hello Josiah,

I might have the same problem and cannot resolve it.
Did you find a solution and may you share it, please?

Thank you and best regards,
Johannes