The DMA block freezes (CX3 MIPI + AR0341)

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

cross mob
lock attach
Attachments are accessible only for community members.
AvOm_4629506
Level 2
Level 2
First like given Welcome!

Good day!

( Sensor AR0341 4lane 640*480*60fps)

I didn't use your program(from sdk) before. Now I am corrected

I also have a problem with your Linux Studio

1. the CS3 Receiver Configuration tab Is not saved, which means that you need to type everything again every time. see err2.jpg

2. it is not Clear how CS3 MAPI Interface Configuration H_Active is considered as it changes only when PCLK and format are changed. Can you describe it ?

3. my sensor was configured for CPU Clock 192MHz 640*480*60fps 4 lane and an error occurred

Max Output pixel clock cannot transfer CSIData.... see err1.jpg

And I don't understand why: (

Sensor Transmitter CASE Clock 192MHz = 384 Mbps per lane

CS3 PCLK= 87,88MHz RAW10 GPIF16bit. CS3 Recover Data_Rate = 87,88* 10(PixelDepth) = 878,8 Mbps perlane.

4. And still it is unclear opposite Output Pixel Clock the error "Minimum value 301.23" is shown as it so counted ?

At the moment, the project is configured as follows:

I. Sensor AR0341:                                                                                                    CX3:

pastedImage_3.pngpastedImage_4.png

* ignore the name sensor ar0341

  CyU3PMipicsiCfg_t OV4689_RAW10_640_480_60 = 

{

CY_U3P_CSI_DF_RAW10, /* CyU3PMipicsiDataFormat_t dataFormat */

4, /* uint8_t numDataLanes */

1, /* uint8_t pllPrd */

62, /* uint16_t pllFbd */

CY_U3P_CSI_PLL_FRS_250_500M, /* CyU3PMipicsiPllClkFrs_t pllFrs */

CY_U3P_CSI_PLL_CLK_DIV_4, /* 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 */

640, /* uint16_t hResolution */

0 /* uint16_t fifoDelay */

};

status = CyU3PMipicsiSetPhyTimeDelay(1, 8);

USB works in HS mode. The reset timer is enabled.

Problems:

1 Getting multiple bundles of data CX3 freezes.

Here is a screenshot showing the logs and the location when it was frozen.

When the DMA freezes MIPI continues to work

Here is hsync (yellow) datalane0 (Red) hsync.jpg

Here is Vsync (yellow) datalane0 (Red) vsync.jpg

Here is pclk (yellow) data band 0 (Red) pclk.jpg

0 Likes
1 Solution

Hello,

As i can see from the first image you provided, i still see that the Pixel Clock shows an error in the configuration.
Please confirm that the first configuration is working for you?

But this is all the same only changed blanks and it does not work!

I use USB2.1

CX3_UVC_DATA_BUF_SIZE            (16368)
CX3_UVC_STREAM_BUF_COUNT4

Could you please elaborate the above statement? Did you only change the BUF_SIZE and BUF_COUNT and you are seeing the commit buffer failures and MIPI errors?
Please confirm if you have done anymore changes to the firmware?

Error code = 0x47 corresponds to invalid sequence error.

Please refer to the following KBA: Invalid Sequence Error in Multi-Channel Commit Buffer - KBA218830

This error happens when the host is slow and doesn't issue enough IN tokens to the device as mentioned in the KBA above.

Also, to get an idea of the MIPI errors, please check the following KBA: MIPI-CSI Protocol and Physical Layer Errors in CX3 (CYUSB3065 and CYUSB3064) – KBA228482

Can you please test the same configuration on a different PC and different OS and see if you face the same issues?

Regards,
Yashwant

View solution in original post

8 Replies
YashwantK_46
Moderator
Moderator
Moderator
100 solutions authored 50 solutions authored 50 likes received

Hello,

Please try the following CX3 settings in the CX3 Configuration Utility for your project:

pastedImage_0.png

I didn't get the error that you are getting in err1.jpg and err2.jpg.

Please try this on your side and see if you get the issues again or not.

Also, after the configuration is generated, you would have to manually save the cyu3mipicsi.c and cycx3_uvcdscr.c along with cycx3_uvc.c and cycx3_uvc.h files by manually clicking the Export to file option in the top right of the utility (marked in red) as shown in the below figure and press OK:

pastedImage_1.png

This will add the generated files to the project and then you can build the project and check if you get proper video stream.


Regards,Yashwant

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

Hmm. For some reason, we have different versions of ez usb suite. Since I can't use float REFCLK and the Date Format field we have different well, and so on. Are you running Win or Linux ?

I set the parameters that you sent, but the DMA freezes

( From debug(uart) log.

GPIF  0x84 DMA_CB_PROD_EVENT: 36816

GPIF  0x83 DMA_CB_PROD_EVENT: 36816

GPIF  0x84 DMA_CB_PROD_EVENT: 36816

GPIF  0x5 DMA_CB_PROD_EVENT: 36816

GPIF  0x84 DMA_CB_PROD_EVENT: 36816

GPIF  0x83 DMA_CB_PROD_EVENT: 36816

GPIF  0x84 DMA_CB_PROD_EVENT: 36816

GPIF  0x83 DMA_CB_PROD_EVENT: 36816

)

, and the MINI block continues to work. To exclude USB I reset the DMA buffer :

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

        while (status == CY_U3P_SUCCESS)

        {

            /* Add Headers*/

            if(dmaBuffer.count < CX3_UVC_DATA_BUF_SIZE)

            {

#ifdef UVC_APPLICATION

                CyCx3UvcAppAddHeader ((dmaBuffer.buffer - CX3_UVC_PROD_HEADER), CX3_UVC_HEADER_EOF);

#endif

                glHitFV = CyTrue;

               

#ifdef PRINT_FRAME_INFO

                FrameCount++;

                PartialBufSize = dmaBuffer.count;

                RxCountflag = RxCount;

                TxCountflag = TxCount;

                Printflag = 1;

                if ((FrameCount % 30) == 0)

                {

                    time1 = CyU3PGetTime();

                    fpsflag = 1;

                    gettimeflag = 0;

                }

#endif

            }

            else

            {

#ifdef UVC_APPLICATION           

                CyCx3UvcAppAddHeader ((dmaBuffer.buffer - CX3_UVC_PROD_HEADER), CX3_UVC_HEADER_FRAME);

#endif               

            }

            CyU3PDebugPrint (4, "\nGPIF  0x%x DMA_CB_PROD_EVENT: %d ",gpif_state, dmaBuffer.count);

            /* Commit Buffer to USB*/

#ifdef UVC_APPLICATION           

           status = CyU3PDmaMultiChannelDiscardBuffer(chHandle); // Here I reset it

//            status = CyU3PDmaMultiChannelCommitBuffer (chHandle, (dmaBuffer.count + 12), 0);

#else

            status = CyU3PDmaMultiChannelCommitBuffer (chHandle, (dmaBuffer.count), 0);

#endif           

            if (status != CY_U3P_SUCCESS)

            {

                   CyU3PEventSet(&glCx3Event, CX3_DMA_RESET_EVENT,CYU3P_EVENT_OR);

                   CyU3PDebugPrint (4, "\n\rCyU3PDmaMultiChannelCommitBuffer Err = 0x%x", status);

                   break;

            }

            else

            {

#ifdef PRINT_FRAME_INFO

                TxCount++;

#endif

                glDMATxCount++;

                glDmaDone++;

            }

            glActiveSocket ^= 1; /* Toggle the Active Socket */

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

        }

0 Likes

Hello,

Are you running Win or Linux ?

-> I am using the CX3 configuration utility in windows and i don't see any issue with the same configuration as yours on my end.

Also, the CX3 configuration utility that you are using seems to be quite old and the utility hasn't been updated for the Linux platform in a while.


Is it possible for you to generate the CX3 configuration file on a windows PC and then see if you face the issue?

Please set the parameters as i suggested in my previous response on a windows PC and test if you see the issue again

Regards,

Yashwant

0 Likes

Hello,

I run CX3 config utility in win... and have  exactly the same result as on Linux : (  can you show  Cypress EZ USB Suite installation details?

I use the generated code from the EZ USB Suite and CX3 Configuration.

I used your parameters but the result was not for the reason described below.

I have already created tables for calculating all parameters in Excel and at the moment 640*480 5 fps is working normally. According to calculations, the only thing I don't understand is how CX MIDI interface Configuration -> H_Active is calculated ?

According to the sensor - if I raise the frequency, CyU3PDmaMultiChannelCommitBuffer starts to crash with the error CY_U3P_ERROR_INVALID_SEQUENCE. which says that USB does not have time to take data and I do not understand how this is possible USB2. 0 is 480Mbps and I have 294Mbps at 60 fps and 49Mbps at 10fps ! (GPIF 16bit)

Now I use 2 producer on 1 consumer. Maybe that's the problem ? like USBBurst written allows you to use more consumers but I can not yet use it : ((as I understand it only works on USB3)

0 Likes

It looks like the DMA was hanging because the buffer size was not a multiple of 512

0 Likes

Hello,

Please share the CX3 configuration utility settings that you are using now.

You can refer to the following KBA to understand the CX3 timing parameters: Analysis of CX3 Video Timing Parameters – KBA226779

Also, you will have to use a buffer size which is a multiple of the endpoint size, or you can leave it the way the tool generates it and test the firmware.


Regards,
Yashwant

0 Likes

Welcome.

1.  I was able to run the CX Configurator normal

By slipping him an old Java (JAVA_VERSION= " 1.8.0_41")

run.sh:

#!/bin/bash

./ezUsbSuite -vm /home/avatar/java-se-8u41-ri/bin/java

I used to use 1.8.0_201 to launch it. It started but didn't work properly

2. I have a quartz resonator on the sensor there was another one instead of 24 MHz stood 27 MHz

My work got better after that   This is a working configuration:

WorkLane2_640_480_58.jpg

But this is all the same only changed blanks and it does not work!

I use USB2.1

CX3_UVC_DATA_BUF_SIZE             (16368)
CX3_UVC_STREAM_BUF_COUNT4

NotWorkLane2_640_480_58.jpg

log :

AplnStrt:SMState = 0x2 CPU_CLK 384000000

DMAMultChannel: 24 28 0 0 / 16 0 0 0

UsbCB: EVTYPE = 10, EVDATA = 0

CyU3PDmaMultiChannelCommitBuffer Err = 0x47

CyU3PDmaMultiChannelCommitBuffer Err = 0x47

CyU3PDmaMultiChannelCommitBuffer Err = 0x47

CyU3PDmaMultiChannelCommitBuffer Err = 0x47

Prod = 27 Cons = 21  Prtl_Sz = 9040 Frm_Cnt = 1 Frm_Sz = 450976 B

MipiError  1  crcErrCnt:0 ctlErrCnt:1 eidErrCnt:0

frmErrCnt:2 mdlErrCnt:0 recSyncErrCnt:0 recrErrCnt:0 unrSyncErrCnt:0 unrcErrCnt:0

CyU3PDmaMultiChannelCommitBuffer Err = 0x47

CyU3PDmaMultiChannelCommitBuffer Err = 0x47

CyU3PDmaMultiChannelCommitBuffer Err = 0x47

CyU3PDmaMultiChannelCommitBuffer Err = 0x47

CyU3PDmaMultiChannelCommitBuffer Err = 0x47

CyU3PDmaMultiChannelCommitBuffer Err = 0x47

Why does it work in one case and not in the other???

I tried increasing the frequency of PCLK, but to no avail

NotWorkLane2_640_480_58_HIPCLK.jpg

log:

Prod = 23 Cons = 19  Prtl_Sz = 7536 Frm_Cnt = 372 Frm_Sz = 384000 B

MipiError  1  crcErrCnt:0 ctlErrCnt:0 eidErrCnt:0

frmErrCnt:2 mdlErrCnt:2 recSyncErrCnt:2 recrErrCnt:0 unrSyncErrCnt:178 unrcErrCnt:2

Prod = 23 Cons = 20  Prtl_Sz = 10096 Frm_Cnt = 373 Frm_Sz = 386560 B

MipiError  1  crcErrCnt:1 ctlErrCnt:0 eidErrCnt:1

frmErrCnt:2 mdlErrCnt:2 recSyncErrCnt:2 recrErrCnt:1 unrSyncErrCnt:176 unrcErrCnt:1

Prod = 22 Cons = 19  Prtl_Sz = 16224 Frm_Cnt = 374 Frm_Sz = 376320 B

MipiError  1  crcErrCnt:0 ctlErrCnt:0 eidErrCnt:0

frmErrCnt:1 mdlErrCnt:2 recSyncErrCnt:2 recrErrCnt:0 unrSyncErrCnt:185 unrcErrCnt:2

Prod = 23 Cons = 20  Prtl_Sz = 6256 Frm_Cnt = 375 Frm_Sz = 382720 B

MipiError  1  crcErrCnt:0 ctlErrCnt:0 eidErrCnt:0

frmErrCnt:0 mdlErrCnt:0 recSyncErrCnt:0 recrErrCnt:0 unrSyncErrCnt:183 unrcErrCnt:0

Prod = 23 Cons = 20  Prtl_Sz = 12656 Frm_Cnt = 376 Frm_Sz = 389120 B

MipiError  1  crcErrCnt:0 ctlErrCnt:0 eidErrCnt:0

frmErrCnt:1 mdlErrCnt:1 recSyncErrCnt:1 recrErrCnt:0 unrSyncErrCnt:176 unrcErrCnt:1

Prod = 23 Cons = 20  Prtl_Sz = 10096 Frm_Cnt = 377 Frm_Sz = 386560 B

MipiError  1  crcErrCnt:0 ctlErrCnt:0 eidErrCnt:0

frmErrCnt:2 mdlErrCnt:1 recSyncErrCnt:1 recrErrCnt:0 unrSyncErrCnt:177 unrcErrCnt:1

there are no normal frames and errors on MIPI

and I didn't manage to get above 58 fps, but i want 120 fps

0 Likes

Hello,

As i can see from the first image you provided, i still see that the Pixel Clock shows an error in the configuration.
Please confirm that the first configuration is working for you?

But this is all the same only changed blanks and it does not work!

I use USB2.1

CX3_UVC_DATA_BUF_SIZE            (16368)
CX3_UVC_STREAM_BUF_COUNT4

Could you please elaborate the above statement? Did you only change the BUF_SIZE and BUF_COUNT and you are seeing the commit buffer failures and MIPI errors?
Please confirm if you have done anymore changes to the firmware?

Error code = 0x47 corresponds to invalid sequence error.

Please refer to the following KBA: Invalid Sequence Error in Multi-Channel Commit Buffer - KBA218830

This error happens when the host is slow and doesn't issue enough IN tokens to the device as mentioned in the KBA above.

Also, to get an idea of the MIPI errors, please check the following KBA: MIPI-CSI Protocol and Physical Layer Errors in CX3 (CYUSB3065 and CYUSB3064) – KBA228482

Can you please test the same configuration on a different PC and different OS and see if you face the same issues?

Regards,
Yashwant