cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

Minwan
New Contributor

Hi,

I am interfacing an Omnivision image sensor (OV9734) with the CX3 bridge .

The image sensor and current cx3 receiver configuration are like below:

Minwan_0-1623250419603.png

Minwan_1-1623250520997.png

But I have two questions:

1.  Why do the following problems occur:

Minwan_2-1623250814114.png

2.I have read the KBA: Streaming RAW10 Format Input Data to 16/24-bit Output Format in CX3 MIPI CSI-2 - KBA224387,

then I realized that I should replace CY_U3P_CSI_DF_RAW10 with CY_U3P_CSI_DF_YUV422_8_2, but I have no ideal how to change  the UVC Descriptor and probe control structures of my firmware and how to calculate the parameter of re-writing . So can I use the code in the example OV5640? This is the code I copied from OV5640:

/* 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 */
0x04, /* Number of Frame Descriptors that follow this descriptor: 4 */

/* GUID, globally unique identifier used to identify streaming-encoding format*/
0X59,0X55,0X59,0X32,
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: 1 (5M) */
0x00, /* X dimension of the picture aspect ratio; Non-interlaced */
0x00, /* Y dimension of the pictuer aspect ratio: Non-interlaced */
0x00, /* Interlace Flags: Progressive scanning, no interlace */
0x00, /* duplication of the video stream restriction: 0 - no restriction */

/* Class specific Uncompressed VS Frame Descriptor 3 - 720p */
0x1E, /* Descriptor size */
CX3_CS_INTRFC_DESCR, /* Descriptor type*/
0x05, /* Subtype: frame interface*/
0x03, /* Frame Descriptor Index: 3 */
0x00, /* No Still image capture method supported */
0x00,0x05, /* Width in pixel: 1280 */
0xd0,0x02, /* Height in pixel: 720 */
0x00,0x00,0x5e,0x1a, /* Min bit rate (bits/s): 1280 x 720 x No Of Bits per Pixel x FrameRate = 442368000 */
0x00,0x00,0x5e,0x1a, /* Max bit rate (bits/s): Fixed rate so same as Min */
0x00,0x20,0x1c,0x00, /* Maximum video or still frame size in bytes(Deprecated): 1280 x 720 x 2 */
0x15,0x16,0x05,0x00, /* Default frame interval (in 100ns units): (1/30)x10^7 */
0x01, /* Frame interval type : No of discrete intervals */
0x15,0x16,0x05,0x00, /* Frame interval 3: Same as Default frame interval */

/* UVC Probe Control Setting - 720p*/
uint8_t const gl720pProbeCtrl[CX3_UVC_MAX_PROBE_SETTING] = {
0x00, 0x00, /* bmHint : No fixed parameters */
0x01, /* Use 1st Video format index */
0x03, /* Use 1st Video frame index */
0x15,0x16,0x05,0x00, /* Desired frame interval in 100ns = (1/30)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 */
0x00,0x20,0x1c,0x00, /* Max video frame size in bytes = 1920 x 1080 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 payload: 36KB */
0x00, 0x60, 0xE3, 0x16, /* Device Clock */
0x00, /* Framing Information - Ignored for uncompressed format*/
0x00, /* Preferred payload format version */
0x00, /* Minimum payload format version */
0x00 /* Maximum payload format version */
#endif
};

Regards

 

 

0 Likes
1 Solution
JayakrishnaT_76
Moderator
Moderator

Hello,

Please change the following parameters in the CX3 Receiver Configuration tab of MIPI Configuration Utility as mentioned below:

1. Output Parallel clock divider to 4

2. FIFO delay to 200

Please find my comments for your questions below:

1. You see an error as mentioned in your description because there is no resolution in your configuration that can be supported over USB 2.0. This error can be ignored. But the camera will support only USB 3.0.

2. As per my understanding, you would like to pack the incoming data into 16 bits. Please correct me if my understanding is wrong. For this, you cannot use the descriptors that comes along with the SDK example for interfacing OV5640 with CX3. You need to follow the KBA and modify the descriptors accordingly. Please find the calculations done below for your requirement:

a. 1280*720*10 = x*720*16

x = 800

This will be the width of frame field in the UVC frame descriptor. The height of frame can be kept as 720 itself

b. Frame size = (1280*720*10)/8 bytes = (800*720*16)/8bytes = 1152000 bytes = 0x119400

This value can be populated in the frame size field of the descriptors. The same value should be populated in the probe control structure (max frame size in bytes field of probe control structure)

c. Min and Max bit rates can be populated with the same value. This can be calculated as follows:

Bit rate = 800*720*16*30 = 276480000bps = 0x107AC000

Please let me know if you have any queries on the calculations done above.

Best Regards,
Jayakrishna

View solution in original post

0 Likes
14 Replies
JayakrishnaT_76
Moderator
Moderator

Hello,

Please change the following parameters in the CX3 Receiver Configuration tab of MIPI Configuration Utility as mentioned below:

1. Output Parallel clock divider to 4

2. FIFO delay to 200

Please find my comments for your questions below:

1. You see an error as mentioned in your description because there is no resolution in your configuration that can be supported over USB 2.0. This error can be ignored. But the camera will support only USB 3.0.

2. As per my understanding, you would like to pack the incoming data into 16 bits. Please correct me if my understanding is wrong. For this, you cannot use the descriptors that comes along with the SDK example for interfacing OV5640 with CX3. You need to follow the KBA and modify the descriptors accordingly. Please find the calculations done below for your requirement:

a. 1280*720*10 = x*720*16

x = 800

This will be the width of frame field in the UVC frame descriptor. The height of frame can be kept as 720 itself

b. Frame size = (1280*720*10)/8 bytes = (800*720*16)/8bytes = 1152000 bytes = 0x119400

This value can be populated in the frame size field of the descriptors. The same value should be populated in the probe control structure (max frame size in bytes field of probe control structure)

c. Min and Max bit rates can be populated with the same value. This can be calculated as follows:

Bit rate = 800*720*16*30 = 276480000bps = 0x107AC000

Please let me know if you have any queries on the calculations done above.

Best Regards,
Jayakrishna

View solution in original post

0 Likes
Minwan
New Contributor

Hi,

I changed the following parameters in the CX3 Receiver Configuration tab of MIPI Configuration Utility. But I still have the following questions:

(1) --You see an error as mentioned in your description because there is no resolution in your configuration that can be supported over USB 2.0. This error can be ignored. But the camera will support only USB 3.0.

    -- If I ignore this error, will it have any effect on the build?

(2) I copied some code from the KBA, here is the original code:

/* Class specific Uncompressed VS Frame Descriptor - 1080p@30fps */
0xB0, 0x04, /* Width in pixel: 1200 */
0x38, 0x04, /* Height in pixel: 1080 */
0x00, 0x30, 0x14, 0x25, /* Min bit rate (bits/s): 1080 x 1200 x 16 x 30 = 622080000*/
0x00, 0x30, 0x14, 0x25,/* Max bit rate (bits/s): Fixed rate so same as Min */
0x00, 0x8D, 0x27, 0x00, /* Maximum video or still frame size in bytes(Deprecated: 1200x1080 x2*/
/* UVC Probe Control Setting - 1080p@30FPS */
0x00, 0x8D, 0x27, 0x00, /* Max video frame size in bytes = 1200 x 1080 x 2 */

here is the modified code:

/* Class specific Uncompressed VS Frame Descriptor - 720p@30fps */
0x20, 0x04, /* Width in pixel: 800 */
0xD0, 0x02, /* Height in pixel: 720 */
0x00, 0xC0, 0x7A, 0x10, /* Min bit rate (bits/s): 800 x 720 x 16 x 30 = 276480000*/
0x00, 0xC0, 0x7A, 0x10,/* Max bit rate (bits/s): Fixed rate so same as Min */
0x00, 0x94, 0x11, 0x00, /* Maximum video or still frame size in bytes(Deprecated: 800x720 x2*/
/* UVC Probe Control Setting - 1080p@30FPS */
0x00, 0x94, 0x11, 0x00, /* Max video frame size in bytes = 800x720 x2* */

Could you please tell me is there a problem with my conversion of number systems and is this all the code I need to change? Dose /* GUID, globally unique identifier used to identify streaming-encoding format*/ or /* Number of Frame Descriptors that follow this descriptor: 4 */ or something else I should change?

(3)Why do the following mistakes occur? They all show as Symbol 'xxxxxx' could not be resolved.

Minwan_0-1623336869417.png

Minwan_1-1623337219152.png

 

Regards,

Minwan

0 Likes
JayakrishnaT_76
Moderator
Moderator

Hello Minwan,

Please find my comments below for your questions in order:

1. It will not cause any issues to the build.

2. Please do not copy anything from the KBA. You need to modify your descriptors (having resolution that you need) based on the suggestions given in the KBA. As mentioned in the KBA, you need to change fields in the frame descriptors and the probe control structure. Please let me know if you have more queries on this.

3. This could be an indexing issue. Please try right clicking on the project and select Index->Freshen all files. Please let me know if you have any issues even after trying this suggestion.

Best Regards,
Jayakrishna
0 Likes
Minwan
New Contributor

Hello Jayakrishna,

Thank you for your help to solve the previous problem.

What should I do next ? Should I modify the cycx3 uvc.c file ? How should I modify and debug it, is there anything I can refer to?

Best Regards,

Minwan

 

0 Likes
JayakrishnaT_76
Moderator
Moderator

Hello Minwan,

Please let me know if you have changed the descriptors as mentioned in the KBA. Normally, modifications are not needed on cycx3_uvc.c file. Please let me know if you are facing any issues after making the modifications. You can make use of UART debugging to debug for any issues. For this, you need to connect a USB-Serial converter on the UART lines of CX3 and an Application like tera term on the host side to view the debug prints.

Best Regards,
Jayakrishna
0 Likes
Minwan
New Contributor

Hello Jayakrishna,

I have changed the descriptors as mentioned in the KBA, and necessary I2C details has been entered in cyu3imagesensor.c file.

Minwan_0-1623931327390.png

Minwan_1-1623931364971.png

When programmed the CX3-RDK board enumerates as CX3 UVC device,  but I can't see any image data on the PC side.

Best Regards,

Minwan

 

0 Likes
JayakrishnaT_76
Moderator
Moderator

Hello,

Please share the UART debug logs and the Wireshark traces while the video streaming is started. This will give us some information to debug the issue.

Best Regards,
Jayakrishna
0 Likes
Minwan
New Contributor

Hello,

I try to use UART and  Wireshark but I ran into two problems:

1. Last time , the project build successfully and it enumerated as CX3-UVC. But today ,I  don't change anything in this project ,I find it dosn't enumerate anymore, I attached the project and the wireshark document at the end.

2. /* Uncomment the following line to provide verbose debug logging. */
/* #define CX3_DEBUG_ENABLED 1 */

I uncomment this line and configure the UART as Baud rate:115200,Date:8 bit,Parity:none, stop:1 bit. But Tera term  gave no results. Is this the result of enumeration failure or no necessary code was added in file?

Best Regards,

Minwan

 

0 Likes
JayakrishnaT_76
Moderator
Moderator

Hello Minwan,

I tested the project (using Denebola RDK) that was shared in your previous response and found that it was enumerating properly at my end. Please find the .img file attached along with this response. I made small modifications on top of your project to generate this image file. Please let me know if the device is enumerating properly with this image file.

Also, I found that there you have already created another thread for discussing the same topic. Please find the link to that thread below:

https://community.cypress.com/t5/USB-Superspeed-Peripherals/CX3-enumeration/td-p/278780

Please carry on the discussion related to the enumeration issues in the thread mentioned above.

And yes, the debug prints are missing because the device is not enumerated properly.

Best Regards,
Jayakrishna
0 Likes
Minwan
New Contributor

Hello Jayakrishna,

I used the .img file attached, and the device is not always enumerating properly with this image file,  the device enumerates properly only once a time. I use wireshark to look for the difference between it enumerates properly or not. And I found compared to the successful enumeration, failed enumeration missing the following INFO:

Minwan_0-1624371334409.png

And even if the enumeration succeeded, Tera Term gave no results. I try to use the solution  proposed by another thread, but it didn't work.

Best Regards,

Minwan

0 Likes
JayakrishnaT_76
Moderator
Moderator

Hello Minwan,

The debugprints are seen mostly after starting the UVC application. As mentioned before, the .img file that was shared in my previous response works fine at my end on 2 PCs. I used Denebola RDK for checking the enumeration. I did not have any issues with it. Please carry forward the discussion related to the enumeration issue in the other thread as this would help other customers also if they face a similar issue. The link to the thread is given below:
https://community.cypress.com/t5/USB-Superspeed-Peripherals/CX3-enumeration/td-p/278780

Best Regards,
Jayakrishna
0 Likes
Minwan
New Contributor

Hello Jayakrishna,

Thanks for your patience!

We think there might be some hardware issue can be there , we will confirm that and get back to you.

Best Regards,

Minwan

0 Likes
Minwan
New Contributor

Hello Jayakrishna,

Sorry to bother you again, we want to observe the waveform of I2C through the oscilloscope, but the transmission time is too short to catch waveform.  Is there any way to write the  register configuration value repeatedly so that we can observe the waveform of it ?

Best Regards,

Minwan

0 Likes
JayakrishnaT_76
Moderator
Moderator

Hello Minwan,

Usually the sensor configuration settings are written when the UVC host application is started. As part of handling the UVC requests, appropriate functions are called to initiate the I2C transfers for configuring the image sensor registers. The transfers will be stopped as soon as the configuration settings are written completely to the image sensor. 

If you want to write the same repeatedly, then you can try calling the same function (used for configuring the image sensor) repeatedly using a loop. I hope that this approach is used for debug purpose only.

Also, please create a new thread for discussing any new topic as that would help other community members too.

Best Regards,
Jayakrishna
0 Likes