7 Replies Latest reply on Sep 18, 2013 10:02 PM by yu.jj

    CyU3PDmaMultiChannelCreate failed (error code 64), why ??

    yu.jj

         By doing  my project , I found that   it is diffculty  to  develop a composite video devices. And now the error is puzzle me . I do not why?  Can somebody give me some advices??

         

        From te  FX3Api.pdf,  I found that the cypress support multi-DMA channels ,  and I choose the multicast mode . and in my project is one producer - two consumer.  And I read the sdk sample "usbbulkloopmulticast" and fx3api.pdf.  Then I  follow the sdk sample to create the multichannel , and I have examined several times , and I think there are no errors, But If I run the application , the log reports that the channel is create fail  and the error code is 64,  And I check what means about 64, It means that the parameters invalid , but I think  all the parameters are right ?  Why ?? Can which parameter is error ???

         

       

         

        /* Create a DMA Manual OUT channel for streaming data */

         

          /* Video streaming Channel is not active till a stream request is received */

         

          dmaCfg.size = CY_FX_UVC_STREAM_BUF_SIZE;     //1024

         

          dmaCfg.validSckCount = 2;

         

          dmaCfg.count = CY_FX_UVC_STREAM_BUF_COUNT;    // 8 

         

          dmaCfg.prodSckId[0] = CY_U3P_CPU_SOCKET_PROD;

         

          dmaCfg.consSckId[0]  = CY_FX_EP_VIDEO_CONS_SOCKET; // (CONS_1 )

         

          dmaCfg.consSckId [1]= CY_FX_EP_VIDEO_CONS_SOCKET_2;  // (CONS_3)

         

          dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;

         

          dmaCfg.notification =0;

         

          dmaCfg.cb = NULL;

         

          dmaCfg.prodHeader = 0;

         

          dmaCfg.prodFooter = 0;

         

          dmaCfg.consHeader = 0;

         

          dmaCfg.prodAvailCount = 0;

         

       

         

         apiRetStatus = CyU3PDmaMultiChannelCreate (&glChMultiHandleUVCStream,

         

                 CY_U3P_DMA_TYPE_MANUAL_ONE_TO_MANY , &dmaCfg);//CY_U3P_DMA_TYPE_MULTICAST

         

          if (apiRetStatus != CY_U3P_SUCCESS)

         

          {

         

              CyU3PDebugPrint (4, "CyU3PDmaMultiChannelCreate failed, Error code = %d\n", apiRetStatus);

         

              CyFxAppErrorHandler(apiRetStatus);

         

          }

         
              
         
              
         
          And the  "CyU3PDmaEnableMulticast"   have been called in  CyFxUVCApplnInit  .   
         
              
         
              
         
              
         
              
        • 1. Re: CyU3PDmaMultiChannelCreate failed (error code 64), why ??
          rama.sai.krishna.vakkantula

                                                                 

             

          Hi,    

           

             

              

                    

             

          We need to provide callback function name and the notification when we are creating a MANUAL channel.    

           

             

          Please try changing them as shown below:    

           

             

              

                    

             

          dmaCfg.notification = CY_U3P_DMA_CB_PROD_EVENT;     

           

             

              dmaCfg.cb = CyFxBulkLpDmaCallback;     

           

             

               

                      

             

          If you are trying to multicast the same data then we also have a DMA channel of type "CY_U3P_DMA_TYPE_MULTICAST".     

           

             

               

                      

             

          Thanks,    

           

             

          Sai Krishna.    

          • 2. Re: CyU3PDmaMultiChannelCreate failed (error code 64), why ??
            yu.jj

             Dear  Sai ,

               

                I have  tried it before,  the multi channels can be  created in success! 

               

                In you reply post, you say that: cb and callback function are required.  However,  in the SDK sample( e.g. usbbulkloopautomanytoone)  ,  the dma cfg parameter to create multi channels is list as:

               

               /* Create a DMA AUTO_MANY_TO_ONE channel between

               

                 * the producer and consumer sockets of the U port.

               

                 * DMA size is set based on the USB speed. */

               

                dmaCfg.size  = size;

               

                dmaCfg.count = CY_FX_BULKLP_DMA_BUF_COUNT;

               

                dmaCfg.validSckCount = 2;

               

                dmaCfg.prodSckId[0] = CY_FX_EP_PRODUCER_1_SOCKET;

               

                dmaCfg.prodSckId[1] = CY_FX_EP_PRODUCER_2_SOCKET;

               

                dmaCfg.consSckId[0] = CY_FX_EP_CONSUMER_SOCKET;

               

                dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;

               

                dmaCfg.notification = 0;

               

                dmaCfg.cb = NULL;

               

                dmaCfg.prodHeader = 0;

               

                dmaCfg.prodFooter = 0;

               

                dmaCfg.consHeader = 0;

               

                dmaCfg.prodAvailCount = 0;

               

             

               

                apiRetStatus = CyU3PDmaMultiChannelCreate (&glChHandleBulkLp,

               

                        CY_U3P_DMA_TYPE_AUTO_MANY_TO_ONE, &dmaCfg);

               

             

               

              you can see the red statements is same as my project.

               

             

               

            why the sample project can run in success???

            • 3. Re: CyU3PDmaMultiChannelCreate failed (error code 64), why ??
              yu.jj

               Dear sir,

                 

                 I do not know  hwo the callback function  working??    In my project after add the callback function, but I found that the callback function is not been called .

                 

               

                 

                 Then in chapter "CyU3PDmaMultiChannelGetBuffer" in the FX3APi.pdf said:  This function is generally for manual mode operations.  So if I chosen the multicast mode, this function  will return fail? And in my project , I found I can not get the buffer (error code :69 ) .

                 

                 Thanks! 

              • 4. Re: CyU3PDmaMultiChannelCreate failed (error code 64), why ??
                rama.sai.krishna.vakkantula

                 Hi,

                   

                    

                 

                   

                    

                          

                   

                You need to use a callback function only when you are using a DMA channel of type Manual.    

                 

                   

                It is not required for AUTO type of DMA channels. Data will be transferred without intervention of CPU. That is the reason why you are not seeing any error in the SDK example project (usbbulkloopautomanytoone).    

                 

                   

                But in case of Manual DMA channel, you need to call commitbuffer in the callback function to commit packets to the USB host.    

                 

                   

                    

                          

                   

                Thanks,    

                 

                   

                Sai Krishna.    

                • 5. Re: CyU3PDmaMultiChannelCreate failed (error code 64), why ??
                  yu.jj

                  Dear RSKA,

                     

                      Thank you for your reply.  and you said:

                     

                         But in case of Manual DMA channel, you need to call commitbuffer in the callback function to commit packets to the USB host.

                     

                      I think before  commitbuffer  operation ,   the dma buffer (CyU3PDmaMultiChannelGetBuffer)should be called . But unluckily ,  in the project the buffer can not be get if the multi channel mode chosen.  there are two questions :

                     

                      1  

                     

                      If I delete the commit buffer operation in main thead function(UVCAppThread_Entry()), the project can be compiled without errors. and then

                     

                     If I choose  "CYU3P_NO_WAIT  "as  the waitOption parameter in the function CyU3PDmaMultiChannelGetBuffer , the error code is " 69 "(time out) , If I choose the "CYU3P_WAIT_FOR_EVER", the project will wait at this operation to get free  buffer.

                     

                  2

                     

                     If I added the commit buffer operation "CyU3PDmaMultiChannelCommitBuffer" , the project can not be compiled in success, from the log , I think may be have some memory errors. But I think  the  statement to commit buffer is only a statement and it cost very low code section. I do not know why add this statement will cost so much memory ????

                     

                    Compiler error info:

                     

                     c:/program files/cypress/ez-usb fx3 sdk/1.2/bin/../lib/gcc/arm-none-eabi/4.5.2/../../../../arm-none-eabi/bin/ld.exe: USBVideoClass.elf section `i.CyU3PUartSetConfig' will not fit in region `SYS_MEM'

                     

                  c:/program files/cypress/ez-usb fx3 sdk/1.2/bin/../lib/gcc/arm-none-eabi/4.5.2/../../../../arm-none-eabi/bin/ld.exe: section .data loaded at [40030000,40030277] overlaps section i.CyU3PUartSetConfig loaded at [4002fe5c,40030077]
                  c:/program files/cypress/ez-usb fx3 sdk/1.2/bin/../lib/gcc/arm-none-eabi/4.5.2/../../../../arm-none-eabi/bin/ld.exe: section i.CyU3PUartTxSetBlockXfer loaded at [40030078,400300c7] overlaps section .data loaded at [40030000,40030277]
                  c:/program files/cypress/ez-usb fx3 sdk/1.2/bin/../lib/gcc/arm-none-eabi/4.5.2/../../../../arm-none-eabi/bin/ld.exe: region `SYS_MEM' overflowed by 200 bytes
                  collect2: ld returned 1 exit status

                  • 6. Re: CyU3PDmaMultiChannelCreate failed (error code 64), why ??
                    yu.jj

                     Dear RSKV,

                       

                          I  found that the compiler error is caused becaues the img is too big , if I reduce the arrary which is stored the yuv data the project can be compiled in success!   But I do not know why the multi channel cost so much  data and code section memory??

                       

                       But you know , the source image now I stored in the internal memory same as the sdk sample, and the image data is also same, So the parameters in  function is  "CyU3PDmaMultiChannelCreate( )"  :

                       

                        /* Create a DMA Manual OUT channel for streaming data */

                       

                        /* Video streaming Channel is not active till a stream request is received */

                       

                        dmaCfg.size = CY_FX_UVC_STREAM_BUF_SIZE;   

                       

                        dmaCfg.validSckCount = 2; 

                       

                        dmaCfg.count = CY_FX_UVC_STREAM_BUF_COUNT;

                       

                        dmaCfg.prodSckId[0] = CY_U3P_CPU_SOCKET_PROD  ; //CY_U3P_UIB_SOCKET_PROD_1; //CY_U3P_CPU_SOCKET_PROD

                       

                        dmaCfg.consSckId[0]  = CY_FX_EP_VIDEO_CONS_SOCKET;

                       

                        dmaCfg.consSckId [1]= CY_FX_EP_VIDEO_CONS_SOCKET_2;

                       

                        dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;

                       

                        dmaCfg.notification =CY_U3P_DMA_CB_PROD_EVENT;

                       

                        dmaCfg.cb =CyFxBulkLpDmaCallback ;

                       

                        dmaCfg.prodHeader = 0;

                       

                        dmaCfg.prodFooter = 0;

                       

                        dmaCfg.consHeader = 0;

                       

                        dmaCfg.prodAvailCount = 0;

                       

                     

                       

                       apiRetStatus = CyU3PDmaMultiChannelCreate (&glChMultiHandleUVCStream,

                       

                       CY_U3P_DMA_TYPE_MULTICAST , &dmaCfg);//CY_U3P_DMA_TYPE_MULTICAST

                       

                        if (apiRetStatus != CY_U3P_SUCCESS)

                       

                        {

                       

                            CyU3PDebugPrint (4, "CyU3PDmaMultiChannelCreate failed, Error code = %d\n", apiRetStatus);

                       

                            CyFxAppErrorHandler(apiRetStatus);

                       

                        }

                       

                     

                       

                     

                       

                     Pls notice the red parameter "   dmaCfg.prodSckId[0]"  the value is  from CPU  but not UIB.   I found that if the parameter is CY_U3P_CPU_SOCKET_PROD  ;    The CyU3PDmaMultiChannelCreate  can not create channel in success but error code is 64 .   Why ?

                       

                       Thanks ! 

                    • 7. Re: CyU3PDmaMultiChannelCreate failed (error code 64), why ??
                      yu.jj

                       Dear RSKV,

                         

                           From the API SPEC,  I found that if the  product scoket chosen  dmaCfg.prodSckId[0] = CY_U3P_CPU_SOCKET_PROD , the socket is a visual port .  

                         

                       

                         

                      And in my project, I chose   the multi channel  and the  produce port data  is stroed in a internal memory(maybe  same as in the uvc sample ) .  So  I chose multicast channel mode , but the produce port is chosen as CY_U3P_CPU_SOCKET_PROD.  But  from my expriments , It seems that the CPU_SOCKET_PORT   can not chosen as the multi channel  produce ports,    it is right??

                         

                       

                         

                       If is is right, how can  I to  transfer the stored memory to EPs  use multi channelsmode??    or   how can I to simulate the stored memory as a UIBIN or PIB  port??

                         

                       

                         

                      Thanke you very much!