cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

Anonymous
Not applicable

I build the 'AN65974' sources(SlaveFifoSync and fpga_slavefifo2b_verilog) and upgrade the broad to do the streamIN test.

But I found that some data will be lost.I modify the app's source and check the DWORD value for usb datas.

I found the number of the lost packet is every 4096 times.

So I modify the source named 'slaveFIFO2b_streamIN.v':

assign slwr_streamIN_ = ((current_stream_in_state == stream_in_write) | (current_stream_in_state == stream_in_write_wr_delay)) ? 1'b0 : 1'b1;

to

assign slwr_streamIN_ = (current_stream_in_state == stream_in_write) ? 1'b0 : 1'b1;

the result the 4096 times packet is not lost.But when the fast the data is passing from fpga to the pc,t...move up when the remaining number of the last buffer is the 256 bytes​.the fpga can advance stopping the datas sent to FX3.But I do not  know how to do this?

0 Likes
Reply
1 Solution
Employee

Hi

Plese don't modify the FPGA source code which will lead to error condition. As you can check from AN65974, if you change .v file in that way, the time sequence will be different from what FX3 requires.

We don't hear about the data loss problem. Could you please clarify the detailed information about your question?

What's your hardware design? What's the steps you find this issue?

View solution in original post

0 Likes
Reply
3 Replies
Employee

Hi Ru feng,

Which application are you using when you say but I found that some data will be lost.I modify the app's source and check the DWORD value for usb datas.

0 Likes
Reply
Anonymous
Not applicable

Hi yyca,

In the directory:

EZ-USB FX3 SDK\1.3\application\cpp\streamer\

To Modify the file:

Streamer.h

To function:

static void XferLoop().

The fpga module 'slaveFIFO2b_streamIN.v' will send the dword value from 0 to 0xffffffff.

So I write the codes in the app's function to check the Streamer in datas.

sources:

      static void XferLoop()

        {

            long BytesXferred = 0;

            unsigned long Successes = 0;

            unsigned long Failures = 0;

            int i = 0;

            // Allocate the arrays needed for queueing

            PUCHAR *buffers = new PUCHAR[QueueSize];

            CCyIsoPktInfo **isoPktInfos = new CCyIsoPktInfo*[QueueSize];

            PUCHAR *contexts = new PUCHAR[QueueSize];

//........................................................................................................................................................................................

unsigned long* rLen_q = new unsigned long[QueueSize];

            OVERLAPPED inOvLap[MAX_QUEUE_SZ];

            long len = EndPt->MaxPktSize * PPX; // Each xfer request will get PPX isoc packets

            EndPt->SetXferSize(len);

            // 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,0xEF,len);

            }

            DateTime t1 = DateTime::Now; // For calculating xfer rate

            // 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

                {

                    Display(String::Concat("Xfer request rejected. NTSTATUS = ",EndPt->NtStatus.ToString("x")));

                    AbortXferLoop(i+1, buffers,isoPktInfos,contexts,inOvLap);

                    return;

                }

            }

            i=0;

            // The infinite xfer loop.

            for (;bStreaming;)

            {

                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) && (pkts.Length<=EndPt->MaxPktSize))

                            {

                                BytesXferred += pkts.Length;

                                if (bShowData)

                                    Display16Bytes(buffers);

                                Successes++;

                            }

                            else

                                Failures++;

                            pkts.Length = 0; // Reset to zero for re-use.

pkts.Status = 0;

                        }

                    }

                    else

                        Failures++;

                }

                else // BULK Endpoint

                {

                    if (EndPt->FinishDataXfer(buffers, rLen, &inOvLap, contexts))

                    {

                        Successes++;

                        BytesXferred += rLen;

//........................................................................................................................................................................................

rLen_q = rLen;

                        if (bShowData)

                            Display16Bytes(buffers);

                    }

                    else

                        Failures++;

                }

                if (BytesXferred < 0) // Rollover - reset counters

                {

                    BytesXferred = 0;

                    t1 = DateTime::Now;

                }

                // Re-submit this queue element to keep the queue full

                contexts = EndPt->BeginDataXfer(buffers, len, &inOvLap);

                if (EndPt->NtStatus || EndPt->UsbdStatus) // BeginDataXfer failed

                {

                    Display(String::Concat("Xfer request rejected. NTSTATUS = ",EndPt->NtStatus.ToString("x")));

                    AbortXferLoop(QueueSize,buffers,isoPktInfos,contexts,inOvLap);

                    return;

                }

                i++;

                if (i == QueueSize) //Only update the display once each time through the Queue

                {

//Check datas Start...............................................................................................................................................................

unsigned long v_s = 0;

int j;

FILE* fp;

if(rLen_q[0]>4)

{

fp = fopen("c:\\out.txt","ab");

if(fp!=NULL)

{

v_s = *((unsigned long*)buffers[0]);

for(i=0;i<QueueSize;i++)

{

for(j=0;j<(rLen_q/sizeof(unsigned long));j++,v_s++)

{

if(((unsigned long*)buffers)!=v_s)

{

fprintf(fp,"%08x!=%08x\r\n",((unsigned long*)buffers),v_s);

}

}

}

fclose(fp);

}

}

//Check datas Ends...............................................................................................................................................................

                    i=0;

                    ShowStats(t1, BytesXferred, Successes, Failures);

                }

            }  // End of the infinite loop

            // Memory clean-up

            AbortXferLoop(QueueSize,buffers,isoPktInfos,contexts,inOvLap);

        }

0 Likes
Reply
Employee

Hi

Plese don't modify the FPGA source code which will lead to error condition. As you can check from AN65974, if you change .v file in that way, the time sequence will be different from what FX3 requires.

We don't hear about the data loss problem. Could you please clarify the detailed information about your question?

What's your hardware design? What's the steps you find this issue?

View solution in original post

0 Likes
Reply