7 Replies Latest reply on Jun 12, 2012 1:22 AM by prajith.cheerakkoda

    Problem about CY7C68013A transfer 5MB/s data from a 5MHz DAC to PC

    peng.zhuo

      Hi, I am trying to use CY7C68013A to transfer data from DAC to PC. The rare of my DAC is 5M SPS(Samping Per Second)  and the data is 8bits. The 5MHz acquired data is written to the EP6's FIFO of 68013 which is work on slave FIFO mode. The FIFO is 512x4. My PC is programmed by VC++ 2008, using the function BeginDataXfer,WaitForXfer and FinishDataXfer to receive 2048Byte and then save them in a bin file per cycle.

         

      But the received data is not continuous. Some data between every 2048Byte is lost. When I slow the DAC to 50SPS, the received data is OK.

         

      How can I remove the data-losting under 5MB/s bulkin transfer?

         

      The DAC is written the slaveFIFO continuously. I think if the bulkin transfer as quickly as necessary, the data-losting can be avoided.  All maybe the bulk-transfer can not work for this situation,only Iso-transfer can? Thank you!

         

      Some of my programme is below: 

         

      UINT ReadThreadLoop( LPVOID params ) { //线程处理
       bool okin;
          CUSBtest1Dlg *dlg = (CUSBtest1Dlg *) params;
       OVERLAPPED inOvLap;
       PUCHAR inData = new UCHAR[409600];  //数据缓冲区
       ZeroMemory(inData,409600);
       inOvLap.hEvent   = CreateEvent(NULL, false, false, "CYUSB_IN");
       dlg->InEndpt->TimeOut = 3;

         

       for (;dlg->ReadThreadLooping ;)  //循环
       {
        LONG inlen=2048;
        //异步读数据
        UCHAR  *inContext = dlg->InEndpt->BeginDataXfer(inData,inlen,&inOvLap);
        dlg->InEndpt->WaitForXfer(&inOvLap,100);
        okin = dlg->InEndpt->FinishDataXfer(inData,inlen, &inOvLap,inContext);

         

        if (okin)      //如果读取成功,则保存数据
        {
         
         mFile.SeekToEnd();  
         mFile.Write(inData,inlen);

         

        }
        else  dlg->ReadThreadLooping = false;
       }

         

          CloseHandle(inOvLap.hEvent);

         

       delete [] inData;
       dlg->ReadThread = NULL;    //线程结束

         

          //dlg->USBDevice->Close();   //关闭USB设备

         

       mFile.Flush();      //关闭文件
       mFile.Close();

         

       return true;
      }