CX3 How to increase DMA buffer size?

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

cross mob
bayi_4531756
Level 1
Level 1

My TOF camera works well with CX3(CYS3065) on PC. But in embedded system it does not work well, reporting DMA_RESET_EVENT.And I study the problem,finding that   CyU3PDmaMultiChannelCommitBuffer() report error CY_U3P_ERROR_INVALID_SEQUENCE. I know the reason is that the host consumes the data at a lower speed than the producer. So I want to increase the DMA buffer size. 

dmaCfg.size                 = CX3_UVC_STREAM_BUF_SIZE;      //0x8FD0

    dmaCfg.count                = CX3_UVC_STREAM_BUF_COUNT;   //3

    dmaCfg.validSckCount        = CX3_UVC_SOCKET_COUNT;

    dmaCfg.prodSckId[0]         = CX3_PRODUCER_PPORT_SOCKET_0;

    dmaCfg.prodSckId[1]         = CX3_PRODUCER_PPORT_SOCKET_1;

    dmaCfg.consSckId[0]         = CX3_EP_VIDEO_CONS_SOCKET;

    dmaCfg.dmaMode              = CY_U3P_DMA_MODE_BYTE;

    dmaCfg.notification         = CY_U3P_DMA_CB_PROD_EVENT | CY_U3P_DMA_CB_CONS_EVENT;

    dmaCfg.cb                   = CyCx3UvcAppDmaCallback;

    dmaCfg.prodHeader           = CX3_UVC_PROD_HEADER;

    dmaCfg.prodFooter           = CX3_UVC_PROD_FOOTER;

    dmaCfg.consHeader           = 0;

    dmaCfg.prodAvailCount       = 0;

    status = CyU3PDmaMultiChannelCreate (&glChHandleUVCStream,

            CY_U3P_DMA_TYPE_MANUAL_MANY_TO_ONE , &dmaCfg);

    if (status != CY_U3P_SUCCESS)

    {

        CyU3PDebugPrint (4, "\n\rAppInit:DmaMultiChannelCreate Err = 0x%x", status);

    }

I increase the CX3_UVC_STREAM_BUF_SIZE to 0x9FD0(mutiplier of 16 bytes), firmware reports CY_U3P_ERROR_MEMORY_ERROR in CyU3PDmaMultiChannelCreate app initialization. If I increase the CX3_UVC_STREAM_BUF_COUNT to 4, also reporting the same error in initialization.

How can I do to increase the DMA buffer size?

0 Likes
1 Solution
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi,

By default 224KB is the available DMA buffer space. If you are not using second stage bootloader, then it can be increased to 256KB by changing CY_U3P_SYS_MEM_TOP to 0x40080000 in cyfxtx.c file.

Then, the available DMA buffer space that can be used for your video channel is (224 or 256KB) - (3KB: which is used internally by SDK if you are using CyU3PDebugInit API)  - (DMA buffer space used by any other channels in your firmware).

Regards,

Hemanth

Hemanth

View solution in original post

0 Likes
1 Reply
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi,

By default 224KB is the available DMA buffer space. If you are not using second stage bootloader, then it can be increased to 256KB by changing CY_U3P_SYS_MEM_TOP to 0x40080000 in cyfxtx.c file.

Then, the available DMA buffer space that can be used for your video channel is (224 or 256KB) - (3KB: which is used internally by SDK if you are using CyU3PDebugInit API)  - (DMA buffer space used by any other channels in your firmware).

Regards,

Hemanth

Hemanth
0 Likes