CY_U3P_DMA_CB_CONS_EVENT on a P2U OR U2U Auto signal channel

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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!

0 Likes
5 Replies
Anonymous
Not applicable

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

   

Regards,

   

sai krishna.

0 Likes
Anonymous
Not applicable

 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!

0 Likes
Anonymous
Not applicable

 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.

0 Likes
Anonymous
Not applicable

 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!

0 Likes
Anonymous
Not applicable

 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.    
   
0 Likes