GPIF II state machine builds but streaming doesn't work - timing problem?

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

cross mob
Linda
Level 3
Level 3
5 likes given 25 sign-ins 5 questions asked

Hi, 

attached you can see my state machine designed using GPIF II designer. I have 2 sockets to push data to the DMA channels. COUNT_DATA = 8183
COUNT_ADDR = 8183
CTRL_CNT_HIT = 50  000

image_2023_03_27T17_16_23_286Z.png

Here our dma multi channel config:

 

 

 /* Create a DMA Manual channel for sending the video data to the USB host. */
    dmaMultiConfig.size           = CY_FX_UVC_STREAM_BUF_SIZE; //16 *1024
    dmaMultiConfig.count          = CY_FX_UVC_STREAM_BUF_COUNT; // 4
    dmaMultiConfig.validSckCount  = 2;
    dmaMultiConfig.prodSckId [0]  = (CyU3PDmaSocketId_t)CY_U3P_PIB_SOCKET_0;
    dmaMultiConfig.prodSckId [1]  = (CyU3PDmaSocketId_t)CY_U3P_PIB_SOCKET_1;
    dmaMultiConfig.consSckId [0]  = (CyU3PDmaSocketId_t)(CY_U3P_UIB_SOCKET_CONS_0 | CY_FX_EP_VIDEO_CONS_SOCKET);
    dmaMultiConfig.prodAvailCount = 0;
    dmaMultiConfig.prodHeader     = 0;                 /* 12 byte UVC header to be added. */
    dmaMultiConfig.prodFooter     = 0;                  /* 4 byte footer to compensate for the 12 byte header. */
    dmaMultiConfig.consHeader     = 0;
    dmaMultiConfig.dmaMode        = CY_U3P_DMA_MODE_BYTE;
    dmaMultiConfig.notification   = CY_U3P_DMA_CB_PROD_EVENT | CY_U3P_DMA_CB_CONS_EVENT;
    dmaMultiConfig.cb             = CyFxUvcApplnDmaCallback;

 

 

This is GPIF cb:

 

/* GpifCB callback function is invoked when FV triggers GPIF interrupt */
void
CyFxGpifCB (
        uint8_t currentState            /* GPIF state which triggered the interrupt. */
        )
{
    /* The ongoing video frame has ended. If we have a partial buffer sitting on the socket, we need to forcibly
     * wrap it up. We also need to toggle the FW_TRG a couple of times to get the state machine ready for the
     * next frame.
     */
    switch (currentState)
    {
    	case PARTIAL_BUF_IN_SCK0:
            CyU3PDmaSocketSetWrapUp (CY_U3P_PIB_SOCKET_0);
            break;
        case FULL_BUF_IN_SCK0:
            break;
        case PARTIAL_BUF_IN_SCK1:
            CyU3PDmaSocketSetWrapUp (CY_U3P_PIB_SOCKET_1);
            break;
        case FULL_BUF_IN_SCK1:
            break;

        default:
            /* This should not happen. Do nothing. */
            return;
    }

    CyU3PGpifControlSWInput (CyTrue);
    CyU3PGpifControlSWInput (CyFalse);
}

 

 

In our code when a frame is over (recognized as we'll receive a partial buffer and not a full one) we attach a footer and then proceed in transfering data to host PC.

 

However, this is the error we receive when we try to start the streaming: DMA Reset Event: Commit buffer failure

Could it be because we try to send too many frames ? Like the FPS is too high?? We are sampling data at 100MHz.

Before we tried this machine and it worked:

image_2023_03_27T17_16_23_286Z.png

 Here we had:

COUNT_DATA = 8191
COUNT_ADDR = 8191
CTRL_CNT_HIT = 1250

LV was a signal that was high for 17us and down for 3 us. Basically we did the same thing as before (2 sockets) but we were sampling only when LV was high. 

 

Can someone help me understand why my new machine doens't work?

Thanks, 
Lnda

 

0 Likes
8 Replies
Bakal
Moderator
Moderator
Moderator
100 sign-ins 25 solutions authored 50 replies posted

Hello,

Please refer to the state machine and application note and also the code of AN75779. The application note will help you to understand the state machine very well. and the state machine is also similar to yours. 
Please check the firmware code changes as well. And let us know if you have any query further.

Best Regards,
Sakshi Bakal

 

0 Likes
Linda
Level 3
Level 3
5 likes given 25 sign-ins 5 questions asked

Dear Sakshi , 

Thanks for the suggestion, we actually started following the project AN75779, but we can't undertand what's wrong in our code (we want to be indipendent from LV).

 

Thanks

Linda

0 Likes
Bakal
Moderator
Moderator
Moderator
100 sign-ins 25 solutions authored 50 replies posted

Hello Linda,

Please do share your firmware code file along with the state machine with us so that I can check on my side and let you know what's wrong.

Best Regards,
Sakshi Bakal

0 Likes
Linda
Level 3
Level 3
5 likes given 25 sign-ins 5 questions asked

What part of code do you need ??

 

Best regards, 
Linda

0 Likes
Bakal
Moderator
Moderator
Moderator
100 sign-ins 25 solutions authored 50 replies posted

Can you share the zip file if it's possible?

Regards,
Sakshi Bakal

0 Likes
Bakal
Moderator
Moderator
Moderator
100 sign-ins 25 solutions authored 50 replies posted

Hello Linda,

There are 3 image files in debug folder which one should I use to check? 

Regards,
Sakshi Bakal

 

0 Likes
Linda
Level 3
Level 3
5 likes given 25 sign-ins 5 questions asked

Here it is

Sorry for the incovenience

Best regards,
Linda

0 Likes
Bakal
Moderator
Moderator
Moderator
100 sign-ins 25 solutions authored 50 replies posted

Hello,

You have mentioned that "we want to be independent of LV" but If you say so how your frame will give you the exact picture, it depends on LV for filling the frame. Can you please elaborate on how exactly you want to output to be and what changes you want apart from AN75779?

Regards,
Sakshi Bakal

 

0 Likes