cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

ArSa_3842301
New Contributor II

Hi,

I am currently working with CX3 device getting frames from a CMOS Image Sensor(CIS). I have configured the MIPI information to get the data raw in RGB888 format, because I know that it is the only way for getting the maximum bandwidth. I have configured the PLL registers in order to set the PCLK in 100MHz(so CX3's data rate is 2.4Gbps).

On the other hand, I have done the same thing in the CIS, I mean, I have configured the PLLs for getting a similar bandwidth, all good for now. When I run a host application,from Laptop, which works directly with CX3 device. I have got a correct image, but if I open the debug port I can see how it appears the following issues:

- CB Failure.
- Video Timer.

So, I would like to know which is the cause or causes of both issues, and how try to fix them.

Thanks.

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator

Hello,

From the description, I understand that video streaming via CX3 works fine.

The Video timer failure happens when the time difference between two consecutive frames received by CX3 is more than the timer value. You can increase the timer period to value more than the V Total time.

Cb Failure print is seen when CyU3PDmaMultiChannelCommitBuffer API fails. If the API fails with error code 71 (0x47), please refer to this KBA for the reason of this failure Invalid Sequence Error in Multi-Channel Commit Buf... - Cypress Developer Community 

To avoid commit buffer failure due to invalid sequence error, please try the following:

1. Please check if the video data rate <= 2.4Gbps. Also, check the if the system clock is configured as 403.2 MHz.

clockConfig.setSysClk400 = CyTrue; //403.2 MHz

2. Allocate the maximum possible memory to the DMA buffers.  Please check if DMA buffer size is not multiple of video line size. You can refer to this KBA DMA Buffer Count - KBA218339 - Cypress Developer Community. to know the maximum DMA buffer size and count that can be configured based on RAM size of CX3. Also note, that the Rx Payload size of the probe control structure should  greater or equal to DMA buffer size

3. Configure horizontal blanking of the image sensor as high as possible (to do this vertical blanking can be reduced thereby maintaining same frame rate). While doing this make sure that vertical blanking does not go below ~350 us.

Regards,
Rashi

View solution in original post

0 Likes
5 Replies
Rashi_Vatsa
Moderator
Moderator

Hello,

From the description, I understand that video streaming via CX3 works fine.

The Video timer failure happens when the time difference between two consecutive frames received by CX3 is more than the timer value. You can increase the timer period to value more than the V Total time.

Cb Failure print is seen when CyU3PDmaMultiChannelCommitBuffer API fails. If the API fails with error code 71 (0x47), please refer to this KBA for the reason of this failure Invalid Sequence Error in Multi-Channel Commit Buf... - Cypress Developer Community 

To avoid commit buffer failure due to invalid sequence error, please try the following:

1. Please check if the video data rate <= 2.4Gbps. Also, check the if the system clock is configured as 403.2 MHz.

clockConfig.setSysClk400 = CyTrue; //403.2 MHz

2. Allocate the maximum possible memory to the DMA buffers.  Please check if DMA buffer size is not multiple of video line size. You can refer to this KBA DMA Buffer Count - KBA218339 - Cypress Developer Community. to know the maximum DMA buffer size and count that can be configured based on RAM size of CX3. Also note, that the Rx Payload size of the probe control structure should  greater or equal to DMA buffer size

3. Configure horizontal blanking of the image sensor as high as possible (to do this vertical blanking can be reduced thereby maintaining same frame rate). While doing this make sure that vertical blanking does not go below ~350 us.

Regards,
Rashi

View solution in original post

0 Likes
ArSa_3842301
New Contributor II


Firstly,Thanks for your response.

On the one hand, In last message I forgot tell you that that there is a correlation between both,the software architecture from host and how often appear the errors. I mean, having the same image firmware embedded in CX3, if I open the camera using OpenCV via Direct Show, I have not any problem, the application runs correctly,CB Failure appears only few times along the execution time and the Video Timer never appear.

But When I open the camera via Microsft Media Foundation(MSMF) We have all the problems that I told you before. I can see the image from the Camera, but both CB Failure as Video Timer appears with high frecuency.

So, my question is the following:

It is possible that the problem was from Host Application, because of the asynchronism at the time of getting a new frame? Or it is possible that the error was from the CX3's firmware configuration?. how it is possible that the same firmware image does not show any problem with Direct Show based on OpenCV, and shows the mentioned problems with Microsoft Media Foundation?.

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

As I mentioned before, the commit buffer failures (CB Failure) generally occurs when host is slow to issue the USB requests to CX3 to consume the DMA buffers of CX3. So, the host applications used might have differences in the way USB requests are sent to device which might be the reason for CB Failure. Please let me know if the same PC is used for testing with different host applications.

Please let me know if you are using the default CX3 firmware generated by the CX3 MIPI Receiver Configuration tool as mentioned in this KBA Steps to Setup up MIPI CSI Camera Solution with CX... - Cypress Developer Community 

If yes, the video timer starts when the first PROD event received for the  video frame and is stopped when partial buffer is consumed (which indicates  end of frame).  If the timer overflows , the Video timer print is seen.

Please share UART debug prints for both the cases for us to understand the problem better.

Regards,
Rashi
0 Likes
ArSa_3842301
New Contributor II

about your questions, yes I have run the host applications from the same laptop, so I guess that the CB Failure is caused by the asynchronism between host app and CX3.

Yes, I am using using the default CX3's firmware generated by the CX3 MIPI Receiver Configuration tool. I am using a full frame configuration for a 13MPixels CMOS.

About the Video Timer. I have realized that there is a hard Image sensor reset when the issue appears. And I have seen it is because of the RTOS embedded into CX3 calls both functions CyCx3_ImageSensor_Sleep() and CyCx3_ImageSensor_Wakeup(). And for this reason, I have a freezed image in host application each time that Video Timer error appears. So, my question is: There is any firmware modification available to cancel this error?, I mean, for example It is possible to avoid the CyCx3_ImageSensor_Sleep() and CyCx3_ImageSensor_Wakeup() calls functions, in order to not getting the frezed image althought the Video timer appears?

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

In the firmware, sensor reset is done using CyU3PMipicsiSetSensorControl API

Please share the UART debug prints for us to check from where is CyCx3_ImageSensor_Wakeup and CyCx3_ImageSensor_Sleep is called. 

In the default firmware, after initialization these API are called in the handling of CX3_USB_SUSP_EVENT_FLAG event.

Regards,
Rashi
0 Likes