FTDI Community
General Category => General Discussion => Topic started by: Arsen on March 13, 2024, 04:42:29 am
-
while(1)
for (int i = 0; i < configurationDescriptor.bNumInterfaces; i++) {
FT_GetInterfaceDescriptor(HandleFtdi, i, pInterfaceDescriptor + i);
for (int j = 0; j < pInterfaceDescriptor.bNumEndpoints; j++) {
res = FT_GetPipeInformation(HandleFtdi,i,j, &pipeInformation);
if (res != FT_OK) {
cout << "FT_GetPipeInformation Error!";
} else {
if (!(pipeInformation.PipeId & 0x80)) {
res = FT_WritePipe(HandleFtdi, pipeInformation.PipeId, bufWr, pipeInformation.MaximumPacketSize, &ulBytesTransferred, NULL);
if (res != FT_OK) {
cout << "FT_WritePipe Error " ;
}
}
else {
res = FT_ReadPipe(HandleFtdi, pipeInformation.PipeId, bufRd, pipeInformation.MaximumPacketSize, &ulBytesTransferred, NULL); //second time this function does not return. Why? The first time it returns by timeout.
if (res != FT_OK) {
cout << "FT_ReadPipe Error " ;
}
}
}
}
}
Hi all. Please, say Me.
This part of the program works well, but on the second pass, when FT_ReadPipe is executed, the program freezes and does not return after timeout. The first time it returns by timeout (default 5 seconds).
In addition, I want to say that we made a USB device with FT600 and STM. But the STM is not running yet and is not writing to the FT600 buffer, so it's good that FT_ReadPipe is returning after a timeout. But why doesn’t it return the second time but freezes?
Thank everybody.
-
Hi,
Have a look at section 3.2 of AN_412 FT600/FT601 Bridge Chips Integration (https://ftdichip.com/wp-content/uploads/2020/08/AN_412_FT600_FT601-USB-Bridge-chips-Integration.pdf), this goes over the abort recovery process.
Any error or timeout requires this abort process before resuming the read/write.
Best Regards
FTDI Community
-
Thank you very much for Your reply.