CX3 stream stops with repeating CB_failure error on some Android phones.

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

cross mob
BJ
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Hello.

I'm working with CX3 conencted to the sensor which streams RAW8 data at 2592x920@30fps. My goal is to make this work with Android phones which support superspeed USB. (Galaxy S series, for example)

After lots of trials and errors, I manage to make it work with a few Android phone such as Galaxy20.

The problem I have been struggling to solve is that it doesn't work well with all superspeed supporting Android phone. As I tested on Galaxy S9 and S10 (both phones also supports Superspeed), the streaming stops with CB_Failure after a few frames. USB versions on each phone may not be identical, but I confirmed that all phones above meets 5Gbps at least.

I have read all articles talking about CB_failure and tried the recommended modification, but didn't work for my case.

Does it possibly happen that UVC camera operates diffrently depending on devices? Could anyone give me advice or suggestion to try?  I have been stuck in this problem without progress for long time.

Thnaks in advance.

 

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

From the UART print it seems that the data is not received from the sensor as both prod and cons prints are 0. When the DMA buffer is filled with the data from the sensor, the producer event is triggered and consumer events (cons) will be triggered once the USB host consumes the data from the DMA buffer.

Can you please confirm if you are using the default firmware generated by the CX3 configuration tool as mentioned in this KBA  Steps to Setup up MIPI CSI Camera Solution with CX... - Cypress Developer Community  

To check if streaming from sensor is resumed after the CB failure, please try probing the test points mentioned in Q10 of this KBA  CX3 Hardware: Frequently Asked Questions - KBA9129... - Cypress Developer Community   and share the traces.

Regards,
Rashi

View solution in original post

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

Hello,

Please let me know which host application are you using to stream the video. Can you please try using the host application suggested in this thread  Solved: CX3 -Android - Cypress Developer Community  

As mentioned by you that after implementing the workarounds , the streaming is not seen. Please confirm if the streaming is not seen completely (i.e. black screen or some error) or is the streaming seen but with some glitches.

Please let me know if the firmware used is similar to the firmware generated by the CX3 MIPI Receiver Tool. If yes, could you share the UART debug prints when the issue is seen? If yes, kindly enable the macros like CX3_DEBUG_ENABLED , PRINT_FRAME_INFO and CX3_ERROR_THREAD_ENABLE before capturing the UART logs.

Regards,
Rashi
0 Likes
BJ
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Thank you for the response.

I tested with test app which  I modified and built the base source here - https://github.com/jiangdongguo/AndroidUSBCamera. I have tested with the CameraFi2 app. The result is same.

When CB Failure error occurs, screen just shows the previous normal frame, which mean no frame comes.

I generate the firmware by CX MIPI tool. Pleaes refer to log messages below.

Thank you .

BJ.

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

AppInit:GpifSMStart passed
Sensor Initialization
Writing Configuration Settings:
Writing Configuration Settings:
bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x82, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x83, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x82, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x83, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x82, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x83, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x82, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x83, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22
bRType = 0x21, bRequest = 0x1, wValue = 0x200, wIndex = 0x1, wLength= 0x22
Writing Configuration Settings:
AplnStrt:SMState = 0x2
Sensor Wakeup
Writing Configuration Settings:
bRType = 0x2, bRequest = 0x1, wValue = 0x0, wIndex = 0x83, wLength= 0x0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 1 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 2 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 3 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 4 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 5 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 6 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 7 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 8 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 9 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 10 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 11 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 12 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 13 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 14 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 15 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 16 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 17 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 18 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 19 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 20 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 21 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 22 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 23 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 24 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 25 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 26 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 27 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 28 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 29 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 30 Frm_Sz = 2384640 B
TimeDiff = 999 ms FPS = 30
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 31 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 32 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 33 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 34 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 35 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 36 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 37 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 38 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 39 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
CyCx3UvcAppDmaCallback Error: status 0x47
CB failure
Sensor Sleep
Writing Configuration Settings:
AplnStop:SMState = 0x7
AplnStrt:SMState = 0x1
Sensor Wakeup
Writing Configuration Settings:
CyCx3UvcAppDmaCallback Error: status 0x47
CB failure
Sensor Sleep
Writing Configuration Settings:
AplnStop:SMState = 0x5
AplnStrt:SMState = 0x1
Sensor Wakeup
Writing Configuration Settings:
CyCx3UvcAppDmaCallback Error: status 0x47
CB failure
Sensor Sleep
Writing Configuration Settings:
AplnStop:SMState = 0x7
AplnStrt:SMState = 0x1
Sensor Wakeup
Writing Configuration Settings:
CyCx3UvcAppDmaCallback Error: status 0x47
CB failure
Sensor Sleep
Writing Configuration Settings:
AplnStop:SMState = 0x5
AplnStrt:SMState = 0x1
Sensor Wakeup
Writing Configuration Settings:
CyCx3UvcAppDmaCallback Error: status 0x47

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

Hello,

From the UART logs, around 39 video frames are sent from the device and then the commit buffer failures are seen which are not resolved with the workaround implemented in the firmware.

To confirm if no buffers are sent after the commit buffer failure is seen, please add the following print in the firmware and share the UART debug prints again

void
CyCx3UvcAppThread_Entry (
        uint32_t input)
{
    uint16_t wakeReason;
    uint32_t eventFlag;
    CyU3PReturnStatus_t status;
#ifdef PRINT_FRAME_INFO
    uint32_t fps;
    CyU3PMipicsiErrorCounts_t errCnts;
#endif

    /* Initialize the Debug Module */
    CyCx3UvcAppDebugInit();

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

    for (;;)
    {
        eventFlag = 0;
  // ****************** added debug print****************
           
        CyU3PDebugPrint(4,"\n\rProd = %d Cons = %d",TxCount,RxCount); 
   //  *************************************************
#ifdef PRINT_FRAME_INFO
		if (Printflag == 1)
		{
.....

 

Regards,

Rashi

Regards,
Rashi
0 Likes
BJ
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Hello. 

I added the line and captured debug print.

The last part of the print is as below.

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

Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 22 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 0 Cons = 0
Prod = 2 Cons = 2
Prod = 7 Cons = 6
Prod = 11 Cons = 10
Prod = 15 Cons = 15
Prod = 19 Cons = 19
Prod = 33 Cons = 33
Prod = 37 Cons = 37
Prod = 41 Cons = 40
Prod = 44 Cons = 44
Prod = 48 Cons = 48
Prod = 52 Cons = 52
Prod = 57 Cons = 56
Prod = 61 Cons = 60
Prod = 64 Cons = 64 Prtl_Sz = 28416 Frm_Cnt = 23 Frm_Sz = 2384640 B
0 0 0 0 0 0 0 0 0
Prod = 0 Cons = 0
Prod = 1 Cons = 0
Prod = 5 Cons = 5
Prod = 9 Cons = 9
Prod = 13 Cons = 13
Prod = 17 Cons = 17
Prod = 31 Cons = 31
Prod = 35 Cons = 35
Prod = 39 Cons = 39
Prod = 43 Cons = 42
Prod = 46 Cons = 46
Prod = 50 Cons = 50
Prod = 54 Cons = 54
Prod = 59 Cons = 58
Prod = 63 Cons = 58

CX3 stopped working there. 

 

Regards,

BJ.

 

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

Hello,

Apologies for the delay.

From the UART logs shared, I cannot see the CB failure prints. I wanted to check if the DMA buffers are consumed by the host after the CB Failure is seen. This is because in the previously share UART debug prints, I could see that once the CB failure is seen,  the CB failures are frequent and  not even 1 video frame is sent to the host after the CB failure is first seen. Can you please share the complete debug prints when CB Failure is seen and the DMA channel resets to start the transfers again.

With this w can know if the transfers have completely stopped from the host or is the issue due to the slow host (i.e. when the rate at which USB host consumes data is slower as compared to the rate at which the sensor writes the data to DMA buffer of CX3 which cause the CB Failure).

Please let me know if you can capture USB traces using USB hardware analyzer like Lecroy

Regards,
Rashi
0 Likes
lock attach
Attachments are accessible only for community members.
BJ
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Thanks for the reply.

When I put the line, CX3 stops before printing CB failure.  I guess too much printing would cause.  So I printed when RxCount is multiplied by 32 to reduce printing.

Sometimes the transfer resumes after CB failure occurs, sometimes not. Please refer to the debug print attached.  And sorry,  we don't have USB analyzer.

Regards,

BJ

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

Hello,

From the UART print it seems that the data is not received from the sensor as both prod and cons prints are 0. When the DMA buffer is filled with the data from the sensor, the producer event is triggered and consumer events (cons) will be triggered once the USB host consumes the data from the DMA buffer.

Can you please confirm if you are using the default firmware generated by the CX3 configuration tool as mentioned in this KBA  Steps to Setup up MIPI CSI Camera Solution with CX... - Cypress Developer Community  

To check if streaming from sensor is resumed after the CB failure, please try probing the test points mentioned in Q10 of this KBA  CX3 Hardware: Frequently Asked Questions - KBA9129... - Cypress Developer Community   and share the traces.

Regards,
Rashi
0 Likes
BJ
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Hi.

Yes. I'm using the firmware generated by the CX3 configuration tool.  I added lines for initializing sensor.

TPs Q10 mentioned are not available on  our board (probing points are not exposed), but when  checked the phone screen and debug print, streaming from the sensor resumes depending on the situation. I mean there is more chance to resume on better (later) phone.

As you said, the problem likely occurs becuase USB host can't comsume buffers which CX3 produces on  time. 

If I test normal USB camera (like web-cam), the frame rate varies depending on resolution. I mean when I set high resolution, the frame rate goes down but preview itself is still working without problem.  Isn't it possible for CX3 to work like this?  Or it is related to the sensor capability?

Regards,

BJ.

 

 

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,

Can you please let me know the video resolution, video frame rate and video format that is successfully streaming using the web cam.

Also, let me know the DMA buffer size (CX3_UVC_DATA_BUF_SIZE) used in your firmware and the h active and h total time (refer attachment).

Regards,
Rashi
0 Likes
lock attach
Attachments are accessible only for community members.
BJ
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

The web cam I tested is 8MP, YVU2 and JPG format are supported for video.
When I set to YUV2 format, the frame rate for 8MP is 1.0 fps. Please refer to the picture attached.

The DMA buffer size definition is as below.
#define CX3_UVC_DATA_BUF_SIZE (0x8FD0)

And I attach the picture which shows h_active and h_total.

Regards,
BJ.

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

Hello,

Please share the complete CX3 configuration tool setting  snippets. From the h_active_h_total.png, it seems there are some errors as H active time is more than the h total time, which is not expected.

Regards,
Rashi
0 Likes
lock attach
Attachments are accessible only for community members.
BJ
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

The strange time values are due to too big v lank value. Actually I'm not sure what the exact value is. As I found, time values itself doesn't affect to the sensor working. CyU3PMipicsiCfg should be composed correctly at the end.

I attach whole source of the project. This code works well with some phones and PC supporting USB3.0.

Thank you,

BJ.

BJ.

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,

From the firmware shared, I could see that the MIPI Receiver Configuration shared earlier is different than the one found with the firmware.

Please let me know which CX3 MIPI Receiver settings are used currently.

It is recommended to use the same settings under MIPI CSI2 Inputs (From image sensor) in CX3 MIPI Receiver tool  as MIPI transmitter (sensor). 

From the USRT logs we noticed that data from the sensor is not received once commit buffer failure is seen and then the streaming starts after some time. When commit buffer failure is seen, the firmware will restart the application i.e. it will put image sensor and CX3 MIPI Receiver to sleep and reset the DMA channel and then restarting streaming by calling CyCx3UvcAppStart.

Regards,
Rashi
0 Likes
BJ
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Do you have any update on this? I already replied with debug print.

0 Likes