Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > CY_U3P_ERROR_MEMORY_ERROR

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



CY_U3P_ERROR_MEMORY_ERROR
Moderator:
RSKV

Post Reply
Follow this topic



CY_U3P_ERROR_MEMORY_ERROR

Garyio posted on 10 Sep 2012 6:53 PM PST
Member
8 Forum Posts

I am working on a video capture card based on the GPIFII to image sensor (AN75779) document and examples. I have my own board with an FX3 on it. I am using SDK V1.2.

When I set the MultiChannel DMA to have a size of 1024 and a count of 16 I get the CY_U3P_ERROR_MEMORY_ERROR error when I call CyU3PDmaMultiChannelCreate. If I set the count to 10 the call is successful. I know the document says to use the fx3.ld file that comes with the project and I am but I still get the error. I see that there are several changes in the fx3.ld file that comes with the SDK V1.2. What can I do to make this work?




Re: CY_U3P_ERROR_MEMORY_ERROR

RSKV posted on 16 Sep 2012 12:02 AM PST
Cypress Employee
655 Forum Posts

What is the total size of the buffer that you are trying to create.

You should be able to create total size of around 252KB buffer for your DMA channel.



Re: CY_U3P_ERROR_MEMORY_ERROR

Garyio posted on 16 Sep 2012 07:13 PM PST
Member
8 Forum Posts

Thank you sai krishna,

I think I have figured this out. I was wrong about the settings I had in the post. I have created an endpoint that has a size of 1024 and a burst of 16. Then I created a Multi Channel DMA with a size of 16K and a count of 8. That is what was failing. I changed the count to 6 and now it works. I think the reason I can not allocate 8 DMA buffers is because I have other endpoints and DMA channels that use memory. Does that make sense?

Here is some of my code:

/* UVC Video Streaming Endpoint Packet Size */
#define CY_FX_EP_BULK_VIDEO_PKT_SIZE            0x400          // 1024 Bytes

/* UVC Video Streaming Endpoint Packet Count */
#define CY_FX_EP_BULK_VIDEO_PKTS_COUNT          16

// UVC Buffer size - Will map to BULK Transaction size
#define CY_FX_UVC_STREAM_BUF_SIZE                  (CY_FX_EP_BULK_VIDEO_PKTS_COUNT * CY_FX_EP_BULK_VIDEO_PKT_SIZE)       // 16K
#define CY_FX_USB_EP_PKT_SIZE                    32                            // USB Endpoint Max packet size
#define CY_FX_USB_DMA_BUF_SIZE                   32                            // USB FW channel buffer size
#define CY_FX_USB_DMA_BUF_COUNT                  1                           // USB FW channel buffer count
 

    // Set the Endpoint Configurations
    // Producer Endpoint configuration
    endPointConfig.enable = 1;
    endPointConfig.epType = CY_U3P_USB_EP_BULK;
    endPointConfig.pcktSize = CY_FX_USB_EP_PKT_SIZE;
    //endPointConfig.isoPkts = 1;
    endPointConfig.burstLen = 1;
    endPointConfig.streams = 0;

    // Configure the Endpoint
    apiRetStatus = CyU3PSetEpConfig(CY_FX_EP_PRODUCER, &endPointConfig);
    if (apiRetStatus != CY_U3P_SUCCESS)
        CyFxAppErrorHandler(apiRetStatus);

    // Consumer Endpoint configuration
    endPointConfig.enable = 1;
    endPointConfig.epType = CY_U3P_USB_EP_BULK;
    endPointConfig.pcktSize = CY_FX_USB_EP_PKT_SIZE;
    //endPointConfig.isoPkts = 1;
    endPointConfig.burstLen = 1;
    endPointConfig.streams = 0;

    // Configure the Endpoint
    apiRetStatus = CyU3PSetEpConfig(CY_FX_EP_CONSUMER, &endPointConfig);
    if (apiRetStatus != CY_U3P_SUCCESS)
        CyFxAppErrorHandler(apiRetStatus);

    // Consumer Endpoint 2 configuration
    endPointConfig.enable = 1;
    endPointConfig.epType = CY_U3P_USB_EP_BULK;
    endPointConfig.pcktSize = CY_FX_EP_BULK_VIDEO_PKT_SIZE;
    endPointConfig.isoPkts = 1;
    endPointConfig.burstLen = CY_FX_EP_BULK_VIDEO_PKTS_COUNT;
    endPointConfig.streams = 0;

    // Configure the Endpoint
    apiRetStatus = CyU3PSetEpConfig(CY_FX_EP_BULK_VIDEO, &endPointConfig);
    if (apiRetStatus != CY_U3P_SUCCESS)
        CyFxAppErrorHandler(apiRetStatus);

    // Create a DMA Manual IN channel between USB Producer socket and the CPU
    dmaUsbConfig.size = CY_FX_USB_DMA_BUF_SIZE;
    dmaUsbConfig.count = CY_FX_USB_DMA_BUF_COUNT;
    dmaUsbConfig.prodSckId = CY_FX_EP_PRODUCER_SOCKET;
    dmaUsbConfig.consSckId = CY_U3P_CPU_SOCKET_CONS;
    dmaUsbConfig.dmaMode = CY_U3P_DMA_MODE_BYTE;
    dmaUsbConfig.notification = CY_U3P_DMA_CB_PROD_EVENT;
    dmaUsbConfig.cb = CyFxUsbDmaCallback;
    //dmaUsbConfig.cb = NULL;
    dmaUsbConfig.prodHeader = 0;
    dmaUsbConfig.prodFooter = 0;
    dmaUsbConfig.consHeader = 0;
    dmaUsbConfig.prodAvailCount = 0;

    // Create the channel
    apiRetStatus = CyU3PDmaChannelCreate (&glChHandleUsb2Fw, CY_U3P_DMA_TYPE_MANUAL_IN, &dmaUsbConfig);
    if (apiRetStatus != CY_U3P_SUCCESS)
        CyFxAppErrorHandler(apiRetStatus);

    // Create a DMA Manual OUT channel between CPU and USB consumer socket
    dmaUsbConfig.size = CY_FX_USB_DMA_BUF_SIZE;
    dmaUsbConfig.count = CY_FX_USB_DMA_BUF_COUNT;
    dmaUsbConfig.prodSckId = CY_U3P_CPU_SOCKET_PROD;
    dmaUsbConfig.consSckId = CY_FX_EP_CONSUMER_SOCKET;
    dmaUsbConfig.dmaMode = CY_U3P_DMA_MODE_BYTE;
    dmaUsbConfig.notification = CY_U3P_DMA_CB_CONS_EVENT;
    dmaUsbConfig.cb = NULL;
    dmaUsbConfig.prodHeader = 0;
    dmaUsbConfig.prodFooter = 0;
    dmaUsbConfig.consHeader = 0;
    dmaUsbConfig.prodAvailCount = 0;

    // Create the channel
    apiRetStatus = CyU3PDmaChannelCreate (&glChHandleFw2Usb, CY_U3P_DMA_TYPE_MANUAL_OUT, &dmaUsbConfig);
    if (apiRetStatus != CY_U3P_SUCCESS)
        CyFxAppErrorHandler(apiRetStatus);
   
        // Create a DMA Manual OUT channel between CPU and USB consumer socket
    dmaMultiConfig.size = CY_FX_UVC_STREAM_BUF_SIZE;
    dmaMultiConfig.count = 6; //CY_FX_USB_DMA_BUF_COUNT;
    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_FX_EP_CONSUMER3_SOCKET;
    dmaMultiConfig.prodAvailCount = 0;
    dmaMultiConfig.prodHeader = 0;
    dmaMultiConfig.prodFooter = 0;
    dmaMultiConfig.consHeader = 0;
    dmaMultiConfig.dmaMode = CY_U3P_DMA_MODE_BYTE;
    dmaMultiConfig.notification =  CY_U3P_DMA_CB_PROD_EVENT | CY_U3P_DMA_CB_CONS_EVENT;
    dmaMultiConfig.cb = CyFxDMACallback;

    // Create the channel
    apiRetStatus = CyU3PDmaMultiChannelCreate (&glChHandleUVCStream, CY_U3P_DMA_TYPE_MANUAL_MANY_TO_ONE , &dmaMultiConfig);
    if (apiRetStatus != CY_U3P_SUCCESS)
        CyFxAppErrorHandler(apiRetStatus);
 



Re: CY_U3P_ERROR_MEMORY_ERROR

RSKV posted on 17 Sep 2012 10:03 PM PST
Cypress Employee
655 Forum Posts

Yes Garyio, your understanding is right.

Regards,

sai krishna.






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.