Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > CY_U3P_DMA_CB_CONS_EVENT on a P2U OR U2U Auto signal channel

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



CY_U3P_DMA_CB_CONS_EVENT on a P2U OR U2U Auto signal channel
Moderator:
RSKV

Post Reply
Follow this topic



CY_U3P_DMA_CB_CONS_EVENT on a P2U OR U2U Auto signal channel

JTZheng posted on 02 Jul 2012 11:06 PM PST
Member
5 Forum Posts

Hi, i can't get the CY_U3P_DMA_CB_CONS_EVENT working on a P2U or U2U channel's callback, we have a new board which has a P2U channel, all data received (by host vis USB) correctly, the callback gets the PROD_EVENT as expected,  but not the CONS_EVENT... i'm using the

 dmaCfg.notification = (CY_U3P_DMA_CB_PROD_EVENT|CY_U3P_DMA_CB_CONS_EVENT);

for the callback notification type.

And i test on the DVK with the USBBulkLoopAutoSignal sample code (and the "BulkLoop.exe" on host), it has an auto-signal U2U channel, and it had the same result.

The modifications i made on the sample code are:

*. When create the channel , i use

 dmaCfg.notification = (CY_U3P_DMA_CB_PROD_EVENT|CY_U3P_DMA_CB_CONS_EVENT);

*. In the Channel callback, i add

if (type == CY_U3P_DMA_CB_CONS_EVENT)   glConsEventCount++;   // glConsEventCount is initialized to 0 in startup.

*. And in the thread loop, i print the glConsEventCount as:

CyU3PDebugPrint( 6, "Data tracker: Number of buffer received: %d , %d\n", glDMARxCount, glConsEventCount );

The glConsEventCount is always ZERO when the "BulkLoop" is running and data are looped. (while the glDMARxCount is increased as expected).

I did some more tries, e.g. using CY_U3P_DMA_CB_CONS_EVENT only (no CY_U3P_DMA_CB_PROD_EVENT), OR

using CY_U3P_DMA_MODE_BUFFER instead of CY_U3P_DMA_MODE_BYTE....etc. but all had the same results.

Is there any more cofiguration needed to make the CONS_EVENT working on an Auto_Signal channel?

Thanks!

 

 

 

 




Re: CY_U3P_DMA_CB_CONS_EVENT on a P2U OR U2U Auto signal channel

RSKV posted on 02 Jul 2012 11:32 PM PST
Cypress Employee
655 Forum Posts

Please have a look at the USBBulkSourceSink example code. It uses the CY_U3P_DMA_CB_CONS_EVENT.

Regards,

sai krishna.



Re: CY_U3P_DMA_CB_CONS_EVENT on a P2U OR U2U Auto signal channel

JTZheng posted on 02 Jul 2012 01:22 AM PST
Member
5 Forum Posts

 Sai,

Thanks...the USBBulkSourceSink example code works fine on my DVK, the CY_U3P_DMA_CB_CONS_EVENT generated in the callback, however, as the related channel is a MANUAL_OUT in this example code (i checked the sample codes, and it seems that this is the only major difference from the USBBulkLoopAutoSignal sample code for the DMA channel setup)... But we can only use AUTO_SIGNAL channel in our application.

Rgds!



Re: CY_U3P_DMA_CB_CONS_EVENT on a P2U OR U2U Auto signal channel

RSKV posted on 02 Jul 2012 01:44 AM PST
Cypress Employee
655 Forum Posts

 Right.

When you are using AUTO channels, data will be committed automatically. 

when you are using MANUAL channels then you need to look for events in call back functions and you need to call "CyU3PDmaChannelCommitBuffer" to commit data.

Regards,

sai krishna.



Re: CY_U3P_DMA_CB_CONS_EVENT on a P2U OR U2U Auto signal channel

JTZheng posted on 02 Jul 2012 04:31 PM PST
Member
5 Forum Posts

 Sai,

   Thanks...I understand that for Auto channel, the data are automatically commited...that's why we use it as manually commit a buffer takes too much time which limits the effective data bandwidth.

   I re-read the docs (programming manual) and it seems that for an Auto Signaling Channel, the only event generated is the PROD_EVENT...so i guess there will be no CONS_EVENT for an Auto Signaling Channel.

Rgds!

 

 



Re: CY_U3P_DMA_CB_CONS_EVENT on a P2U OR U2U Auto signal channel

Ayi posted on 22 Aug 2012 10:03 PM PST
Top Contributor
23 Forum Posts

 Hi 

 

 

           dmaSlFifoConfig.size = size * 16;//CY_FX_ENDPOINT_BULK_BURST;

            dmaSlFifoConfig.count = CY_FX_SLFIFO_DMA_BUF_COUNT;

            dmaSlFifoConfig.prodSckId = (CyU3PDmaSocketId_t)(CY_FX_EP_PRODUCER_PPORT_SOCKET);

            dmaSlFifoConfig.consSckId = (CyU3PDmaSocketId_t)(CY_U3P_UIB_SOCKET_CONS_0 | CY_FX_EP_CONSUMER_USB_SOCKET);

            dmaSlFifoConfig.dmaMode = CY_U3P_DMA_MODE_BYTE;

            dmaSlFifoConfig.notification = CY_U3P_DMA_CB_PROD_EVENT;

            dmaSlFifoConfig.cb = CyFxSlFifoPtoUDmaCallback;

            //dmaSlFifoConfig.cb = NULL;

            dmaSlFifoConfig.prodHeader = 0;

            dmaSlFifoConfig.prodFooter = 0;

            dmaSlFifoConfig.consHeader = 0;

            dmaSlFifoConfig.prodAvailCount = 0;

            /* Create the channel */

            apiRetStatus = CyU3PDmaChannelCreate (&glChHandleSlFifoPtoU,

CY_U3P_DMA_TYPE_MANUAL,

                                                  &dmaSlFifoConfig);

/* DMA Callback function to handle the Produce Events for P to U transfers */
void
CyFxSlFifoPtoUDmaCallback (
        CyU3PDmaChannel   *chHandle,    /* Handle to the DMA channel. */
        CyU3PDmaCbType_t  type,         /* Callback type.             */
        CyU3PDmaCBInput_t *input        /* Callback status.         */
        )
{
    CyU3PReturnStatus_t apiRetStatus;
 
    /* This is a produce event notification to the CPU */
    /* This notification is received upon reception of every buffer */
    /* Buffer contents could be modified if necessary */
    /* Commit the buffer for transfer */
    /* Buffer status to be handled internally by DMA */
    CyU3PDebugPrint (4, "\nCyU3PDmaChannelCommitBuffer p to U input->buffer_p.count = %d \n",input->buffer_p.count);
    apiRetStatus = CyU3PDmaChannelCommitBuffer (chHandle, input->buffer_p.count,0);
    CyU3PDebugPrint (4, "\nCyU3PDmaChannelCommitBuffer p to U \n");
    if (apiRetStatus != CY_U3P_SUCCESS)
    {
        /* Error handling */
        CyU3PDebugPrint (4, "P to U DMA MANUAL Channel Commit Buffer Failed, Error Code = %d\n",apiRetStatus);
    }
 
}
 
I create a P to U DMA channel as above ,Then FPGA write data to usb by GPIF ,if the data size is less than 0x320 it works well .but when data size is more i can't receive any data. CyFxSlFifoPtoUDmaCallback even does not come in.






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.