Confused by the occasionally breaking down

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

cross mob
Anonymous
Not applicable

Hi, every one.

   

I'm using CY7C68013 to implement a data acquisition system.FPGA sends the data flow to the host via USB.The configuration of the USB is  as follows: EP2 IN, 512bit, quad buffers, slave fifo, auto in mode, and with an external IFCLK(24Mhz).The writting rate to endpoint is about 2.5MB/s.And the FPGA writes to the endpoint2 continuously unless it is not full.

   

The host program is based on .NET(C#) .To test transfer speed, i ordered my host to request for data repeat from 68013. The XferSize was set to 256KB,and the host requested for 256KB each time.But the host program occasionally broke down.It can happened during the anytime when executing Xferdata()(maybe the first time or even after 10 mins). The return NtStatus can be "0xC000 0120" or "0xC001 0000".And the string returned by UsbStatusString() was "[state=HALTED status=UNKNOWN]".

   

I don't know how to map these error codes to the real problems.It seems others seldom using .NET to implement a project. I checked my FPGA program,the firmware and the C# program.But i can't find anything wrong.Maybe I've missed or misunderstood something.Please help me.

   

Main part of the firmware and C# codes are as follows:

   

Firmware:

   

void TD_Init(void)             // Called once at startup
{
  IFCONFIG |= 0x03; //external clock from FPGA:24 Mhz
  SYNCDELAY;
  REVCTL = 0x03;   // 
  SYNCDELAY;
  EP2CFG = 0xE0; // IN, bulk mode,quad buffering,512bit each buffer   
  SYNCDELAY;

   

  FIFORESET = 0x80;  // reset all FIFO
  SYNCDELAY;
  FIFORESET = 0x82;
  SYNCDELAY;
  FIFORESET = 0x84;
  SYNCDELAY;
  FIFORESET = 0x86;
  SYNCDELAY;
  FIFORESET = 0x88;
  SYNCDELAY;
  FIFORESET = 0x00;
  SYNCDELAY;
 
  EP2FIFOCFG = 0x09; 
  SYNCDELAY;
  PINFLAGSAB = 0x00; // defines FLAGA as prog-level flag, pointed to by FIFOADR[1:0]
  SYNCDELAY;           PINFLAGSCD = 0x00; // FLAGC as empty flag, as pointed to by FIFOADR[1:0]
  PORTACFG = 0x40;   // Enable SLCS
  SYNCDELAY;
  FIFOPINPOLAR = 0x00; // set all slave FIFO interface pins as active low
  SYNCDELAY;
  EP2AUTOINLENH = 0x02; // autoin length:512bit
  SYNCDELAY;     
  EP2AUTOINLENL = 0x00; 
  SYNCDELAY;
  EP2FIFOPFH = 0x90;// FLAGA: PKTSTAT = 0,PF asserts if committed packest are more than 2.
  SYNCDELAY;
  EP2FIFOPFL  = 0x00;
}

   

C# code

   

 int count = 0;
        CyBulkEndPoint bulkEndptOut;
        private void button1_Click(object sender, EventArgs e)
        {
            USBDeviceList usbDevices = new USBDeviceList(CyConst.DEVICES_CYUSB);
            CyUSBDevice MyDevice = usbDevices[0x04B4, 0x1004] as CyUSBDevice;
            if (MyDevice == null)
            {
                MessageBox.Show("No device attached!");
                return;
            }
            bulkEndptOut = MyDevice.EndPoints[1] as CyBulkEndPoint;
            if (bulkEndptOut == null)
            {
                MessageBox.Show("Can't find endpoint!");
                return;
            }
            bulkEndptOut.XferSize = 4096 * 64 ;// Set XferSzie 256KB
            Thread t = new Thread(new ThreadStart(subFun));
            t.Start();
         }
        bool bComplete = true;
        void subFun()
        {
            while (true) //for test only,it's a dead loop
            {
               
                int[][][] mData = new int[1][][];
                for (int i = 0; i < mData.Length; i++)
                {
                    int len = 256 * 1024;//requset  for 256KB each time
                    byte[] buf = new byte[len];
                    count++;
                    bComplete = bulkEndptOut.XferData(ref buf, ref len);
                }
            }
           
        }

0 Likes
11 Replies
Anonymous
Not applicable

1.  Please use streamer/screamer and let me know if  you're seeing huge number of failures being reported

   

2. Have you tried hooking up a CATC to see what is happening on the bus.

   

Regards,

   

Anand

0 Likes
Anonymous
Not applicable

Hi,aasi

   

Thank you for your replay.

   

1.I haven't used a streamer.And is streamer  a part of Cypress developement tools?

   

2.No...Sorry that I've never heard about CATC before.Can you tell me the full name of this software?I'm a freshman.

   

Regards.

   

Chouc

0 Likes
Anonymous
Not applicable

 O.K. I got the streamer,but it doesn't work at all with the firmware included in SuiteUSB 3.4.7.

   

And I serached the website of cypress,finding that it has been a firmware problem years ago.But now it remains unsolved.

0 Likes
Anonymous
Not applicable

 New discover.

   

The streamer works well in development board(3684) with a 128-pin CY7C68013, but it still doesn't work in my own board using 100-pin package.The device can not start,with an error code 10.

   

Regards,

   

Chouc

0 Likes
Anonymous
Not applicable

 Hi Chouc,

   

 

   

1. More about the Software required for CATC can be found at http://www.lecroy.com/protocolanalyzer/protocolstandard.aspx?standardid=4.

   

2. Please try downloading Bulkloop firmware from C:\Cypress\Cypress Suite USB 3.4.7\Firmware\Bulkloop and check whether your board enumerates well with this.

   

3. Also, check the VID/PID shown in Device manager with Screamer firmware and ensure it is the same as that what we have entered in inf (same as that provided in dscr.a51 inside firmware).

   

 

   

Regards,

   

Gayathri

0 Likes
Anonymous
Not applicable

 Hi Gayathri,

   

Thank for your reply.

   

1.My own board isn't a development board.It's designed for my project and works well for bulkloop firmware.

   

2.I'm pretty sure that the VID and PID (04B4 & 1003)has been added to .inf file.

   

Actually, the first time after the firmware of streamer being downloaded to CY7C68013,I updated the driver manually for this device with a return code 10 and the device couldn't be recognized by the Control Center.Next time I plugged in the device and downloaded the firmware, my PC could recognize it automatically and the device manager showed that it worked well.However, it still couldn't be recognized by Control Center.Seems that something going wrong with the renumeration.

   

Regards,

   

Chouc

0 Likes
Anonymous
Not applicable

 Hi,

   

 

   

I doubt the driver is not installed properly. Can you please attach the screenshot of "General Tab" insdide Device properties, in device manager? I want to see what is being shown in the Device status box. Also, under "Details" tab, you can see the VID/PID of the device that is being recognized in Device manager. Can you please check whether it is same as 0x04B4/1003 ?

   

 

   

Regards,

   

Gayathri

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

 Hi,

   

 

   

I think you are right that the driver is not installed properly.When I click the "scan for hardware changes",it went wrong again with a return code 10.

   

 

   

I modified .inf file as below:

   

   

;for all platforms

   

[Device]

   

;%VID_XXXX&PID_XXXX.DeviceDesc%=CyUsb, USB\VID_XXXX&PID_XXXX

   

%VID_04B4&PID_1003.DeviceDesc%=CyUsb, USB\VID_04B4&PID_1003

   

 

   

;for windows 2000 non intel platforms

   

[Device.NT]

   

;%VID_XXXX&PID_XXXX.DeviceDesc%=CyUsb, USB\VID_XXXX&PID_XXXX

   

%VID_04B4&PID_1003.DeviceDesc%=CyUsb, USB\VID_04B4&PID_1003

   

 

   

;for x86 platforms

   

[Device.NTx86]

   

;%VID_XXXX&PID_XXXX.DeviceDesc%=CyUsb, USB\VID_XXXX&PID_XXXX

   

%VID_04B4&PID_1003.DeviceDesc%=CyUsb, USB\VID_04B4&PID_1003

   

 

   

   

Regards,

   

Chouc

0 Likes
Anonymous
Not applicable

and this one:

   

VID_04B4&PID_1003.DeviceDesc="Cypress USB Streamer (3.4.7.000)"

0 Likes
Anonymous
Not applicable

 Hi,

   

 

   

When device manager says code 10 it means it doesn't have enough information to point the exact reason behind the error http://support.microsoft.com/kb/943104.

   

In order to isolate whether it is an OS issue, try connecting the device to different PCs and test. 

   

Which is the PC to which you are connecting the device as of now, in which it shows code 10 error? Please ensure, you are using the correct inf file meant for the particular OS (refer http://www.cypress.com/?id=4&rID=48578).

       

 

   

Regards,

   

Gayathri

0 Likes
Anonymous
Not applicable

 Now i can use Streamer in compliance with the firmware(similar to waht in TRM2).Maybe the original streamer firmware wasn't compatible with my hardware.

   

 

   

I modified the FPGA program such that it can write continuously to EP2.

   

Astonishingly,the speed can be up to 38MB/s showed in the streamer(and my own C# program showed it was 44MB/s),while the FPGA  wrote to EP2 with a 7Mhz external clock(16bit wide,i.e a data flow of14MB/s,SLCS and SLWR were tied low).Then i changed the extenal clock frequency(e.g. 12Mhz,24Hhz ...),but nothing changed.The IFCONFIG was set to 0x03.

   

I checked the buffers in PC,finding that there were so many duplicated data.And that was why the speed could reach a such high rate.Latter,i switched the clock to internal(30Mhz) and data wide to 8bit-wide(FD[7..0]).No duplicated data anymore,but the speed could only reach 27MB/s(it should be 30MB/s),and some data were found lost when checking the buffers in PC.  

   

 

   

Regards,

   

Chouc

0 Likes