what should I do if i want to use CY68013A in Slave FIFO mode to transmit Real-time Data

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

cross mob
FaDo_863296
Level 1
Level 1

Dear Sirs,

What should I do if i want to use CY68013 in Slave FIFO mode  to transmit Real-time Data that would be generated  evry 50ns or 500ns?

Is the Isochonous transmission the best choice?

With bulk mode, the USB FIFO would be full and the real-time data would be lost, because the data can not write into the USB FIFO when the USB FIFO is full.

How should I do if we want the USB FIFO full flags not to be active?

And do you have the Isochonous mode example code?

Waiting for your reply!

Thanks~

0 Likes
1 Solution

Hello,

Please commit the data to the endpoint as soon as the slave FIFO interfaces receives the data, this can be done by using AUTO mode.

For the FIFOs to be available always, you will need to read the data continuously and fast from the host side (host application).

You can use the streamer application present in the FX3 SDK, which will continuously stream in the data from the respective end point, hence reducing the chances of FIFO getting full and FPGA reporting a timeout error.

Thanks,

Yatheesh

View solution in original post

0 Likes
7 Replies
YatheeshD_36
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hello,

For time critical data you can best make use if the isochronous data transfers.

Also, refer to the AN61345, FX2LP Slave FIFO Application note​ for implementation part.

The App note makes use Bulk transfers through bulk endpoints, you can configure the same endpoints as isochronous for your application.

External clock from the Master can be used as interface clock in order to synchronize the data transfers with the slave FIFO.

Best Regards,

Yatheesh

0 Likes

Thanks for you reply!!!

Now We can read some data from FPGA. But there are some bugs in  it.

For example:

We use the treamer code as the example & read data by ISO,

and we change the bulk mode into ISO mode.

but at the end of the ISO transaction(MaxPktSize * 8), some data would be lost, we read the data like as:

00000f30: 9407 0000 9507 0000 9607 0000 9707 0000  ................

00000f40: 9807 0000 9907 0000 9a07 0000 9b07 0000  ................

00000f50: 9c07 0000 9d07 0000 9e07 0000 9f07 0000  ................

00000f60: a007 0000 a107 0000 a207 0000 a307 0000  ................

00000f70: a407 0000 a507 0000 a607 0000 a707 0000  ................

00000f80: a807 0000 a907 0000 aa07 0000 ab07 0000  ................

00000f90: ac07 0000 ad07 0000 ae07 c0c0 c0c0 c0c0  ................

00000fa0: c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0  ................

00000fb0: c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0  ................

00000fc0: c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0  ................

00000fd0: c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0  ................

00000fe0: c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0  ................

00000ff0: c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0  ................

00001000: c807 0000 c907 0000 ca07 0000 cb07 0000  ................

00001010: cc07 0000 cd07 0000 ce07 0000 cf07 0000  ................

00001020: d007 0000 d107 0000 d207 0000 d307 0000  ................

00001030: d407 0000 d507 0000 d607 0000 d707 0000  ................

00001040: d807 0000 d907 0000 da07 0000 db07 0000  ................

What should i do to get the right data?

The driver is as follow:

               long BytesXferred = 0;
               unsigned long Successes = 0;
               unsigned long Failures = 0;
               int i = 0;
               int PPX = 8;
               int QueueSize = 64;
               int     TimeOut = 1500;
               CCyIsocEndPoint *EndPt = USBDevice->IsocInEndPt;
               // Allocate the arrays needed for queueing
               PUCHAR               *buffers          = new PUCHAR[QueueSize];
               CCyIsoPktInfo     **isoPktInfos     = new CCyIsoPktInfo*[QueueSize];
               PUCHAR               *contexts          = new PUCHAR[QueueSize];
               OVERLAPPED          inOvLap[64];
 
               long len = EndPt->MaxPktSize * PPX; // Each xfer request will get PPX isoc packets
 
               EndPt->SetXferSize(len);
               QueueSize = 1;
 
               if(QueueSize > 64)
               {
                    printf("Size is to big for once read\n");
                    return true;
               }
               
               // Allocate all the buffers for the queues
               for (i=0; i< QueueSize; i++) 
               { 
                    buffers        = new UCHAR[len];
                    isoPktInfos    = new CCyIsoPktInfo[PPX];
                    inOvLap.hEvent = CreateEvent(NULL, false, false, NULL);
 
               //     memset(buffers,0,len);
               }
               // Queue-up the first batch of transfer requests
               for (i=0; i< QueueSize; i++)     
               {
                    contexts = EndPt->BeginDataXfer(buffers, len, &inOvLap);
                    if (EndPt->NtStatus || EndPt->UsbdStatus) // BeginDataXfer failed
                    {
                         printf("Error1\n");
                         return false;
                    }
               }     
               i = 0;
               int bStreaming = 1;
               for (;bStreaming;)     
          //     for (i=0; i< QueueSize; i++)
               {
                    long rLen = len;     // Reset this each time through because
                                             // FinishDataXfer may modify it
 
                    if (!EndPt->WaitForXfer(&inOvLap, TimeOut))
                    {
                         EndPt->Abort();
                         if (EndPt->LastError == ERROR_IO_PENDING)
                              WaitForSingleObject(inOvLap.hEvent,2000);
                    }
 
                    if (EndPt->Attributes == 1) // ISOC Endpoint
                    {     
                         if (EndPt->FinishDataXfer(buffers, rLen, &inOvLap, contexts, isoPktInfos)) 
                         {               
                                CCyIsoPktInfo *pkts = isoPktInfos;
                              for (int j=0; j< PPX; j++) 
                              {
                                   if (pkts.Status == 0) 
                                   {
                                        BytesXferred += pkts.Length;
                                        Successes++;
                                                                //write data to file
                                        fwrite(buffers+EndPt->MaxPktSize*j,1,pkts.Length,file_hdl);
                                   }
                                   else
                                        Failures++;
 
                                   pkts.Length = 0;     // Reset to zero for re-use.
                              }
 
                         } 
                         else
                              Failures++; 
               
                    } 
 
                    else // BULK Endpoint
                    {
                         if (EndPt->FinishDataXfer(buffers, rLen, &inOvLap, contexts)) 
                         {               
                              Successes++;
                         } 
                         else
                              Failures++; 
                    }
 
 
                    if (BytesXferred < 0) // Rollover - reset counters
                    {
                         BytesXferred = 0;
                    }
 
                    // Re-submit this queue element to keep the queue full
                    contexts = EndPt->BeginDataXfer(buffers, len, &inOvLap);
                    if (EndPt->NtStatus || EndPt->UsbdStatus) // BeginDataXfer failed
                    {
                         printf("Error2\n");
                         return false;
                    }
 
                    i++;
 
                    if (i == QueueSize) //Only update the display once each time through the Queue
                    {
                         i=0;                    
                    }
 
               }  // End of the infinite loop 
0 Likes

Hello,

Can you please confirm if the data is lost when you are using the streamer application without altering it?

What is the expected data that is not received?

Best Regards,

Yatheesh

0 Likes

We use CyConsole.exe to test:

pastedImage_0.png

There is no data from 0x0F9A ~0x0FFF.

What's wrong about it?

Where do those data go?

And the wrong data:

00000f70: a407 0000 a507 0000 a607 0000 a707 0000  ................

00000f80: a807 0000 a907 0000 aa07 0000 ab07 0000  ................

00000f90: ac07 0000 ad07 0000 ae07 c0c0 c0c0 c0c0  ................

00000fa0: c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0  ................

00000fb0: c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0  ................

00000fc0: c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0  ................

00000fd0: c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0  ................

00000fe0: c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0  ................

00000ff0: c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0 c0c0  ................

00001000: c807 0000 c907 0000 ca07 0000 cb07 0000  ................

00001010: cc07 0000 cd07 0000 ce07 0000 cf07 0000  ................

correct data should be:

00000f70: a407 0000 a507 0000 a607 0000 a707 0000  ................

00000f80: a807 0000 a907 0000 aa07 0000 ab07 0000  ................

00000f90: ac07 0000 ad07 0000 ae07 0000 af07 0000

00000fa0: b007 0000 b107 0000 b207 0000 b307 0000 ................

00000fb0: b407 0000 b507 0000 b607 0000 b707 0000 ................

00000fc0: b807 0000 b907 0000 ba07 0000 bb07 0000 ................

00000fd0: bc07 0000 bd07 0000 be07 0000 bf07 0000 ................

00000fe0: c007 0000 c107 0000 c207 0000 c307 0000 ................

00000ff0: c407 0000 c507 0000 c607 0000 c707 0000 ................

00001000: c807 0000 c907 0000 ca07 0000 cb07 0000  ................

00001010: cc07 0000 cd07 0000 ce07 0000 cf07 0000  ................

c407

0 Likes

Hello,

Please use the Cycontrol center from the FX3 SDK. Also, make sure that the device is bound to the latest driver cyusb3 1.2.3.20 from the FX3 SDK: https://www.cypress.com/documentation/software-and-drivers/ez-usb-fx3-software-development-kit

Isochronous transfers will guarantee bandwidth but does not guarantee delivery of data.

Thanks,

Yatheesh

That‘s right. Now data are OK from USB.

But with the Isochronous mode, Slave FIFO in CY7C68013A would be full , and the data would could not be send in the given time.

Then FPGA would be report timeout to send a data.

And we find that there is still byte=0 USB pkt with Isochronous mode.

What should I do next ? How to reduce the time to report the IN-FIFO full ?

Do you have some suggestion?

Thank you!

0 Likes

Hello,

Please commit the data to the endpoint as soon as the slave FIFO interfaces receives the data, this can be done by using AUTO mode.

For the FIFOs to be available always, you will need to read the data continuously and fast from the host side (host application).

You can use the streamer application present in the FX3 SDK, which will continuously stream in the data from the respective end point, hence reducing the chances of FIFO getting full and FPGA reporting a timeout error.

Thanks,

Yatheesh

0 Likes