USB Speed issue

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Yamuna
Level 2
Level 2
25 sign-ins 10 replies posted 5 questions asked

Hi all,

I'm using fX3s to receive data that is being pushed from the Host PC. And I have created the DMA Auto Signal channel with 25 buffers each of size 8K. The data that is being pushed at the Host PC side is not fixed, it varies from 256byte to 8k. When I have the larger data length, data rate is as expected. But when the data length is less, data rate is very less. 

Currently i'm using the below code piece to push data from Host PC.

retVal = Endpt->XferData(data, len);
if (!retVal)
{
Endpt->Abort();
Endpt->Reset();
}

Now my questions are,

1. Is there any better way to push data at Host PC, which improves the data rate.?

2. Why such behaviour for data with small size?

3. Is there any C/C++ example code for data push from Host PC to cypress?

NOTE: i'm using C++ application at Host side.

Please help me out to solve the problem.

 

Thanks & Regards

Yamuna G

 

0 Likes
1 Solution
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi Yamuna,

In the streamer folder you have shared, please refer to streamer.h file. I have attached below code snippet which should be referred from the streamer.h file.

AliAsgar_0-1672901227511.png

Please let us know if your firmware was compatible to run with the streamer application as it is provided with the FX3 SDK.

Best Regards,
AliAsgar

View solution in original post

0 Likes
7 Replies
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi Yamuna,

1. & 3. There is a better, but a more complicated way to move data from host PC to the Cypress device using asynchronous mode of data transfer using BeginDataXfer/WaitForXfer/FinishDataXfer APIs. Please refer to the streamer application source code provided with the FX3 SDK for the implementation. The streamer application is written in C++ itself. You could also refer to the CyAPI.pdf doc.

2. Could you let us know how much is the data transfer rate, when data is
a. 256 bytes
b. multiple of 1k bytes, but less than 8k.
c. 8k bytes.

Could you also let us know who is the consumer and is the consumer consuming the data continuously?

Best Regards,
AliAsgar

0 Likes

Hi AliAsgar,

Thanks for the reply.

Right now i have the measurements for,

1. 2K data len -> 1503 pkts/sec and 23Mbps

2. 3K data len - > 1406 pkts/sec and 32Mbps

3. 4k data len -> 1320 pkts/sec and 41Mbps

4. 8k data len -> 1057 pkts/sec and 66Mbps

our requirement is for datalen <= 2K ,data rate of 80Mbps and 3000 pkts per sec is required.

 

Consumer is a SDIO device, yes it is consuming the data continuously.

 

Thanks & Regards

Yamuna G

0 Likes
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi Yamuna,

Could you try reducing the DMA buffer size to 2k and check if it improves the throughput?

You could also try performing the asynchronous IO mode of data transfers for queuing faster OUT transactions from the host.

Best Regards,
AliAsgar

0 Likes

Hi AliAsgar,

1. 2K data len -> 1503 pkts/sec and 23Mbps  with 2K DMA buffer size.

2. 3K data len - > 1406 pkts/sec and 32Mbps  with 3K DMA buffer size.

3. 4k data len -> 1320 pkts/sec and 41Mbps  with 4K DMA buffer size.

4. 8k data len -> 1057 pkts/sec and 66Mbps  with 8K DMA buffer size.

the above results are with different DMA buffer size,  these tests are done just to check the data rate, but in the final application the data length is not constant, it varies between 256 bytes to 8k, so we used 8K DMA buffer size.

 

Also I tried both Synchronous and Asynchronous mode of transfers, but I don't see any difference in the data rate.

Below is the code that i'm using for  Synchronous and Asynchronous mode of transfers

#ifdef SDIO_SYNCHRONOUS_RW

long len = length;

retVal = Endpt->XferData(data, len);
if (!retVal)
{
Endpt->Abort();
Endpt->Reset();
}


#else
UCHAR* txContext;
OVERLAPPED outEvents;
char evtName[30] = "TXUSB_TRANSFER";
long len = length;

outEvents.hEvent = CreateEvent(NULL, false, false, (LPCWSTR)evtName);
txContext = Endpt->BeginDataXfer(data, len, &outEvents);
retVal = Endpt->WaitForXfer(&outEvents, 2000);
if (retVal)
{
retVal = Endpt->FinishDataXfer(data, len, &outEvents, txContext);
if (!retVal)
{
Endpt->Abort();
Endpt->Reset();
}
}
CloseHandle(outEvents.hEvent);

#endif

Thanks & Regards

Yamuna

0 Likes
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi Yamuna,

Your implementation of asynchronous mode IO transfer is similar to the internal implementation of synchronous mode IO. Hence you are getting similar bandwidth in both the cases.

Please queue up maximum number of packets (64 or 128) for asynchronous mode IO using BeginDataXfer. Please refer to streamer application.

You could also try using the streamer application as is with your firmware and check the throughput for different packetPerXfer and XfersToQueue.

Best Regards,
AliAsgar

0 Likes
lock attach
Attachments are accessible only for community members.

Hi AliASgar,

Thanks for the reply!

I'm not able to find the code snippet in the streamer application.

I have attached the the streamer application from SDK. Please point me out to the Xfer APIs.

If this is not the one you are saying, then send me the appropriate streamer application source code.

 

Thanks & Regards

Yamuna  

0 Likes
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi Yamuna,

In the streamer folder you have shared, please refer to streamer.h file. I have attached below code snippet which should be referred from the streamer.h file.

AliAsgar_0-1672901227511.png

Please let us know if your firmware was compatible to run with the streamer application as it is provided with the FX3 SDK.

Best Regards,
AliAsgar

0 Likes