6 Replies Latest reply on Apr 12, 2017 7:46 AM by dmitriy.gerasimov

    How can I restart when I got transfer failed?

    lee.carter


      Hi, 
      When I transfer the data by using XferData, this function does not work after abnormal situation what the data transfer not finish. 

      I've looking the solution to resolve this hang problem . 
      I used reset or reconnect functions of CYAPI, But they useless.. 

      if (!(USBDevice->BulkInEndPt->XferData(_Orgin_Pixel_, len))) 

      USBDevice->ReConnect(); 
      USBDevice->Reset(); 

      Currently now I just turn off and on the FX3KIT. 

      How do I resolve this problem.?? 

      and the below is what I just watch the information 

      - USBDevice->BulkInEndPt 0x00762fb0 {...} CCyBulkEndPoint * 
      - CCyUSBEndPoint {hDevice=0x000001bc DscLen=7 '\a' DscType=5 '\x5' ...} CCyUSBEndPoint 
      + __vfptr 0x00ca8224 {isp1.exe!const CCyBulkEndPoint::`vftable'} {0x00c916ea {isp1.exe!CCyUSBEndPoint::BeginDirectXfer(unsigned char *,long,struct _OVERLAPPED *)}, ...} void * * 
      hDevice 0x000001bc void * 
      DscLen 7 '\a' unsigned char 
      DscType 5 '\x5' unsigned char 
      Address 129 '?' unsigned char 
      Attributes 2 '\x2' unsigned char 
      MaxPktSize 16384 unsigned short 
      PktsPerFrame 1 unsigned short 
      Interval 0 '\0' unsigned char 
      ssdscLen 6 '\x6' unsigned char 
      ssdscType 48 '0' unsigned char 
      ssmaxburst 15 '\xf' unsigned char 
      ssbmAttribute 0 '\0' unsigned char 
      ssbytesperinterval 0 unsigned short 
      TimeOut 10000 unsigned long 
      UsbdStatus 3221291008 unsigned long 
      NtStatus 3221225760 unsigned long 
      bytesWritten 0 unsigned long 
      LastError 997 unsigned long 
      bIn true bool 
      XferMode XMODE_DIRECT (1) XFER_MODE_TYPE

        • 1. Re: How can I restart when I got transfer failed?
          nisa

          What is the error scenario that you are trying to recover from? The USBDevice->Reset() will clear the USB pipe, it will not clear any error scenario on the FX3 side (other than the USB/UIB block). 

             

          We recommend you that when you send this command from the host, check for this request in the FX3 firmware. Once you get this request in the FX3 firmware, you should completely stop your application and start afresh. If you are using AN75779 example, please see the Clear feature handling in the firmware. Here, on getting Clear feature, the device stop all the activities, resets the DMA, after this, you also need to call the AppStart to reinitialize the transfers. Please try and let us know if you see any problem. Also, let us know what error scenario you are trying to recover from? And how do you get this error, can I get the same scenario using FX3 explorer kit?

          • 2. Re: How can I restart when I got transfer failed?
            lee.carter

            Thanks for replay Nishant,
            The scenario what I've got the problem is happened during stop the data transferring.
            Exactly, you can check your side what I've got the problem with the following the step.

               

            1. upload the slavefifo firmware refered from AN65974 into the fx3 kit.
            2. in the USB Control Center, Transfer data with not 1024 times bytes to transfer.( for example 1023, 513, 2044.. etc)
            3. then, you can see the data transfer halted with error message.

               

            BULK IN transfer 
            BULK IN transfer failed with Error Code:997
            ...
            ...

               

            BULK IN transfer 
            BULK IN transfer failed with Error Code:997

               

            so in this case, what am I supposed to do to restart the fx3 firmware?

            • 3. Re: How can I restart when I got transfer failed?
              lee.carter

              Dear Nishant, Did you get it my scenario? or do you need any explain more from me about the scenario?

              • 4. Re: How can I restart when I got transfer failed?
                nisa

                If the endpoint has full packet, then you should not ask anything less than packet size. If the EP has 1024, and you ask 1023, it is expected that you get an error. Similar is the case when you ask for 2044: as the EP will have 1024*2 and you are asking for less. The best way is to ask in multiple of EP max size i.e 1024. If the device has less, it will automatically complete the transfer and you will receive the data at the host. If the device has data in multiple of 1024, then it should append an ZLP at the end of the transfer to indicate the host that the transfer is ended and it should wrap up and give the data to the host application.

                • 5. Re: How can I restart when I got transfer failed?
                  lee.carter

                  Thanks for replay Nishant,

                     

                  I always asked 1024, most of the time the host application can get the data from FX3 as well. but problem is sometimes I can't get the data exactly 1024 by something reason i.e noise or unexpected input data. 

                     

                  So, I want to know when I get an error, what am I supposed to do in the error state to escape the abnormal state ?  Would you please let me know the solution in the below scenario ?

                     


                  The scenario what I've got the problem is happened during stop the data transferring.
                  Exactly, you can check your side what I've got the problem with the following the step.

                     

                  1. upload the slavefifo firmware refered from AN65974 into the fx3 kit.
                  2. in the USB Control Center, Transfer data with not 1024 times bytes to transfer.( for example 1023, 513, 2044.. etc)
                  3. then, you can see the data transfer halted with error message.

                     

                  BULK IN transfer 
                  BULK IN transfer failed with Error Code:997
                  ...
                  ...

                     

                  BULK IN transfer 
                  BULK IN transfer failed with Error Code:997

                     

                  so in this case, what am I supposed to do to restart the fx3 firmware?

                  • 6. Re: How can I restart when I got transfer failed?
                    dmitriy.gerasimov

                    To reinit device try to add Sleep between Close and Open (2 seconds). For me it works.