- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a problem in using the CCyIsocEndPoint->XferData for a low-latency loopback application.
Basically I want to measure the loop latency in a FX3 device with the USBIsochLoopAuto firmware.
#include "CyAPI.h"
int main() {
CCyUSBDevice *USBDevice = new CCyUSBDevice();
CCyIsocEndPoint *IsoIn = USBDevice->IsocInEndPt;
CCyIsocEndPoint *IsoOut = USBDevice->IsocOutEndPt;
if (!IsoIn) { std::cout << "Failed to get IsocInEndPt\n"; return 1; }
if (!IsoOut) { std::cout << "Failed to get IsocOutEndPt\n"; return 1; }
const int bufSize = 8;
LONG outbufLen;
UCHAR outbuf[bufSize];
LONG inbufLen;
UCHAR inbuf[bufSize];
CCyIsoPktInfo *isoOutPktInfos;
CCyIsoPktInfo *isoInPktInfos;
int pkts;
isoOutPktInfos = IsoOut->CreatePktInfos(bufSize, pkts);
isoInPktInfos = IsoIn->CreatePktInfos(bufSize, pkts);
std::cout << "IsoOut->MaxPktSize: " << IsoOut->MaxPktSize << "\n";
std::cout << "Allocated packets: " << pkts << "\n";
// THIS WORKS:
strcpy_s((char*)outbuf, bufSize, "hello");
outbufLen = bufSize;
inbufLen = bufSize;
IsoOut->XferData(outbuf, outbufLen, isoOutPktInfos);
IsoIn->XferData(inbuf, inbufLen, isoInPktInfos);
std::cout << "Transferred out: " << outbufLen << ", in: " << inbufLen << "\n"; // Always bufSize
std::cout << "isoOutPktInfos.Status: " << isoOutPktInfos->Status << "\n"; // Always 0
std::cout << "isoOutPktInfos.Length: " << isoOutPktInfos->Length << "\n"; // Always bufSize
std::cout << outbuf << " -> " << inbuf << "\n"; // Everything ok
// THIS DOES NOT WORK:
strcpy_s((char*)outbuf, bufSize, "world");
outbufLen = bufSize;
inbufLen = bufSize;
IsoOut->XferData(outbuf, outbufLen, isoOutPktInfos);
IsoIn->XferData(inbuf, inbufLen, isoInPktInfos);
std::cout << "Transferred out: " << outbufLen << ", in: " << inbufLen << "\n"; // Often 0, sometimes strange values
std::cout << "isoOutPktInfos.Status: " << isoOutPktInfos->Status << "\n"; // Often 0, Sometimes 67, 4390979, ...
std::cout << "isoOutPktInfos.Length: " << isoOutPktInfos->Length << "\n"; // Often bufSize, Sometimes 67, 4390973, ...
std::cout << outbuf << " -> " << inbuf << "\n"; // inbuf unchanged!
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I could reproduce the mentioned issue using the code snippet that you have shared. There seems to be an issue when two consecutive ISOC transfer requests are issued in quick succession to the endpoint. The issue is not seen when a Sleep(1500); statement is added after the first data word "hello' is transferred.
The issue is also seen on Control Center application. I shall dig more and let you know the possible cause of this issue.
Best regards,
Srinath S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks,
I can add that the first transfer may also fail if we set a larger value for const int bufSize.
Sleeping will not be an option since the usecase is a streaming low-latency (low bandwidth) application:
Low latency loopback application
Looking forward to see if you can figure out a solution.
In general, any example/solution with low-latency two-way streaming would help.
//Rune
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content