CyU3PDmaMultiChannelGetBuffer Failed with Timeout error code

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

cross mob
Rakesh
Level 3
Level 3
25 replies posted 10 questions asked 50 sign-ins

Hi infineon team,

I am getting CyU3PDmaMultiChannelGetBuffer Failed with Timeout error code frequently when streaming 1080P resolution in YUV2 format. eventhough im resetting the DMA and streaming was not stopped due to this issue, but i need to stop this CyU3PDmaMultiChannelGetBuffer Failed issue because it was not observed in other resolutions. kindly help me to resolve this issue.   

SDK -1.3.4

streaming -  1080P@60FPS 

CX3_UVC_DATA_BUF_SIZE       30288

CX3_UVC_STREAM_BUF_COUNT     3

CyU3PMipicsiCfg_t cfgUvc1080pNoMclk_SS_UYVY_60fps = {
CY_U3P_CSI_DF_RGB888, /* CyU3PMipicsiDataFormat_t dataFormat */
4, /* uint8_t numDataLanes */
4, /* uint8_t pllPrd */
99, /* uint16_t pllFbd */
CY_U3P_CSI_PLL_FRS_500_1000M, /* CyU3PMipicsiPllClkFrs_t pllFrs */
CY_U3P_CSI_PLL_CLK_DIV_8, /* CyU3PMipicsiPllClkDiv_t csiRxClkDiv */
CY_U3P_CSI_PLL_CLK_DIV_4, /* CyU3PMipicsiPllClkDiv_t parClkDiv */
0, /* uint16_t mClkCtl */
CY_U3P_CSI_PLL_CLK_DIV_2, /* CyU3PMipicsiPllClkDiv_t mClkRefDiv */
1920, /* uint16_t hResolution */
1 /* uint16_t fifoDelay */

};

In probe control:

0x00, 0x90, 0x00, 0x00, /* No. of bytes device can rx in single payload: 36KB */

 

Thanks and regards, 

Rakesh

 

0 Likes
1 Solution
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi Rakesh,

In the default CX3 firmware code with the FX3 SDK, we see that in the DMA callback function, 

if (type == CY_U3P_DMA_CB_PROD_EVENT)
    {
        status = CyU3PDmaMultiChannelGetBuffer(chHandle, &dmaBuffer, CYU3P_NO_WAIT);
        while (status == CY_U3P_SUCCESS)
        {
            /* Add Headers*/

            /* Commit Buffer to USB*/

            status = CyU3PDmaMultiChannelGetBuffer(chHandle, &dmaBuffer, CYU3P_NO_WAIT);
        }
    }​

 

But in your response no. 6 in this thread, where you have shared the DMA callback snippet from your firmware code, we see that there is an if else condition used for the getbuffer API call.

Could you use the getBuffer API call flow given in the default SDK firmware project(as shown above) and let me know if the issue exists?

Also note that avoid using DebugPrints inside the DMA callback function.

Best Regards,
AliAsgar

View solution in original post

0 Likes
14 Replies
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi Rakesh,

There are two CyU3PDmaMultiChannelGetBuffer API calls in the DMA callback. Could you let us know which instance of the API failed with the timeout error?

By, "streaming was not stopped due to this issue", do you mean that even though GetBuffer API is failing with timeout error, the video streaming never failed and continued perfectly?

Could you try changing the third parameter of GetBuffer API to 1000 instead of CYU3P_NO_WAIT and let us know the frequency of the issue?

In which resolutions were you not seeing the issue?

Best Regards,
AliAsgar

0 Likes

Hi aliasgar,

Thanks for your quick reply.

There are two CyU3PDmaMultiChannelGetBuffer API calls in the DMA callback. Could you let us know which instance of the API failed with the timeout error?

>>> Im getting this issue due to First  CyU3PDmaMultiChannelGetBuffer which is called inside if ( type == CY_U3P_DMA_CB_PROD_EVENT).

By, "streaming was not stopped due to this issue", do you mean that even though GetBuffer API is failing with timeout error, the video streaming never failed and continued perfectly?

>>> Yes ,  because im resetting the dma channel.

Could you try changing the third parameter of GetBuffer API to 1000 instead of CYU3P_NO_WAIT and let us know the frequency of the issue?

>>> after changing to 1000. frequency of the issue was reduced . but issue still exists.

In which resolutions were you not seeing the issue?

>>> 4096*2160 @ 7 FPS, 640*480 @ 60 FPS etc.

Regards, 

Rakesh 

0 Likes
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi Rakesh,

Could you share with us the source code and error snippet and the UART logs when the error is seen?

Best Regards,
AliAsgar

0 Likes
lock attach
Attachments are accessible only for community members.

Hi aliasgar,

I am not authorized to send code outside of organisation. here i attached my UART logs . kindly verify it. please let me know if u need more details.

Regards,

Rakesh 

0 Likes
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi Rakesh,

Could you let us know if the same DMA callback function is used for multiple channels apart from the video streaming channel?

Could you let us know the sequence of DMA creation, initialization, setXfer and snippet of the DMA callback function?

Best Regards,
AliAsgar

0 Likes

Hi aliasgar,

Thanks for your continuous support.

Could you let us know if the same DMA callback function is used for multiple channels apart from the video streaming channel?

>>>> This particular DMA callback is used only for video streaming only. 

Could you let us know the sequence of DMA creation, initialization, setXfer and snippet of the DMA callback function?

>>> DMA creation and initialization done inside CyCx3UvcApplnInit () after connectstate() API.

>>> status = CyU3PDmaMultiChannelSetXfer (&glChHandleUVCStream, CyFalse, CyFalse); is called inside CyCx3UvcApplnStart() API.

>>>CyCx3UvcAppDmaCallback()

{

if (type == CY_U3P_DMA_CB_PROD_EVENT)
  {

            status = CyU3PDmaMultiChannelGetBuffer(chHandle, &DmaBuffer, CYU3P_NO_WAIT);
if(status == CY_U3P_SUCCESS)
  {

SOF handle;

EOF handle;

Add header with buffer;

commit the buffer;

            }

else 

{

CyU3PDebugPrint(4,"\n\r CyU3PDmaMultiChannelGetBuffer Failed - 0x%x",status);

set CX3_DMA_RESET_EVENT;

}

}

else if(type == CY_U3P_DMA_CB_CONS_EVENT)
{

    }
}

 

Regards,

Rakesh

0 Likes
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi Rakesh,

Could you also share the code snippet for DMA creation?

Does the issue occur with 1080p60 from the starting itself or the issue occurs somewhere in the middle?

Could you print the chHandle when the issue is seen and let us know what the chHandle is?

What happens if the DMA channel reset (set CX3_DMA_RESET_EVENT) is disabled when getBuffer fails with a timeout. Baically, just ignoring the getBuffer timeout in the callback function. Does the streaming still continue without issues in video?

Best Regards,
AliAsgar

0 Likes
lock attach
Attachments are accessible only for community members.

Hi aliasgar,

Thanks for your continuous support.
Could you also share the code snippet for DMA creation?

>> kindly see attached image.

Does the issue occur with 1080p60 from the starting itself or the issue occurs somewhere in the middle?

>> Issue occurs from starting itself.(within 10 sec i'm starting to observe this issue)

Could you print the chHandle when the issue is seen and let us know what the chHandle is?

>> i tried but it is showing errors like
request for member 'startSig' in something not a structure or union


What happens if the DMA channel reset (set CX3_DMA_RESET_EVENT) is disabled when getBuffer fails with a timeout. Baically, just ignoring the getBuffer timeout in the callback function. Does the streaming still continue without issues in video?

>> i disabled and  streaming stops immediately.

regards,
rakesh

0 Likes
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi Rakesh,

Please print the below values when the timeout issue happens.

chHandle -> type

chHandle -> state

Best Regards,
AliAsgar

0 Likes

Hi aliasgar, 

i got the below values during get buff failure.

CyU3PDmaMultiChannelGetBuffer Failed - 0x45
chHandle.type = 7

chHandle.state = 2

Every time i am getting the same value when get buff issue happened. 

regards, 

Rakesh

0 Likes
Rakesh
Level 3
Level 3
25 replies posted 10 questions asked 50 sign-ins

Hi aliasgar, 

we are in need of your support . kindly provide a solution to solve the above issue.

Regards, 

Rakesh

0 Likes
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi Rakesh,

Could you change the third parameter of the GetBuffer API to CYU3P_WAIT_FOREVER and check if the video is getting stuck or is the issue is resolved?

Best Regards,
AliAsgar

0 Likes

Hi aliasgar, 

i have changed the third parameter of the GetBuffer API to CYU3P_WAIT_FOREVER and checked still it fails with TIMEOUT error code .

regards,

Rakesh

 

 

0 Likes
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi Rakesh,

In the default CX3 firmware code with the FX3 SDK, we see that in the DMA callback function, 

if (type == CY_U3P_DMA_CB_PROD_EVENT)
    {
        status = CyU3PDmaMultiChannelGetBuffer(chHandle, &dmaBuffer, CYU3P_NO_WAIT);
        while (status == CY_U3P_SUCCESS)
        {
            /* Add Headers*/

            /* Commit Buffer to USB*/

            status = CyU3PDmaMultiChannelGetBuffer(chHandle, &dmaBuffer, CYU3P_NO_WAIT);
        }
    }​

 

But in your response no. 6 in this thread, where you have shared the DMA callback snippet from your firmware code, we see that there is an if else condition used for the getbuffer API call.

Could you use the getBuffer API call flow given in the default SDK firmware project(as shown above) and let me know if the issue exists?

Also note that avoid using DebugPrints inside the DMA callback function.

Best Regards,
AliAsgar

0 Likes