CX3 : CB Failure

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

cross mob
TaKI_297676
Level 3
Level 3
10 questions asked 25 sign-ins 10 replies posted

At CX3, 

 

Sometimes (frequently) "CB Failure" is happened. 

After "CB Failure" was happend,  "ApInstop -> ApInStart"

(Now, system is working on 97fps, 1920x1200)

Logs (UART) are belows

==================================================

AplnStrt:SMState = 0x1
CB failure
AplnStop:SMState = 0x9
AppStart

AplnStrt:SMState = 0x2
CB failure
AplnStop:SMState = 0x7
AppStart

AplnStrt:SMState = 0x1
CB failure
AplnStop:SMState = 0x9
AppStart

AplnStrt:SMState = 0x2
CB failure
AplnStop:SMState = 0x5
AppStart

================================================

 Please, let me know how to fix it.

(I think when it was happened, system performance maybe is too low.) 

0 Likes
1 Solution

Hello,

Glad to know that the Cb Failure problem is solved by changing the USB descriptors as per this KBA Streaming RAW10 Format Input Data to 16/24-bit Out... - Cypress Developer Community 

I think the problem was caused by cycx3_uvcdscr.c. there are bit setting is 16bit. it is strange.

>> RGB24 video format is not supported by AMCap/eCamView/MPC - HC. So I had changed the video format to YUY2 format (this doesn't mean that there will be video format conversion). Changing video format (GUID) in USB descriptors will indicate the host application to sample the video data as per the mentioned GUID video format (that is why 16 bits). AMCap supports YUY2 format and that is why the streaming is without Cb Failure

4. We are using RGB24 because of high speed image. if using RAW8, Sensor has max speed 30fps. but we need more frame rate. for high speed image, input data width must be wide image depth. (camera set only 8bit).

>> Do you mean that image sensor outputs RAW8 format? or does the sensor outputs RGB format? 

It is recommended to configure CX3 MIPI Receiver with the same settings as the MIPI transmitter (Sensor).

Can you please share the snapshot (picture) of broken image that is received and the expected video image.

Regards,
Rashi

View solution in original post

0 Likes
16 Replies
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Please let me know the bits per pixel of the video

The maximum bandwidth supported by CX3's GPIF is 2.4Gbps

So 1920*1200*97* bits/pixel <= 2.4 Gbps

The commit buffer failures are seen when the DMA buffers are not emptied/consumed by the USB host as fast as the sensor writes the to the DMA buffers (i.e. Overrun condition)

 

Regards,
Rashi
0 Likes

TaKI_297676_5-1611916552070.png

 

I already confirmed it at another question.

Mipi 4ch and 300MHz 

 

0 Likes

Hello,

As per the description of the thread, the video resolution streamed is 1920 * 1200 @97 fps but the CX3 MIPI configuration snippet shows the resolution is 640* 1200. Please confirm the correct resolution

The maximum bandwidth supported by CX3's GPIF is 2.4Gbps

So, if the video resolution is 1920*1200 then  1920*1200*24(bits/pixel) * 97   >   2.4 Gbps. This resolution cannot be streamed using CX3

Regards,
Rashi
0 Likes

Hello, 

I’m sorry that I  didn’t explain enough about that.

Sensor setting values are for 1920x1200@97fps 8bit raw. For high speed, I think we should set cx3 for wide band width.  So I set resolution 1920 -> 640 (1/3) and bandwidth 8 bit -> 24bit (x3) on mipi configure for CX3.

0 Likes
lock attach
Attachments are accessible only for community members.
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Thank you for the details.

If the video from the sensor is in RAW8 format you can keep it as RAW 8 and then configure the output format as 24 bits ( RGB24). With this the maximum CX3 bandwidth can be used.

Please refer to this KBA Streaming RAW10 Format Input Data to 16/24-bit Out... - Cypress Developer Community which mentions how the RAW 10 (in your case RAW8) will be packed to 24 bits and fed to CX3's GPIF.

You can try using the attached MIPI config. If this doesn't help, please share the complete UART debug print with CX3_DEBUG_ENABLED and PRINT_FRAME_INFO macro enabled.

And let me know the DMA buffer size (CX3_UVC_STREAM_BUF_SIZE) used in your application.

 

Regards,
Rashi
0 Likes

Hello

-=======================================

DMA buffer size is set in code

#define CX3_UVC_DATA_BUF_SIZE (0x8FD0)
#define CX3_UVC_PROD_HEADER (12) /* UVC DMA Buffer Header Size */
#define CX3_UVC_PROD_FOOTER (4) /* UVC DMA Buffer Footer Size */

#define CX3_UVC_STREAM_BUF_SIZE (CX3_UVC_DATA_BUF_SIZE + CX3_UVC_PROD_HEADER + CX3_UVC_PROD_FOOTER)

=======================================================

And When "CB Failure" was happened, log was below

(CX3_DEBUG_ENABLED and PRINT_FRAME_INFO are already defined.)

=======================================================

AplnStrt:SMState = 0x1
CB failure
AplnStop:SMState = 0x9
AppStart

AplnStrt:SMState = 0x2
CB failure
AplnStop:SMState = 0x7
AppStart

AplnStrt:SMState = 0x1
CB failure
AplnStop:SMState = 0x9
AppStart

AplnStrt:SMState = 0x2
CB failure
AplnStop:SMState = 0x5
AppStart

================================================

About CB Failure, if output pixel clock is lower than now (now : 97.6MHz), could i fix it? 

(minimum 78.03MHz)

=========================================================

I have another question.

Byte sequence is belows in MIPI 4 Lane. (MIPI Spec)

TaKI_297676_0-1612178871274.png

If 1 byte is 1 pixel (Raw 8bit), byte sequence is same to pixel sequence.

But now, I use MIPI config for  RGB888. (RGB24bit).

This means pixel arrange is needed.

MIPI  spec. for RGB888 is below

 

TaKI_297676_1-1612179279084.png

if it compares to MIPI 4lane spec, B1 = Byte 0@lane1, G1 = Byte1@lane2, R1=Byte2@lane3, B2=Byte3@lane4, G2=Byte4@lane1...... are these right?

It is important for fixing pixels-re-arrange problem.

(Our test result is it was correct. we was able to arrange our pixels correctly.) 

0 Likes

Hello,

The CB failure is seen when the host is slow to consume the data in the CX3's DMA buffer.

Please add the following debug prints in CyCx3UvcAppThread_Entry to track the producer and consumer events and share the complete UART debug prints

/* Initialize the UVC Application */
    CyCx3UvcAppInit();

    for (;;)
    {
        eventFlag = 0;
        CyU3PDebugPrint(4,"\n\rProd = %d Cons = %d", TxCountflag, RxCountflag);
        
#ifdef PRINT_FRAME_INFO

About CB Failure, if output pixel clock is lower than now (now : 97.6MHz), could i fix it? 

(minimum 78.03MHz)

>> Please do not reduce the PCLK as that would increase the  H Active Period ( H blanking period will be reduced) To avoid CB failure H Blanking should be high. 

Also confirm if system clock is configured for 403.2 MHz

clockConfig.setSysClk400 = CyTrue;

 Please note that as per CX3 TRM each video format has a CSI -2  Data type (Section 1.6)associated with it. If the sensor streams RAW 8 format, CX3 MIPI receiver should be configured for the same.

The input data format in the CX3 MIPI Receiver Tool should be RAW 8 and the parallel output can be configured for 24 bits. Please note that CX3 MIPI does not convert the video format. When input data format is RAW 8 and parallel output width is 24, the MIPI receiver will just pack the serial data to send it over the 24 bit parallel bus. 

Please refer to this KBA for more details Streaming RAW10 Format Input Data to 16/24-bit Out... - Cypress Developer Community 

Regards,
Rashi
0 Likes

Hello, 

"clockConfig.setSysClk400=CyTrue" is already applied.

 

As you wished, i attached log.

==================== (When CB failure)

Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 62
Prod = 62 Cons = 62
Prod = 62 Cons = 62
Prod = 62 Cons = 62
Prod = 62 Cons = 62
Prod = 62 Cons = 62
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
CB failure
AplnStop:SMState = 0x9
AppStart

AplnStrt:SMState = 0x1
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61
Prod = 62 Cons = 61

================================================

In my case, H Blank is 176 and 1.76us. (H active 640@4ch 6.4us)

I think it is enough.

0 Likes

Hello,

Please let me know if the device enumerates as USB 3.0 device and CyU3PUsbGetSpeed returns CY_U3P_SUPER_SPEED.

Also let me know which host application and the host PC configuration are used for viewing the video streaming.

Let me know if the firmware is generated by the tool as mentioned in this KBA Steps to Setup up MIPI CSI Camera Solution with CX... - Cypress Developer Community  Please share the firmware for us to check (sensor settings are not needed)

Regards,
Rashi
0 Likes

Hello, 

I checked usb superspeed or not when appstart.

logs are below

===================================================

CyU3PUsbGetSpeed = CY_U3P_SUPER_SPEED
AplnStrt:SMState = 0x1
CB failure
AplnStop:SMState = 0x7
AppStart

CyU3PUsbGetSpeed = CY_U3P_SUPER_SPEED
AplnStrt:SMState = 0x1

===============================================

 

Source Code is almost same to the code generated by "Ez USB Suite".

I didn't change buffer size, and etc. 

TaKI_297676_0-1612410031915.png

Host PC with Windows10 Pro

TaKI_297676_1-1612410108937.png

Host application for UVC : webcamoid 

 

Please let me know what you should get.

What is Firmware?

Compiled "bin"? or source code?

 

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

Hello,

Thank you for confirming that the firmware is same as the generated by CX3 MIPI Receiver Configuration Tool and no changes are made to the firmware other than adding sensor settings. Please share the firmware source (cycx3_uvc.c, cycx3_uvc.h, cycx3_uvcdscr.c)

Please try using other host application like AmCap, eCamView or MPC HC player.

Also, try using the attached MIPI configuration and please try reducing the frame rate to ~90 fps and let me know if that works fine.

The actual h blanking period output from MIPI receiver to GPIF will be H total (under MIPI CSI2 input(timings)) - H active (CX3 MIPI Interface Configuration). Increasing the H blanking will help to reduce the speed difference between the sensor and the USB host (that will avoid the DMA buffer overrun - Cb Failure)

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

Hello, files are attached.

I tested AMUSB. But there was same problem.

 

When reducing frame rate to 90fps, error was happened less frequently.

But CB failure was happened.

TaKI_297676_0-1612507897300.png

 

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

Hello,

I tested AMUSB. But there was same problem.

>> Please let me know the host PC OS that  you working on. If you are working with Windows please try using host application like AmCap, eCamView or MPC HC player or for Linux you can use guvcview. 

- Please let me know if you are able to video stream on the host application. As the CB Failures are seen, there will be some glitches seen in  video streaming. But it is the video as expected?

1) RGB24 as input data format:  I have modified the UVC descriptors as per the KBA Streaming RAW10 Format Input Data to 16/24-bit Out... - Cypress Developer Community . Please use the attached files in your project and build the project again and let me know if it works at 97 fps (please configure the MIPI transmitter for same setting. If it doesn't work please share the UART debug prints (.txt) with us.

2) Also, let me know if the configuration mipi_check_1.png worked.

From your post I see tat RGB24 is the input data format used but as per our discussion the sensor is streaming RAW8 format. Please let me know why do you use RGB24 as input data format.

3) RAW8 as input data format: Please find the attached firmware generated by the tool.  The cyu3imgasensor.c and cyu3imgagesensor.h are also created and saved in this project. The cyu3imagesensor.c file is used to configure and control the image sensor. In this file, some structures are defined without a valid value. You need to replace these values with actual settings. Save and build the project.  Please let me know if this works and share the UART debug prints.

4) Please share the PC configuration (like OS , core)  with which the streaming is tested.

Regards,
Rashi
0 Likes

Hello, 

First of all, for high speed image, build option must be "Release".

1. PC OS is Windows 10.

2. When CB Failure was happened, any glitches on video stream wasn't happened.

And now, I found when AMCap window for display was clicked and moved, CB Failure was happened easily. 

3. By files in u-NOVA2_AR0234CS(2).zip, our program was compiled. but it was working well.

I think the problem was caused by cycx3_uvcdscr.c.

TaKI_297676_0-1612766795677.png

there are bit setting is 16bit. it is strange.

4. We are using RGB24 because of high speed image.

if using RAW8, Sensor has max speed 30fps. but we need more frame rate.

for high speed image, input data width must be wide image depth. (camera set only 8bit) 

5. OS windows 10, 

TaKI_297676_1-1612767079219.png

and where is mipi_check_1.png?

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

I attached log. (change to files, u-NOVA2_AR0234CS(2).zip)

"CB failed" was not happened. but image was broken.

 

0 Likes

Hello,

Glad to know that the Cb Failure problem is solved by changing the USB descriptors as per this KBA Streaming RAW10 Format Input Data to 16/24-bit Out... - Cypress Developer Community 

I think the problem was caused by cycx3_uvcdscr.c. there are bit setting is 16bit. it is strange.

>> RGB24 video format is not supported by AMCap/eCamView/MPC - HC. So I had changed the video format to YUY2 format (this doesn't mean that there will be video format conversion). Changing video format (GUID) in USB descriptors will indicate the host application to sample the video data as per the mentioned GUID video format (that is why 16 bits). AMCap supports YUY2 format and that is why the streaming is without Cb Failure

4. We are using RGB24 because of high speed image. if using RAW8, Sensor has max speed 30fps. but we need more frame rate. for high speed image, input data width must be wide image depth. (camera set only 8bit).

>> Do you mean that image sensor outputs RAW8 format? or does the sensor outputs RGB format? 

It is recommended to configure CX3 MIPI Receiver with the same settings as the MIPI transmitter (Sensor).

Can you please share the snapshot (picture) of broken image that is received and the expected video image.

Regards,
Rashi
0 Likes