About the THS-Prepare max value for CX3?

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

cross mob
kyli_4592306
Level 1
Level 1
Welcome!

Hi,

We are using CX3 to get data from ToF image sensor (Sony IMX528) over USB to host PC,

we would like to get maximum possible frame rate, now, i can get the raw data from sensor via CX3,

but i am hitting a issue when i am trying to compose the raw data into a frame with streamer app, there is few pixel data will random missing,

ex, 640x480 resolution but only receive 640x479 or 640x478 ...

Because the sensor IMX528 setting of THS prepare is 95 (0x5f), but CX3 THS prepare max value seems to be limited under 89 as below pic via EZ USB IDE ?

how can i modify the THS prepare max value to over 89 ? Thanks ~

IMX528 settings :

    Image format : RAW12

    Resolusion: 640x480 30fps

    MIPI 4 lanes

擷取.JPG

0 Likes
1 Solution
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

According to your description, I understand that you are facing trouble while streaming 640x480 video using CX3. Please share the snapshot of the MIPI configuration utility for this setting so that I can understand the issue better.

Also, please refer to Q13 of the following KBA which describes about the Max setting for CSI clock for different number of lanes used.

CX3 Firmware: Frequently Asked Questions - KBA91297

Please reduce the value of CSI clock based on the KBA mentioned above and let me know if you can configure the THS-Prepare for 95ns.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

View solution in original post

0 Likes
21 Replies
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

According to your description, I understand that you are facing trouble while streaming 640x480 video using CX3. Please share the snapshot of the MIPI configuration utility for this setting so that I can understand the issue better.

Also, please refer to Q13 of the following KBA which describes about the Max setting for CSI clock for different number of lanes used.

CX3 Firmware: Frequently Asked Questions - KBA91297

Please reduce the value of CSI clock based on the KBA mentioned above and let me know if you can configure the THS-Prepare for 95ns.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna

Please refer the following snapshot of the MIPI configuration utility,

And sorry to allow me to correct the sensor setting as below, could you help to check if i have any wrong setting ?

The sensor settings :

    Image format : RAW12

    Resolusion: 1280 (640x2) x 1920 (480x4) 30fps

    MIPI 2 lanes

    MCLK : 24MHz

擷取.JPG

/* null_RAW12_ModeAA :  */

CyU3PMipicsiCfg_t null_RAW12_ModeAA = 

{

    CY_U3P_CSI_DF_RAW12,  /* CyU3PMipicsiDataFormat_t dataFormat */

    2,                          /* uint8_t numDataLanes */

    1, /* uint8_t pllPrd */

    69, /* 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_8, /* CyU3PMipicsiPllClkDiv_t parClkDiv */

    0x0203,                 /* uint16_t mClkCtl */

    CY_U3P_CSI_PLL_CLK_DIV_2, /* CyU3PMipicsiPllClkDiv_t mClkRefDiv */

    1280,         /* uint16_t hResolution */

    0                         /* uint16_t fifoDelay */

};

More over, I wonder how to config the correct fps, is it set by the API CyU3PMipicsiCfg_t  ?

because, i try to change the "frame rate(fps)" in MIPI configuration utility from 30fps to 15fps, but the CyU3PMipicsiCfg_t  does not change ?

0 Likes

Hello,

As mentioned in my previous response, the Q13 of following KBA describes the maximum value for the CSI clock setting that can be used for different number of lanes.

CX3 Firmware: Frequently Asked Questions - KBA91297

For 2 lanes, the maximum setting allowed is 500MHz only. Please refer to the KBA to understand the reason for this constraint.

Regarding your question on FPS, the FPS is based on the input timings (h-active, v-active, h-total etc). Please refer to the following KBA to understand the CX3 timing parameters better:

Analysis of CX3 Video Timing Parameters – KBA226779

Note that the change in fps will not affect the MIPI configuration structure CyU3PMipicsiCfg_t. The configuration structure will remain unchanged until you make a change in the CX3 MIPI Interface Configuration settings in the MIPI configuration utility.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

Thanks for your suggestions, allow me to explain more detail,

------------------------------------------------------------------------------------------------------------------------------------

My environment :

I am using the way that base on "Non UVC" format as following link for reference,

https://community.cypress.com/thread/16971

Sensor setting :

1. 720Mbps data rate per lane

2. MIPI lane count: 2 lanes

3. sensor resolution (pixel) : 1280(640x2) x 483(480+3 embedded data line)

4. fps: 30fps

5. RAW12

6. INCK = 24[MHz]

Description :

The sensor resolution is 640 x 2(2 groups) x 483 x 4(4 packages within a frame)

------------------------------------------------------------------------------------------------------------------------------------

Issue :

The output data from CX3 is incomplete, basically a full frame data is H x V = 1280(H)x2(2bytes/per pixel) x 483x4, but the valid frame is only 2560 x 1520 currently i got.

Description :

As my understand, i select the input Raw12 and output 16bit in CX3, so i should received the correct frame should be 2560(H) x 1932(V), but actually there is exist 2560 x 1520 (as attached "RAW_1.bmp")

------------------------------------------------------------------------------------------------------------------------------------

Attached files :

1. RAW_1.bmp - Currenlty output data the valid data is only 2560 x 1520

RAW_1.bmp

2. V_less480.JPG - Same data as 1., i have marked a package address, however, the valid package vertical should be 483 (480 + 3 embedded data) , but it's less than 480, and there exist noise or garbage at the end of frame.

V_less480.JPG

3. HSYNC - because the frequency is not stable, so i record it as a video for reference.

4. VSYNC

VSYNC.jpg

5. PCLK - 96.15 MCLK

PCLK.jpg

Could you help to point out if there is any wrong setting or related suggestion for the missing data ? Thanks ~

0 Likes
kyli_4592306
Level 1
Level 1
Welcome!

Sorry for missing my currently configuration :

CX3_setting1.JPG

CX3_setting2.JPG

CyU3PMipicsiCfg_t IMX516_RAW12_MODE_AA =

{

    CY_U3P_CSI_DF_RAW12,  /* CyU3PMipicsiDataFormat_t dataFormat */

    2,                          /* uint8_t numDataLanes */

    2, /* uint8_t pllPrd */

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

    0x0203,                 /* uint16_t mClkCtl */

    CY_U3P_CSI_PLL_CLK_DIV_2, /* CyU3PMipicsiPllClkDiv_t mClkRefDiv */

    1280,         /* uint16_t hResolution */

    0                         /* uint16_t fifoDelay */

};

0 Likes

Hello,

I checked the configurations that you have shared in your previous response. It is correct.

Please find my questions and comments below:
1. According to your description the CX3 MIPI receiver receives 1280x1932x2Bytes data. Are you making use of an ISP or FPGA for sending the data from multiple image sensors to CX3? This is because you have mentioned 640x2 and 483x4 in your description. Also, in your description, you have mentioned that the valid vertical is 483. Please let us know more about your setup. Also, please confirm once again that the input to CX3 is 1280x1932x2Bytes.

2. Regarding embedded data, please let us know if you mean the embedded data type (0x12) as defined in MIPI CSI 2 spec.

3. Please try setting MCLK to 0. Please refer to the point 5 of the following KBA:
Analysis of CX3 Clocking Parameters – KBA226758

4. Please share the UART debug logs so that we can understand more on this issue.

Also, can you please share the traces of Hsync and Vsync with the timings so that I can check if they are proper or not?

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

Thanks for your confirmation, please find my reply mark as [Kyle].

1. According to your description the CX3 MIPI receiver receives 1280x1932x2Bytes data. Are you making use of an ISP or FPGA for sending the data from multiple image sensors to CX3? This is because you have mentioned 640x2 and 483x4 in your description. Also, in your description, you have mentioned that the valid vertical is 483. Please let us know more about your setup. Also, please confirm once again that the input to CX3 is 1280x1932x2Bytes.

[Kyle] There is no FPGA or ISP, in my case, it's only one image sensor IMX528 direct connect to CX3,

For current sensor setting, a complete frame should be 1920(H) x 1932(V), that's confirmed, because i had tried to connected the IMX528 to other USB bridge EVK, which output a complete frame is 1920(H)x1932(V) as following pic, and i set the same sensor setting as CX3.

2. Regarding embedded data, please let us know if you mean the embedded data type (0x12) as defined in MIPI CSI 2 spec.

[Kyle] Yes, the embedded data is 0x12.

MIPI_ID.JPG

[Kyle] moreover, a frame structure would be like the format, FS - frame start, FE - frame end,

4 packages within a frame, a package is 1280 x (480+3), 3 is the embedded data line

1frame.jpg

3. Please try setting MCLK to 0. Please refer to the point 5 of the following KBA:

Analysis of CX3 Clocking Parameters – KBA226758

[Kyle] i have tried to set the MCLK to 0, but it's still not work.

4. Please share the UART debug logs so that we can understand more on this issue.

[Kyle] Because i am using Non-UVC way to process it as following, the log is not complete as UVC way does.

putty_log.JPG

0 Likes

Hello,

Looks like the Appstop() is called multiple times as per the UART logs. Please let me know the following:

1. Are you binding the device to cypress driver?

2. Are you issuing the vendor command to stop streaming in between the transfer? This is because I see Appstop in the UART debug logs. If not, then this should be due to failures in data transfer. Can you please check if the API CyU3PDmaMultiChannelCommitBuffer is failing or not?

3. Please check the size of the frame received by CX3 by modifying the firmware? This can be done by adding the size of the DMA buffers until the last partial buffer is received. Please note that the size of the frame should not be printed in the DMA callback. You can print it in the infinite for loop. Please share the UART debug logs after this modification.

4. Also, can you please provide the wireshark traces for us to check the USB data transfer?

In addition to this, can you please try varying the Multiplier of unit clock setting from 100 to 105 and check if you see any improvements in the video stream? Also, please let me know if the size of the frame received by CX3 is increasing with this change or not.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

1. Are you binding the device to cypress driver?

[Kyle] Yes, but i use the Non-UVC type as following link for reference with "CX3_RAWData_Cypress Driver and Descriptors.zip".

https://community.cypress.com/thread/16971

Driver.JPG

2. Are you issuing the vendor command to stop streaming in between the transfer?

[Kyle] No.

This is because I see Appstop in the UART debug logs. If not, then this should be due to failures in data transfer. Can you please check if the API CyU3PDmaMultiChannelCommitBuffer is failing or not?

[Kyle] No. there is w/o error message w/ the following code via UART.

CyU3PDmaMultiChannelCommitBuffer.JPG

3. Please check the size of the frame received by CX3 by modifying the firmware? This can be done by adding the size of the DMA buffers until the last partial buffer is received. Please note that the size of the frame should not be printed in the DMA callback. You can print it in the infinite for loop. Please share the UART debug logs after this modification

[Kyle] currently i set the CX3_UVC_DATA_BUF_SIZE=0x6000, CX3_UVC_STREAM_BUF_COUNT=4

could you suggest me the value of DMA buffer to try ?

.

4. Also, can you please provide the wireshark traces for us to check the USB data transfer?

[Kyle] update later.

In addition to this, can you please try varying the Multiplier of unit clock setting from 100 to 105 and check if you see any improvements in the video stream? Also, please let me know if the size of the frame received by CX3 is increasing with this change or not.

[Kyle] could you help to guide me how to modify it as you mention "Multiplier of unit clock setting from 100 to 105 " ? thanks ~

0 Likes

Hello,

Please find my comments below:

1. [Kyle] No. there is w/o error message w/ the following code via UART.

It is not recommended to add Debug Prints inside DMA callback function. Please try calling the Debug Prints at all points just before the function CyCx3UvcApplnStop() is called. This can be used to understand what triggered this call.

2. [Kyle] currently i set the CX3_UVC_DATA_BUF_SIZE=0x6000, CX3_UVC_STREAM_BUF_COUNT=4

could you suggest me the value of DMA buffer to try ?

As of now, you can use the same size for the DMA buffer. If required, we will change it later. But, I would like to know the size of video frame that is sent to the host. As you might be knowing, for your case, the size of frame that is sent to the host can be calculated as:

Frame size = 1280*1932*2 = 4945920 bytes.

To send the frame completely to host, more than one DMA buffer would be required. The number of DMA buffers required can be exactly calculated by dividing the frame size with the DMA buffer size (24576 bytes currently for your firmware). This will give the number of full buffers required for transmitting the frame. The last buffer will be a partial buffer.

We need to find the total frame size received by CX3 and sent to the host. For this, please add the following modification to the cycx3_uvc.c file.

a. Declare two global variables (fsize and fcplt) as follows:

b. Add the following modifications to the code for calculating the frame size:

pastedImage_2.png

c. Print the frame size in the infinite for loop and reset the variables again as shown below:

d. Change the last parameter of the API CyU3PEventGet() inside the infinite for loop from CYU3P_WAIT_FOREVER to 1000.

This can help us to understand the frame size received by CX3 and sent to the host.

3. [Kyle] could you help to guide me how to modify it as you mention "Multiplier of unit clock setting from 100 to 105 " ?

The multiplier of unit clock setting is a part of CX3 MIPI receiver configuration settings of the MIPI configuration utility. From your response 5, this parameter is set to 120 in your project. Please change this from 100 to 105 and let me know if you see any improvements.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

i found 2 issues after tracing the log msg you suggest in previous reply, i think the 2 issues root cause should be same, may need your favor to provide related suggestion how to fix or further debugging ? thanks ~

1. The Appstop in the UART debug logs, it's called in CyCx3UvcAppThread_Entry with "eventFlag & CX3_DMA_RESET_EVENT" been setted as following pic, as you mention it should be due to failures in data transfer, then i try to check the  API CyU3PDmaMultiChannelCommitBuffer, it return the error code "CY_U3P_ERROR_INVALID_SEQUENCE".

201123C.JPG

2. I tried to add your suggestion in previous reply to find the total frame size received by CX3 and sent to the host in cycx3_uvc.c file,

but there is no any msg output via UART, then i found the DmaBuffer.count is more than CX3_UVC_DATA_BUF_SIZE, i wonder the issue root cause should be same as previous issue 1.

201123D.JPG

Pic : msg output via UART

201123B.JPG

0 Likes

Hello,

As per our previous discussions on this thread, I understand that you are binding the device to Cypress driver (cyusb3.sys). If this is the case, is your host application developed by modifying Streamer Application?

Also, the commit buffer failures with CY_U3P_ERROR_INVALID_SEQUENCE error comes up when the host is slow to issue the IN tokens to clear the DMA buffers filled by the GPIF II socket. As you doubt, there is a possibility than the last partial buffer associated with a frame could be missed due to the Appstop and Appstart sequence following a Commit Buffer failure. Please try the following and let us know the results:

1. Increase the DMA buffer size (CX3_UVC_DATA_BUF_SIZE) to 0x8FD0 (from 0x6000). You can reduce the buffer count to 3.

2. Please test using different hosts and let us know the results.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

Yes, i am developing the Streamer Application as host application as following pic with Cypress driver (cyusb3.sys).

control_1.JPG

Here is my steps to start streaming

control_2.jpg

1. Increase the DMA buffer size (CX3_UVC_DATA_BUF_SIZE) to 0x8FD0 (from 0x6000). You can reduce the buffer count to 3.

[Kyle] it is not work for the issue.

2. Please test using different hosts and let us know the results.

[Kyle] i have tried 2 hosts but all fail, one is laptop the other is desktop.

However, i tried to adjust the resolution to test.

The original frame size i need should be 1280(640*2)*1932(483*4)*2(byte) = 4,945,920 bytes.

i tried to reduce the sensor resolution with sensor setting to VGA 640*480*2(byte) = 614,400 bytes,

then, i found the frame size received by CX3 is constant and correct as below pic.

201125A.JPG

after that, i tried to increase the resolution with sensor setting to 1280(640*2)*480*2(byte) = 1,228,800 bytes,

the frame size received by CX3 is constant but INCORRECT as below pic, it's only 965,520 bytes, and the frame size will be changed to  965344、965552 ... when i re-run again after reset the CX3.

Moreover, i had tried to modify the DMA buffer size (CX3_UVC_DATA_BUF_SIZE) to 0x8000 and 0x8FD0 (from 0x6000) and reduce the buffer count to 3, but it's still fail.

Could you help to provide the related suggestion ? Thanks ~

201125B.JPG

0 Likes

Hello,

While choosing the DMA buffer size, the following needs to be taken care of:

1. The DMA buffer size (including size of footer and trailer) should be a multiple of 16 bytes.

2. The frame should end with a partial buffer. This can be ensured by dividing the Frame size in bytes with the DMA buffer size in bytes (excluding size of footer and trailer). The frame size in bytes should not be perfectly divisible by DMA Buffer size.

Please try to keep the DMA buffer size as large as possible without contradicting the requirements mentioned above. If possible, please keep it as 0x8FD0.

We feel that the host is issuing IN packets slowly to clear the DMA buffers filled by the GPIF II socket. So, please try increasing Packets per xfer from 32 to 256 in steps and xfers to queue from 16 to 32. Please let me know if there are any improvements with the new settings. Also, please share snapshots of the Streamer application when you run it with the default settings and the modified settings. In addition to this, if you have modified the default streamer application that comes along with FX3 SDK, then please try these tests on both the default and the modified applications and share the result with us.

Also, please let me know if you changed the code to print the Frame size? This is because I find that lower frame sizes are printed in the UART logs shared in the previous response.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

Because i am new one to develop bridge IC such as CX3, so i based on Non_UVC as following link for reference with "CX3_RAWData_Cypress Driver and Descriptors.zip" to develop,

https://community.cypress.com/thread/16971

from the Non-UVC sample project, the footer and trailer are both set to be 0, if it's wrong setting please correct me.

201125C.JPG

I have tried to increase Packets per xfer from 32 to 256 in steps and xfers to queue from 16 to 32 (even to 64), but there no improvement with the new settings.

Here is the default streamer and my log for reference.

201125D.jpg

AppInit:GpifSMStart passed

AppInit:CyU3PMipicsiGetErrors errCnts = 0x0

bRType = 0xC0, bRequest = 0xA0, wValue = 0xE600, wIndex = 0x0, wLength= 0x1

Firmware Version: 0.516.200918.5

bRType = 0xC0, bRequest = 0xA0, wValue = 0x0, wIndex = 0x0, wLength= 0x1

bRType = 0x40, bRequest = 0x99, wValue = 0x0, wIndex = 0x0, wLength= 0x200

AplnStrt:SMState = 0x2

CyU3PDmaMultiChannelCommitBuffer_errorflag = CY_U3P_ERROR_INVALID_SEQUENCE

CyCx3UvcAppThread_Entry - if( eventFlag & CX3_DMA_RESET_EVENT)

AplnStop:SMState = 0xA

AplnStrt:SMState = 0x1

CyU3PDmaMultiChannelCommitBuffer_errorflag = CY_U3P_ERROR_INVALID_SEQUENCE

CyCx3UvcAppThread_Entry - if( eventFlag & CX3_DMA_RESET_EVENT)

AplnStop:SMState = 0x1

AplnStrt:SMState = 0x1

CyU3PDmaMultiChannelCommitBuffer_errorflag = CY_U3P_ERROR_INVALID_SEQUENCE

CyCx3UvcAppThread_Entry - if( eventFlag & CX3_DMA_RESET_EVENT)

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

CyU3PDmaMultiChannelCommitBuffer_errorflag = CY_U3P_ERROR_INVALID_SEQUENCE

CyCx3UvcAppThread_Entry - if( eventFlag & CX3_DMA_RESET_EVENT)

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

CyU3PDmaMultiChannelCommitBuffer_errorflag = CY_U3P_ERROR_INVALID_SEQUENCE

CyCx3UvcAppThread_Entry - if( eventFlag & CX3_DMA_RESET_EVENT)

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

CyU3PDmaMultiChannelCommitBuffer_errorflag = CY_U3P_ERROR_INVALID_SEQUENCE

CyCx3UvcAppThread_Entry - if( eventFlag & CX3_DMA_RESET_EVENT)

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

CyU3PDmaMultiChannelCommitBuffer_errorflag = CY_U3P_ERROR_INVALID_SEQUENCE

CyCx3UvcAppThread_Entry - if( eventFlag & CX3_DMA_RESET_EVENT)

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

CyU3PDmaMultiChannelCommitBuffer_errorflag = CY_U3P_ERROR_INVALID_SEQUENCE

CyCx3UvcAppThread_Entry - if( eventFlag & CX3_DMA_RESET_EVENT)

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

CyU3PDmaMultiChannelCommitBuffer_errorflag = CY_U3P_ERROR_INVALID_SEQUENCE

CyCx3UvcAppThread_Entry - if( eventFlag & CX3_DMA_RESET_EVENT)

AplnStop:SMState = 0x5

AplnStrt:SMState = 0x1

Frame size is 2571248

CyU3PDmaMultiChannelCommitBuffer_errorflag = CY_U3P_ERROR_INVALID_SEQUENCE

CyCx3UvcAppThread_Entry - if( eventFlag & CX3_DMA_RESET_EVENT)

AplnStop:SMState = 0x2

AplnStrt:SMState = 0x2

Frame size is 965616

CyU3PDmaMultiChannelCommitBuffer_errorflag = CY_U3P_ERROR_INVALID_SEQUENCE

CyCx3UvcAppThread_Entry - if( eventFlag & CX3_DMA_RESET_EVENT)

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Frame size is 965616

CyU3PDmaMultiChannelCommitBuffer_errorflag = CY_U3P_ERROR_INVALID_SEQUENCE

CyCx3UvcAppThread_Entry - if( eventFlag & CX3_DMA_RESET_EVENT)

AplnStop:SMState = 0x5

AplnStrt:SMState = 0x1

Frame size is 965616

CyU3PDmaMultiChannelCommitBuffer_errorflag = CY_U3P_ERROR_INVALID_SEQUENCE

CyCx3UvcAppThread_Entry - if( eventFlag & CX3_DMA_RESET_EVENT)

AplnStop:SMState = 0x5

AplnStrt:SMState = 0x1

Frame size is 965616

CyU3PDmaMultiChannelCommitBuffer_errorflag = CY_U3P_ERROR_INVALID_SEQUENCE

CyCx3UvcAppThread_Entry - if( eventFlag & CX3_DMA_RESET_EVENT)

AplnStop:SMState = 0x7

AplnStrt:SMState = 0x1

Frame size is 965616

CyU3PDmaMultiChannelCommitBuffer_errorflag = CY_U3P_ERROR_INVALID_SEQUENCE

CyCx3UvcAppThread_Entry - if( eventFlag & CX3_DMA_RESET_EVENT)

AplnStop:SMState = 0x2

AplnStrt:SMState = 0x2

Frame size is 965616

Also, please let me know if you changed the code to print the Frame size? This is because I find that lower frame sizes are printed in the UART logs shared in the previous response.

[Kyle] i don't have changed the code to print the Frame size, actually it's LARGER frame size at the first frame to print with UART log.

Moreover, I have also modified the default streamer application that comes along with FX3 SDK, but it's still fail and the result is same as default streamer.

0 Likes

Hello,

Please confirm that the snapshot of streamer shared in your previous response was for the resolution 1280*1932*2bytes @ 30fps.

Also, please find my comments and requests for further debug below:

1. Please use the default streamer application and vary the packets per xfer from 32 to 256 and xfers per queue from 16 to 32. After this, please share the snapshots for each case. We would like to check if the Transfer Rate is increasing or not. Please try this on the default streamer application.

2. In the control center, when you send the vendor command, please set the following fields as mentioned below:

a. Bytes to Transfer : 0

b. Direction: OUT

c. Req Type: Vendor

d. Target: Device

e. Req Code: 0x99

The remaining fields can be kept as such.

3. Before sending the vendor command, start the streamer. That is, use the following sequence to collect the data from the device:

a. Set the parameters on streamer and control center application.

b. Start the streamer first.

c. Immediately send the vendor command using control center.

Also, the footer and header can be kept as 0 bytes itself as the application is not UVC compliant.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

Please confirm that the snapshot of streamer shared in your previous response was for the resolution 1280*1932*2bytes @ 30fps.

[Kyle] No, i reduced the sensor setting with resolution 1280*480*2(byte) = 1,228,800 bytes @ 30fps.

As previous mention, i tried to simplify the issue so i tried to reduced the sensor setting with 2 kind of resolutions, here is the test result and i config the same CyU3PMipicsiCfg_t as below IMX528_RAW12_MODE_AA,

1.   640*480*2(byte) @ 30fps (614,400 byte) - got correct frame size w/ 614,400 bytes

2. 1280*480*2(byte) @ 30fps (1,228,800 bytes) - got incorrect frame size w/ 965,520 bytes  <-- that's i am trying to debugging.

CyU3PMipicsiCfg_t IMX528_RAW12_MODE_AA =

{

    CY_U3P_CSI_DF_RAW12,  /* CyU3PMipicsiDataFormat_t dataFormat */

    2,                          /* uint8_t numDataLanes */

    2, /* uint8_t pllPrd */

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

    0x0203,                 /* uint16_t mClkCtl */

    CY_U3P_CSI_PLL_CLK_DIV_2, /* CyU3PMipicsiPllClkDiv_t mClkRefDiv */

    1280,         /* uint16_t hResolution */

    0                         /* uint16_t fifoDelay */

};

#define CX3_UVC_DATA_BUF_SIZE                   (0x8FD0)

#define CX3_UVC_STREAM_BUF_COUNT                (3)

1. Please use the default streamer application and vary the packets per xfer from 32 to 256 and xfers per queue from 16 to 32. After this, please share the snapshots for each case. We would like to check if the Transfer Rate is increasing or not. Please try this on the default streamer application.

2. In the control center, when you send the vendor command, please set the following fields as mentioned below:

a. Bytes to Transfer : 0

b. Direction: OUT

c. Req Type: Vendor

d. Target: Device

e. Req Code: 0x99

The remaining fields can be kept as such.

3. Before sending the vendor command, start the streamer. That is, use the following sequence to collect the data from the device:

a. Set the parameters on streamer and control center application.

b. Start the streamer first.

[Kyle] I followed your suggestion as above, set the fields in control center and using the default streamer to vary the different xfer and queue, the result is wired as below, the Transfer Rate is decreasing once Packets per Xfer over 32, and the Xfers to Queue doesn't change the frame rate.

201126_X32.jpg

201126_X64.jpg

201126_X128.jpg

201126_X256.jpg

0 Likes

Hello,

Can you please share the firmware so that I can have a look at it?

If you are trying to stream 1280*480 (2byte) at 30 fps, then it is ok to keep the packets per xfer as 32 and xfers to queue as 16 itself. Please try reducing the timeout per xfer from 1500 to 100 when you increase packets per xfer in order to prevent reduction in data rate.

As you have not done any change on the firmware for calculating and printing the frame size, I suspect that the sensor is sending 965,520 bytes only when you try to configure it to send 1280*480 (2 byte) at 30 fps. Please share the complete project that supports this resolution so that I can have a look at it.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

Can you please share the firmware so that I can have a look at it?

[Kyle] Yes and many thanks for your help, i can share my project code to you, but because i have hard code the sensor register setting in it, it's may not proper to attached in Community, may i have your e-mail address to send it via e-mail ?

As you have not done any change on the firmware for calculating and printing the frame size, I suspect that the sensor is sending 965,520 bytes only when you try to configure it to send 1280*480 (2 byte) at 30 fps. Please share the complete project that supports this resolution so that I can have a look at it.

[Kyle] I see your point, basically, i have confirmed the other bridge platform EVK (FPGA based) is work fine for the same ToF module and same sensor setting, but... the other EVK platform is not develop by me, so i don't have the source code to confirm is there any improvement be used.

0 Likes

Hello,

Please share the project after removing the sensor configuration settings from it to the mail ID sent to you.

Best regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Hello,

Thank you for sharing the project. Please find my comments below on the same:

1. Please confirm that you are configuring the sensor and the CX3 MIPI Receiver correctly when you receive the vendor command 0x99. This is because, I found that the handling of vendor command is done as follows:

pastedImage_0.png

You can refer to the following thread to understand how to handle the vendor command 0x99 for this application:

cx3 raw streamer is not work.

2. Please reduce the Multiplier of Unit Clk setting from 120 to 80 in the CX3 Receiver Configuration Tab of MIPI Configuration Utility as shown below:

pastedImage_2.png

3. Also, please reset fcplt to CyFalse and fsize to 0 inside Appstop().

Please try the suggestions mentioned above and share the UART debug logs.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes