cancel
Showing results for 
Search instead for 
Did you mean: 

USB Low-Full-High Speed Peripherals

steven
New Contributor II

hi:

The same resolution(2500*1025) works correct under supper-speed, but it does not work correct under high t-speed

Cx3 is in USB2.0 mode: if the acmap viewing software is not turned on, cx3 can normally parse Mipi information, Vsync and Hsync are able to parse normal waveforms, but as soon as I open amcap, log output

CB failure

AplnStop: SMState = 0x5

AplnStrt: SMState = 0x1

Both Vsync and Hsync of cx3 failed. Desrc and USB3.0 compare, some requests are consistent, in this case, how to debug, need to add DMA Buf? Are there any other configurations?

attch is Screensnot

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator

Hello,

The total bandwidth that can be practically supported by USB 2.0 (high speed/full speed) ~ 25 - 30 MBps

So 2500*1024*1*fps<= 25 - 30 MBps

Please refer to this thread (which is for FX3 UVC example) has similar problem (black screen)   https://community.cypress.com/message/204476?et=watches.email.thread#204476

Note: Please confirm that the data format you are streaming is compatible with the host application (AMCap in your case)

Regards,

Rashi

Regards,
Rashi

View solution in original post

0 Likes
27 Replies
KandlaguntaR_36
Moderator
Moderator

Hello,

USB 2.0 can support upto 30 ~ 35 MBps.

What are the fps and bytes per pixel you are trying to stream in USB 2.0 @ 2500*1025

Regards,

Sridhar

0 Likes
steven
New Contributor II

Hi KandlaguntaR:

2500*1025 @8fps  sensor output  Raw8 

 

 

 

this highspeedconfig  is correct?

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

The video bandwidth you working on exceeds the bandwidth supported by Usb high speed

2500*1025*8*2 = ~41 MBps

and USB high speed could support around 30-35 MBps

If you want to work for the same resolution you can either lower the fps or the bits/pixel which is 16 bits (2 bytes) in your case.

The changes in descriptors and the probe control structure( 1250*1025) are different from the resolution that you are working on(2500*1025). Please confirm.

On which resolution you want to work?

Also, let me know the buffer size you are using.

For 2500*1025 @ 5fps

    /* Class specific Uncompressed VS Frame Descriptor 1 - 1080p@30fps */

    0x1E,                               /* Descriptor size */

    CX3_CS_INTRFC_DESCR,                /* Descriptor type*/

    0x05,                               /* Subtype: Uncompressed frame interface*/

    0x01,                               /* Frame Descriptor Index: 1 */

    0x00,                               /* No Still image capture supported */

    0xC4, 0x09,                         /* Width in pixel:  2500 */

    0x01, 0x04,                         /* Height in pixel: 1025 */

    0x40, 0x0D, 0x38, 0x0C,             /* Min bit rate (bits/s): 1025 x 2500 x 2 x 5 x 8 = 205000000 */

    0x40, 0x0D, 0x38, 0x0C,             /* Max bit rate (bits/s): Fixed rate so same as Min */

    0x88, 0x33, 0x4E, 0x00,             /* Maximum video or still frame size in bytes(Deprecated): 2500 x 1025 x 2 */

    0x80, 0x84, 0x1E, 0x00,             /* Default frame interval (in 100ns units): (1/5)x10^7 */

    0x01,                               /* Frame interval type : No of discrete intervals */

    0x80, 0x84, 0x1E, 0x00,             /* Frame interval 3: Same as Default frame interval */

Probe Control

uint8_t const gl5MProbeCtrl_HS[CX3_UVC_MAX_PROBE_SETTING] = {

0x00, 0x00,                         /* bmHint : No fixed parameters */

0x01,                               /* Use 1st Video format index */

0x01,                               /* Use 1st Video frame index */

0x80,0x84,0x1E,0x00,              /* Desired frame interval in 100ns = (1/5)x10^7 */

0x00, 0x00,                         /* Key frame rate in key frame/video frame units */

0x00, 0x00,                         /* PFrame rate in PFrame / key frame units */

0x00, 0x00,                         /* Compression quality control */

0x00, 0x00,                         /* Window size for average bit rate */

0x00, 0x00,                         /* Internal video streaming i/f latency in ms */

0x88, 0x33, 0x4E, 0x00,             /* Max video frame size in bytes = 2500 x 1025 x 2 */

0x00, 0xC0, 0x00, 0x00              /* No. of bytes device can rx in single payload: 36KB 90 */ (If you are using buffer size of 36 KB)

Please confirm, the same settings are done on the sensor side also.

If this still doesn't work. Let me know the errors (debug prints) and probe the FV, LV , PCLK lines.

Regards,

Rashi

Regards,
Rashi
0 Likes
steven
New Contributor II

hi RashiV:

   I've changed the parameters above, and here's my log output。My GPIF bus is 16 bits,outputs RAW8 bits    .clk  frequency=96.15M

 

    

 

0 Likes
steven
New Contributor II

HI  RashiV_61

 

i h-blanking =3000 , then  Continuous output log

 

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Is your problem solved by increasing the horizontal blanking?

If not solved, What is the fps you are setting? Where do you get the cb failure? DMA call back or the GPIF call back?Also, probe the FV line and share the traces.

You can use 16 bit as output data format. config_util.png

The CX3 configuration utility gives the option You can also refer to the KBA.Streaming RAW10 Format Input Data to 16/24-bit Output Format in CX3 MIPI CSI-2 - KBA224387 which shows the packing of RAW10 data to 16/ 24 bit

Please refer this thread, which had a problem for commit buffer failure https://community.cypress.com/message/207887?et=watches.email.thread#207887    Re: Is "2592x1944x1 byte in High speed(USB 2.0)" possible with FX3?

Regards,

Rashi

Regards,
Rashi
0 Likes
steven
New Contributor II

hi:

i set  h-blanking =3000 , then  Continuous output log,but  amcap  is  blank screen

 

pastedImage_0.png

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

The debug prints you shared shows that the fps = 0. Please probe the FV, LV and PCLK and share the traces, to check whether these signals are coming proper.

What is the output format of the stream? YUY?

Regards,

Rashi

Regards,
Rashi
0 Likes
steven
New Contributor II

HI: RashiV

  Attachment is CX3 three test point waveform, log iscontinuous output, but FPS is 0  .the output format of the stream is YUY2

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Can you share the code snippet that is counting the FPS or Can you share the firmware? I do not the sensor files.

Are you using firmware in the sdk or a customize firmware?

From the traces, the FPS nearly 7fps (1/136ms). What is the fps you set to the sensor?

Regards,

Rashi

Regards,
Rashi
0 Likes
steven
New Contributor II
  • Hi Rashi,

Thanks for your reply.

My sensor used the following setting source ;  I'm Create projects wit

in usbsrc.

  /* Class specific Uncompressed VS format descriptor */

    0x1B,                               /* Descriptor size */

    CX3_CS_INTRFC_DESCR,                /* Class-specific VS interface Type */

    0x04,                               /* Subtype : VS_FORMAT */

    0x01,                               /* Format desciptor index */

    0x01,                               /* Number of Frame Descriptors that follow this descriptor: 3 */

   

    0x59, 0x55, 0x59, 0x32,             /*MEDIASUBTYPE_YUY2 GUID: 32595559-0000-0010-8000-00AA00389B71 */

    0x00, 0x00, 0x10, 0x00,

    0x80, 0x00, 0x00, 0xAA,

    0x00, 0x38, 0x9B, 0x71,

    0x10,                               /* Number of bits per pixel: 16*/

    0x01,                               /* Optimum Frame Index for this stream: 2 (720p) */

    0x00,                               /* X dimension of the picture aspect ratio; Non-inter

    0x00,                               /* No Still image capture supported */

    0xE2,0x04,                         /* Width in pixel:  2500 */

    0x01, 0x04,                         /* Height in pixel: 1025 */

   // 0x40, 0x0D, 0x38, 0x0C,             /* Min bit rate (bits/s): 1025 x 2500 x 2 x 5 x 8 = 205000000 */

    0xA0, 0x06, 0x1C, 0x06, /* Min bit rate (bits/s): 1025 x 1250 x 2 x 5 x 8 = 102,500,000‬ */

    0x40, 0x0D, 0x38, 0x0C,             /* Max bit rate (bits/s): Fixed rate so same as Min */

    0x88, 0x33, 0x4E, 0x00,             /* Maximum video or still frame size in bytes(Deprecated): 2500 x 1025 x 2 */

    0x80, 0x84, 0x1E, 0x00,             /* Default frame interval (in 100ns units): (1/5)x10^7 */

    0x01,                               /* Frame interval type : No of discrete intervals */

    0x80, 0x84, 0x1E, 0x00,             /* Frame interval 3: Same as Default frame interval */

 

 

   /* Still image descriptor -YUV with QVGA resolution */

0x0b, /*Size of this descriptor*/

0x24, /*CS_INTERFACE descriptor type*/

0x03, /*VS_STILL_IMAGE_FRAME descriptor subtype*/

0x00, /*If method 3 is used, endpoint address is mentioned here*/

0x01, //No of frame Resolutions Follows

 

/* UVC Probe Control Setting - 5M*/

uint8_t const gl5MProbeCtrl_HS[CX3_UVC_MAX_PROBE_SETTING] = {

    0x00, 0x00,                         /* bmHint : No fixed parameters */

    0x01,                               /* Use 1st Video format index */

    0x01,                               /* Use 1st Video frame index */

   // 0x80,0x96,0x98,0x00,             /* Desired frame interval in 100ns = (1/30)x10^7 */

    0x80,0x84,0x1E,0x00, /* Desired frame interval in 100ns = (1/5)x10^7 */

    0x00, 0x00,                         /* Key frame rate in key frame/video frame units */

    0x00, 0x00,                         /* PFrame rate in PFrame / key frame units */

    0x00, 0x00,                         /* Compression quality control */

    0x00, 0x00,                         /* Window size for average bit rate */

    0x00, 0x00,                         /* Internal video streaming i/f latency in ms */

    //0xc4,0x19,0x27,0x00,             /* Max video frame size in bytes = 2500 x 1025 x 1 */

    0x88, 0x33, 0x4E, 0x00, /* Max video frame size in bytes = 2500 x 1025 x 2 */

#ifdef CX3_UVC_1_0_SUPPORT

    0x00, 0x90, 0x00, 0x00              /* No. of bytes device can rx in single payload: 36KB */

#else

    /* UVC 1.1 Probe Control has additional fields from UVC 1.0 */

    //0x00, 0x90, 0x00, 0x00,             /* No. of bytes device can rx in single p

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Thank you for sharing. These settings seems fine.

Please share the firmware files (.c file,.h file, .cyfx)

Regards,

Rashi

Regards,
Rashi
0 Likes
steven
New Contributor II

Hi  Rashi:

     the  firmware files  in  attach.

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Please check the sensor settings. The data coming from the sensor (as per the trace you shared) seems to be 7 fps.

And the settings done tot the firmware is 5 fps. Please make the changes to the sensor so that when you can probe FV and LV lines you get 5 fps.

Calculation as per the trace you shared:

time for 1 frame  = 136 ms (V_Active + V_blanking)

If the fps is set to 5 (in Config utility as per your settings). Refer to the attachment

time for 1 frame = 395 ms (V_active + V_blanking)

Also, increase the fifo delay to get fifo delay time in the range.

Please let me know the results.You can share the traces here.

Regards,

Rashi

Regards,
Rashi
0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

The fps is coming zero because for calculation of fps -  30 fps is taken as reference. You need to modify the code accordingly(refer attachment).

Please confirm that there are no other error in the debug log?

If no other errors. Sorry, I had a misunderstanding, please try these settings. Don' t change the CX3 config utility or GPIF II settings

    0x1E,                              /* Descriptor size */

    CX3_CS_INTRFC_DESCR,                /* Descriptor type*/

    0x05,                              /* Subtype: Uncompressed frame interface*/

    0x01,                              /* Frame Descriptor Index: 1 */

    0x00,                              /* No Still image capture supported */

    0xC4, 0x09,                        /* Width in pixel:  2500 */

    0x01, 0x04,                        /* Height in pixel: 1025 */

    0x40, 0x0D, 0x38, 0x0C,            /* Min bit rate (bits/s): 1025 x 2500 x 2 x 5 x 8 = 205000000 */

   0xA0, 0x06, 0x1C, 0x06,            /* Min bit rate (bits/s): 1025 x 2500 x 5 x 8 = 102500000 */

    0xA0, 0x06, 0x1C, 0x06,,            /* Max bit rate (bits/s): Fixed rate so same as Min */

  0x88, 0x33, 0x4E, 0x00,            /* Maximum video or still frame size in bytes(Deprecated): 2500 x 1025 x 2 */

   0xC4, 0x19, 0x27, 0x00,            /* Maximum video or still frame size in bytes(Deprecated): 2500 x 1025 x 1

    0x80, 0x84, 0x1E, 0x00,            /* Default frame interval (in 100ns units): (1/5)x10^7 */

    0x01,                              /* Frame interval type : No of discrete intervals */

    0x80, 0x84, 0x1E, 0x00,            /* Frame interval 3: Same as Default frame interval */

Probe Control

uint8_t const gl5MProbeCtrl_HS[CX3_UVC_MAX_PROBE_SETTING] = {

0x00, 0x00,                        /* bmHint : No fixed parameters */

0x01,                              /* Use 1st Video format index */

0x01,                              /* Use 1st Video frame index */

0x80,0x84,0x1E,0x00,              /* Desired frame interval in 100ns = (1/5)x10^7 */

0x00, 0x00,                        /* Key frame rate in key frame/video frame units */

0x00, 0x00,                        /* PFrame rate in PFrame / key frame units */

0x00, 0x00,                        /* Compression quality control */

0x00, 0x00,                        /* Window size for average bit rate */

0x00, 0x00,                        /* Internal video streaming i/f latency in ms */

0xC4, 0x19, 0x27, 0x00,,            /* Max video frame size in bytes = 2500 x 1025 x 1 */

0x00, 0xC0, 0x00, 0x00              /* No. of bytes device can rx in single payload: 36KB 90 */ (If you are using buffer size of 36 KB)

Please let me know the results.

Regards,

Rashi

Regards,
Rashi
0 Likes
steven
New Contributor II

HI  Rashi:

Thank you very much for your reply. I have changed the gl5MProbeCtrl_HS and D VS Frame Descriptor in usbsrc into the same one according to the above reply. The attachment is that I reduce FPS by adding vblank and hblank to make it equal to 5fps, but amcap is still black screen.

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

Now, we need to check on the USB side whether proper no. of buffers are committed or not. We need to check the USB traces.

You can use the wireshark analyzer for capturing the traces.

Please share the .pcap file.

Regards,

Rashi

Regards,
Rashi
0 Likes
steven
New Contributor II

hi:Rashi

  this the pcap,Or is the data too big?

pastedImage_0.png

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

I am not able to view the file. And from the image in your previous post, it seems that the data from multiple usb devices are captured.

Can you share the pcap file again with CX3 device only and filtering out the rest devices.

Regards,

Rashi

Regards,
Rashi
0 Likes
steven
New Contributor II

hi Rashi:

this the wireshap Screenshots  attch is  file.

pastedImage_0.png

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

The number of bytes received by the host  for one frame is as follows:

Expected bytes without header (GPIF) : 2500*1025*1 =  2562500

No. of full buffer: 2562500/36828 = 69

Expected Bytes with Header (DMA): 2541132 + 22208 = 2563340

Bytes in Full buffer: 69* 36828 = 2541132

Bytes in Partial buffer: 1* 22208= 22208

Received Bytes: 2541132 + 19708 = 2560840

Bytes in Full Buffer: 69*36828 = 2541132

Bytes in Partial buffer: 1*19708 = 19708

Difference: 2563340 - 2560840 = 2500 (i.e. one line is missing)

From the traces of Vsync and Hsync, confirm that

V_Active(time) = 1025 *( H_Active(time) + H_blanking (time))

Also, add Phy delay time in the firmware from your CX3 configuration utility settings (refer attachment)

The code snippet shows where to add the PHY delay using API (change the value to hex)

status = CyU3PMipicsiSetIntfParams (&OV5647_RGB24_5MP, CyFalse);

if (status != CY_U3P_SUCCESS)

{

CyU3PDebugPrint (4, "\n\rUSBStpCB:SetIntfParams SS1 Err = 0x%x", status);

}

status = CyU3PMipicsiSetPhyTimeDelay(1,0x10);

Please let me know the V_Active time = 1025 *( H_Active(time) + H_blanking (time))??

From your previous post it seems (logs) after changing the fps settings the no. of bytes in partial buffer is not as expected

It seems RAW8  format is not supported by AMcap. Have you seen video on AMcap using this sensor before?

Regards,

Rashi

Regards,
Rashi
0 Likes
steven
New Contributor II

HI Rashi:

     I reconfigured SENSOR, which was 1024 rows, and now added one.  attach  is  Screenshots。But now it's still a black screen.

I calculated that v_active should be correct, v_active=1025*92us=94ms.

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

The PHY Delay value should be as per the seetings in your CX3 configuration utility. The attachment i provided was for reference. What is the PHY delay you are getting from  your settings?

From the log it can be seen that the bytes in partial buffer is 2500 (i.e one line more) more than expected. The expected value in partial buffer is (without header) is 22196. The V_Active time is 2 ms more (96 ms) than 1025*92us

It seems RAW8  format is not supported by AMcap. Have you used  AMcap using this sensor before?

Regards,

Rashi

Regards,
Rashi
0 Likes
steven
New Contributor II

HI Rashi:

   I want to ask how many FPS can be set at 2500*1024 in usb2.0. I want to reconfigure it and try it. The last configuration was black screen.

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

The total bandwidth that can be practically supported by USB 2.0 (high speed/full speed) ~ 25 - 30 MBps

So 2500*1024*1*fps<= 25 - 30 MBps

Please refer to this thread (which is for FX3 UVC example) has similar problem (black screen)   https://community.cypress.com/message/204476?et=watches.email.thread#204476

Note: Please confirm that the data format you are streaming is compatible with the host application (AMCap in your case)

Regards,

Rashi

Regards,
Rashi

View solution in original post

0 Likes
steven
New Contributor II

Hi Rashi:

   Thank you for your support. I reset all the configurations to one, which has solved the problem. It's my sensor resolution settings.

0 Likes
steven
New Contributor II

hi:RashiV

     Have you read the log? Have you made any progress? Can you analyze the reasons?

0 Likes