3 Replies Latest reply on Jul 9, 2013 10:23 PM by junliang.yu

    USB2.0 second endpoint (0x82) doesn't work

    a.p
              We are using FX3 chip connected to DSP and to PC with 2.0 USB interface. The operating system is Windows XP (SP3). The driver is installed from SDK (winxp). We are using USB Control Center application to read data from endpoints. We use 4 enpoints 0x1 0x81 0x2 0x82 0x2 & 0x82 are added in a standart slave fifo dma application( will add files with code later) So 0x1 & 0x81 endpoints works good on any pc with xp, win7 in usb2.0 and 3.0 modes. The fx3 is connected to dsp ts201. But we get strange problems with 0x2 and 0x82 endpoints. On notebook with win7 in controlcenter reading from 0x82 in usb2.0 mode produces 8 packets of 64 bytes. In usb3.0 mode sometimes it is error 997 sometimes it is ok, 1024 bytes received. On another pc, with winxp, using usb 2.0 mode 0x82 endpoit doesn't work at all. error 997 in control center, and in our SW from VisualStudio the error is 0x0000001f A device attachec to the system is not funtioning. Using same pc with winxp but attached to usb3.0 (entron pci controller) the same bad results. Below is project files. This is fifoasync.c part of file /* Create a DMA MANUAL channel for U2P transfer. * DMA size is set based on the USB speed. */ dmaCfg.size = size; dmaCfg.count = CY_FX_SLFIFO_DMA_BUF_COUNT; dmaCfg.prodSckId = CY_FX_PRODUCER_USB_SOCKET; dmaCfg.consSckId = CY_FX_CONSUMER_PPORT_SOCKET; dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE; /* Enabling the callback for produce event. */ dmaCfg.notification = CY_U3P_DMA_CB_PROD_EVENT; dmaCfg.cb = CyFxSlFifoUtoPDmaCallback; dmaCfg.prodHeader = 0; dmaCfg.prodFooter = 0; dmaCfg.consHeader = 0; dmaCfg.prodAvailCount = 0; apiRetStatus = CyU3PDmaChannelCreate (&glChHandleSlFifoUtoP, CY_U3P_DMA_TYPE_MANUAL, &dmaCfg); if (apiRetStatus != CY_U3P_SUCCESS) { CyU3PDebugPrint (4, "CyU3PDmaChannelCreate failed, Error code = %d\n", apiRetStatus); CyFxAppErrorHandler(apiRetStatus); } else { CyU3PDebugPrint (4, "CyU3PDmaChannelCreate UtoP success, code = %d\n", apiRetStatus); } /* Create a DMA MANUAL channel for P2U transfer. */ dmaCfg.prodSckId = CY_FX_PRODUCER_PPORT_SOCKET; dmaCfg.consSckId = CY_FX_CONSUMER_USB_SOCKET; dmaCfg.cb = CyFxSlFifoPtoUDmaCallback; apiRetStatus = CyU3PDmaChannelCreate (&glChHandleSlFifoPtoU, CY_U3P_DMA_TYPE_MANUAL, &dmaCfg); if (apiRetStatus != CY_U3P_SUCCESS) { CyU3PDebugPrint (4, "CyU3PDmaChannelCreate failed, Error code = %d\n", apiRetStatus); CyFxAppErrorHandler(apiRetStatus); } else { CyU3PDebugPrint (4, "CyU3PDmaChannelCreate PtoU success, code = %d\n", apiRetStatus); } /*********************************** *ABORT PIPE *******************************************************/ dmaCfg.size = size; dmaCfg.count = CY_FX_SLFIFO_DMA_BUF_COUNT; dmaCfg.prodSckId = CY_FX_ABORT_OUT_USB_SOCKET; dmaCfg.consSckId = CY_FX_AIN_PPORT_SOCKET; dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE; /* Enabling the callback for produce event. */ dmaCfg.notification = CY_U3P_DMA_CB_PROD_EVENT; dmaCfg.cb = CyFxSlFifoUtoPDmaCallbackA; dmaCfg.prodHeader = 0; dmaCfg.prodFooter = 0; dmaCfg.consHeader = 0; dmaCfg.prodAvailCount = 0; apiRetStatus = CyU3PDmaChannelCreate ( &glChHandleSlFifoUtoP_A, CY_U3P_DMA_TYPE_MANUAL, &dmaCfg); if (apiRetStatus != CY_U3P_SUCCESS) { CyU3PDebugPrint (4, "CyU3PDmaChannelCreate AbortPipe UtoP failed, Error code = %d\n", apiRetStatus); CyFxAppErrorHandler(apiRetStatus); } else { CyU3PDebugPrint (4, "CyU3PDmaChannelCreate AbortPipe UtoP success, code = %d\n", apiRetStatus); } //********************************************************************************************// dmaCfg.prodSckId = CY_FX_AOUT_PPORT_SOCKET; dmaCfg.consSckId = CY_FX_ABORT_IN_USB_SOCKET; dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE; /* Enabling the callback for produce event. */ dmaCfg.notification = CY_U3P_DMA_CB_PROD_EVENT; dmaCfg.cb = CyFxSlFifoPtoUDmaCallbackA; //**************************************// apiRetStatus = CyU3PDmaChannelCreate ( &glChHandleSlFifoPtoU_A, CY_U3P_DMA_TYPE_MANUAL, &dmaCfg); if (apiRetStatus != CY_U3P_SUCCESS) { CyU3PDebugPrint (4, "CyU3PDmaChannelCreate AbortPipe PtoUfailed, Error code = %d\n", apiRetStatus); CyFxAppErrorHandler(apiRetStatus); }else { CyU3PDebugPrint (4, "CyU3PDmaChannelCreate AbortPipe PtoU success, code = %d\n", apiRetStatus); } /*****************************************************/ /* Flush the Endpoint memory */ CyU3PUsbFlushEp(CY_FX_EP_PRODUCER); CyU3PUsbFlushEp(CY_FX_EP_CONSUMER); CyU3PUsbFlushEp(CY_FX_EP_ABORT_OUT); CyU3PUsbFlushEp(CY_FX_EP_ABORT_IN); /* Set DMA channel transfer size. */ apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleSlFifoUtoP, CY_FX_SLFIFO_DMA_TX_SIZE); if (apiRetStatus != CY_U3P_SUCCESS) { CyU3PDebugPrint (4, "CyU3PDmaChannelSetXfer Failed, Error code = %d\n", apiRetStatus); CyFxAppErrorHandler(apiRetStatus); } apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleSlFifoPtoU, CY_FX_SLFIFO_DMA_RX_SIZE); if (apiRetStatus != CY_U3P_SUCCESS) { CyU3PDebugPrint (4, "CyU3PDmaChannelSetXfer Failed, Error code = %d\n", apiRetStatus); CyFxAppErrorHandler(apiRetStatus); } /*******************************************************************/ apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleSlFifoUtoP_A, CY_FX_SLFIFO_DMA_TX_SIZE); if (apiRetStatus != CY_U3P_SUCCESS) { CyU3PDebugPrint (4, "CyU3PDmaChannelSetXfer Failed, Error code = %d\n", apiRetStatus); CyFxAppErrorHandler(apiRetStatus); } else { CyU3PDebugPrint (4, "CyU3PDmaChannelSetXfer success, code = %d\n", apiRetStatus); } apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleSlFifoPtoU_A, CY_FX_SLFIFO_DMA_RX_SIZE); if (apiRetStatus != CY_U3P_SUCCESS) { CyU3PDebugPrint (4, "CyU3PDmaChannelSetXfer Failed, Error code = %d\n", apiRetStatus); CyFxAppErrorHandler(apiRetStatus); } else { CyU3PDebugPrint (4, "CyU3PDmaChannelSetXfer success, code = %d\n", apiRetStatus); } /********************************************************************/ this is async.h file /* 16/32 bit GPIF Configuration select */ /* Set CY_FX_SLFIFO_GPIF_16_32BIT_CONF_SELECT = 0 for 16 bit GPIF data bus. * Set CY_FX_SLFIFO_GPIF_16_32BIT_CONF_SELECT = 1 for 32 bit GPIF data bus. */ #define CY_FX_SLFIFO_GPIF_16_32BIT_CONF_SELECT (1) #define CY_FX_SLFIFO_DMA_BUF_COUNT (1) /* Slave FIFO channel buffer count */ #define CY_FX_SLFIFO_DMA_TX_SIZE (0) /* DMA transfer size is set to infinite */ #define CY_FX_SLFIFO_DMA_RX_SIZE (0) /* DMA transfer size is set to infinite */ #define CY_FX_SLFIFO_THREAD_STACK (0x0400) /* Slave FIFO application thread stack size */ #define CY_FX_SLFIFO_THREAD_PRIORITY (8) /* Slave FIFO application thread priority */ /* Endpoint and socket definitions for the Slave FIFO application */ /* To change the Producer and Consumer EP enter the appropriate EP numbers for the #defines. * In the case of IN endpoints enter EP number along with the direction bit. * For eg. EP 6 IN endpoint is 0x86 * and EP 6 OUT endpoint is 0x06. * To change sockets mention the appropriate socket number in the #defines. */ /* Note: For USB 2.0 the endpoints and corresponding sockets are one-to-one mapped i.e. EP 1 is mapped to UIB socket 1 and EP 2 to socket 2 so on */ #define CY_FX_EP_PRODUCER 0x01 /* EP 1 OUT */ #define CY_FX_EP_CONSUMER 0x81 /* EP 1 IN */ #define CY_FX_EP_ABORT_OUT 0x02 /* EP 2 OUT */ #define CY_FX_EP_ABORT_IN 0x82 /* EP 2 IN */ #define CY_FX_PRODUCER_USB_SOCKET CY_U3P_UIB_SOCKET_PROD_1 /* USB Socket 1 is producer */ #define CY_FX_CONSUMER_USB_SOCKET CY_U3P_UIB_SOCKET_CONS_1 /* USB Socket 1 is consumer */ #define CY_FX_ABORT_OUT_USB_SOCKET CY_U3P_UIB_SOCKET_PROD_2 /* USB Socket 2 is producer */ #define CY_FX_ABORT_IN_USB_SOCKET CY_U3P_UIB_SOCKET_CONS_2 /* USB Socket 2 is consumer */ /* Used with FX3 Silicon. */ #define CY_FX_PRODUCER_PPORT_SOCKET CY_U3P_PIB_SOCKET_2 /* P-port Socket 0 is producer */ #define CY_FX_CONSUMER_PPORT_SOCKET CY_U3P_PIB_SOCKET_0 /* P-port Socket 3 is consumer */ #define CY_FX_AOUT_PPORT_SOCKET CY_U3P_PIB_SOCKET_3 /* P-port Socket 1 is producer */ #define CY_FX_AIN_PPORT_SOCKET CY_U3P_PIB_SOCKET_1 /* P-port Socket 2 is consumer */ Could you provide some ideas what is wrong and were to look for errors? regards Oleg K. Alex P.