3 Replies Latest reply on Jun 5, 2016 7:29 PM by meiming_1674436

    Is there any chance to refresh DMA channel or Bulk-In endpoint  Automatically

    @qq.com.7

      hardware condition:cyusb3014,fpga for send data.

         

      firmware condition:AN65974 from cypress Website linked ”http://www.cypress.com/?rID=51581

         

      opereation:cyusb3014  connected   fpga with slavefifo,the fpga send Data Constantly,then I open the Streamer software and  Streamer will get data from cyusb3014,but sometimes later ,the stream can not get data anymore .I examine the ep 0x81 state and DMA channel state,but they all normal. then i write code to reset the ep and DMA channel.

         

      as soon as the streamer get data normal, i send the command to reset the ep and DMA channel,the stream will can not get Data immediately, same as the err talked above, and later i will can not work anymore. but if i reset the ep and DMA channel without let streamer get data,then the streamer can get data normally.

        • 1. Re: Is there any chance to refresh DMA channel or Bulk-In endpoint  Automatically
          rama.sai.krishna.vakkantula

          Hi,

             

          You can try the following thing.

             

          Check if there is some PIB error during the time whenever streamer gets stuck or unable to read data from FX3.

             

          If there is a PIB error then you can reset the DMA channel and EP there.

             

          You can check the PIB error as follows:

             

          Register a PIB callback as shown below.

             

          CyU3PPibRegisterCallback (CyFxAppPibCallback, CYU3P_PIB_INTR_ERROR);

             

          Define the function CyFxAppPibCallback as follows (You can modify this function as per your application requirement):

             

          static void CyFxAppPibCallback (
                  CyU3PPibIntrType cbType,
                  uint16_t cbArg)
          {
            

             

          if(cbType==CYU3P_PIB_INTR_ERROR)

             

          {

             

              switch (CYU3P_GET_PIB_ERROR_TYPE(cbArg))

             

              {

             

                  case CYU3P_PIB_ERR_THR0_WR_OVERRUN:

             

                  CyU3PDebugPrint (4, "CYU3P_PIB_ERR_THR0_WR_OVERRUN");

             

                  break;

             

                  case CYU3P_PIB_ERR_THR1_WR_OVERRUN:

             

                  CyU3PDebugPrint (4, "CYU3P_PIB_ERR_THR1_WR_OVERRUN");

             

                  break;

             

                  case CYU3P_PIB_ERR_THR2_WR_OVERRUN:

             

                  CyU3PDebugPrint (4, "CYU3P_PIB_ERR_THR2_WR_OVERRUN");

             

                  break;

             

                  case CYU3P_PIB_ERR_THR3_WR_OVERRUN:

             

                  CyU3PDebugPrint (4, "CYU3P_PIB_ERR_THR3_WR_OVERRUN");

             

                  break;

             

           

             

                  case CYU3P_PIB_ERR_THR0_RD_UNDERRUN:

             

                  CyU3PDebugPrint (4, "CYU3P_PIB_ERR_THR0_RD_UNDERRUN");

             

                  break;

             

                  case CYU3P_PIB_ERR_THR1_RD_UNDERRUN:

             

                  CyU3PDebugPrint (4, "CYU3P_PIB_ERR_THR1_RD_UNDERRUN");

             

                  break;

             

                  case CYU3P_PIB_ERR_THR2_RD_UNDERRUN:

             

                  CyU3PDebugPrint (4, "CYU3P_PIB_ERR_THR2_RD_UNDERRUN");

             

                  break;

             

                  case CYU3P_PIB_ERR_THR3_RD_UNDERRUN:

             

                  CyU3PDebugPrint (4, "CYU3P_PIB_ERR_THR3_RD_UNDERRUN");

             

                  break;

             

           

             

                  default:

             

                  CyU3PDebugPrint (4, "No Error :%d\n ",CYU3P_GET_PIB_ERROR_TYPE(cbArg));

             

                      break;

             

              }

             

          }

             

           
          }

             

           

          • 2. Re: Is there any chance to refresh DMA channel or Bulk-In endpoint  Automatically
            @qq.com.7

             Hi Rskv,

               

            I used the code that you display,but i print nothing,and then i register the endpoint event callback with the following code:

               

             

               

            CyU3PUsbRegisterEpEvtCallback(UsbEpEvt_err_Cb,0xffffffff,0xffff,0xffff);

               

             

               

             

               

            void UsbEpEvt_err_Cb(CyU3PUsbEpEvtType evType, CyU3PUSBSpeed_t usbSpeed,

               

            uint8_t epNum) {

               

            if (CY_U3P_SUPER_SPEED != usbSpeed)

               

            return;

               

            if (epNum != CY_FX_EP_CONSUMER)

               

            return;

               

            switch (evType) {

               

            case CYU3P_USBEP_NAK_EVT:

               

            CyU3PDebugPrint(4, "CYU3P_USBEP_NAK_EVT\r\n");

               

            break;

               

            case CYU3P_USBEP_ZLP_EVT:

               

            CyU3PDebugPrint(4, "CYU3P_USBEP_ZLP_EVT\r\n");

               

            break;

               

            case CYU3P_USBEP_SLP_EVT:

               

            CyU3PDebugPrint(4, "CYU3P_USBEP_SLP_EVT\r\n");

               

            break;

               

            case CYU3P_USBEP_ISOERR_EVT:

               

            CyU3PDebugPrint(4, "CYU3P_USBEP_ISOERR_EVT\r\n");

               

            break;

               

            case CYU3P_USBEP_SS_RETRY_EVT:

               

            CyU3PDebugPrint(4, "CYU3P_USBEP_SS_RETRY_EVT\r\n");

               

            break;

               

            case CYU3P_USBEP_SS_SEQERR_EVT:

               

            CyU3PDebugPrint(4, "CYU3P_USBEP_SS_SEQERR_EVT\r\n");

               

            break;

               

            case CYU3P_USBEP_SS_STREAMERR_EVT:

               

            CyU3PDebugPrint(4, "CYU3P_USBEP_SS_STREAMERR_EVT\r\n");

               

            break;

               

            default:

               

            break;

               

            }

               

            }

               

            It will print "CYU3P_USBEP_NAK_EVT"message if the streamer get data normal,but as soon as streamer failed to get data, it print nothing too,as if the endpoint  stall the in-request or can not get the in-token.

               

            but then i use the code below, it print "isNak:0,isStall:0"and "CyU3PDmaChannelGetStatus-state:2“messages

               

            {

               

             

               

             

               

                    CyBool_t isNak, isStall;

               

             

               

                    CyU3PDmaState_t state;

               

            uint32_t prodXferCount;

               

            uint32_t  consXferCount;

               

             

               

            CyU3PReturnStatus_t cyup3status;

               

            cyup3status=CyU3PUsbGetEpCfg(CY_FX_EP_CONSUMER, &isNak, &isStall);

               

            if(cyup3status==CY_U3P_SUCCESS){

               

               CyU3PDebugPrint(4, "isNak:%d,isStall:%d\r\n", isNak, isStall);

               

            }

               

             

               

            cyup3status =CyU3PDmaChannelGetStatus(&glChHandleSlFifoPtoU,&state,&prodXferCount,&consXferCount);

               

                if(cyup3status==CY_U3P_SUCCESS){

               

                CyU3PDebugPrint(4, "CyU3PDmaChannelGetStatus-state:%d\r\n", state);

               

                }

               

             

               

            }

               

            from the messages printed,it seems normal,but PC can not get data at all.

               

            and the issue was found at USBBulkSourceSink too.

            • 3. Re: Is there any chance to refresh DMA channel or Bulk-In endpoint  Automatically
              meiming_1674436

              I meet the problem like you,did you solve the problem now?Thanks!