cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

heanc_1330791
New Contributor II

Hi,

   

I am developing a custom camera application derived from the UVC example. I don't need to insert the UVC header for my application, so the CPU does not need to be interrupted to modify the Bulk transfer data on DMA commit. I'm trying to get rid of the Callback by using the DMA in AUTO_MANY_TO_ONE. However the host always reports failed Xfers (0 bytes received) unless I alter the data count value(partially corrupted data due to some skipped bytes in between, but at least I get something). I include my DMA Channel and GPIF setup, maybe I'm just doing something stupid or missing something.

   

<code>

   

/* Configure the video streaming endpoint. */
    endPointConfig.enable = 1;
    endPointConfig.epType = CY_U3P_USB_EP_BULK;
    endPointConfig.pcktSize = CY_FX_EP_BULK_VIDEO_PKT_SIZE;
    endPointConfig.isoPkts = 1;
    endPointConfig.burstLen = 16;
    endPointConfig.streams = 0;
    apiRetStatus = CyU3PSetEpConfig(CY_FX_EP_BULK_VIDEO, &endPointConfig);

   

/* Create a DMA Manual channel for sending the video data to the USB host. */
    dmaMultiConfig.size = CY_FX_UVC_STREAM_BUF_SIZE; // 32kB
    dmaMultiConfig.count = CY_FX_UVC_STREAM_BUF_COUNT; // 3
    dmaMultiConfig.validSckCount = 2;
    dmaMultiConfig.prodSckId[0] = (CyU3PDmaSocketId_t) CY_U3P_PIB_SOCKET_0;
    dmaMultiConfig.prodSckId[1] = (CyU3PDmaSocketId_t) CY_U3P_PIB_SOCKET_1;
    dmaMultiConfig.consSckId[0] = (CyU3PDmaSocketId_t) (CY_U3P_UIB_SOCKET_CONS_0
            | CY_FX_EP_VIDEO_CONS_SOCKET);
    dmaMultiConfig.prodAvailCount = 0;

   

    dmaMultiConfig.prodHeader = 0; /* 12 byte UVC header to be added. */
    dmaMultiConfig.prodFooter = 0;

   

    /* 4 byte footer to compensate for the 12 byte header. */
    dmaMultiConfig.consHeader = 0;
    dmaMultiConfig.dmaMode = CY_U3P_DMA_MODE_BYTE;
    dmaMultiConfig.notification = CY_U3P_DMA_CB_CONS_EVENT
            | CY_U3P_DMA_CB_PROD_EVENT;
    dmaMultiConfig.cb = CyFxUvcApplnDmaCallback;
    apiRetStatus = CyU3PDmaMultiChannelCreate(&glChHandleUVCStream,
            CY_U3P_DMA_TYPE_AUTO_MANY_TO_ONE, &dmaMultiConfig);

   

/* Start the state machine from the designated start state. */

   

    CyU3PGpifInitDataCounter(0, (CY_FX_UVC_BUF_FULL_SIZE / (BUS_WIDTH / 8)-2),
    RELOAD, UP_COUNT, 1);

   

</code>

   

Please let me know if I'm doing something horribly wrong, missing something or if you need additional information.

   

Thanks in advance.

0 Likes
3 Replies