How to add new resolutions to USB2.0 descriptors in CX3

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

cross mob
lock attach
Attachments are accessible only for community members.
VlKh_2251656
Level 5
Level 5
10 likes given 5 likes given First like received

Hello. Please correct me, if not in this thread. There is an two examples for a cypress CX3.

1) "How to implement UVC with CX3 ..."

2) Example for DENEBOLA CX3 board

There for USB30 in descriptors there are 4 resolutions: VGA, 1280x720, 1920x1080, 5MP

For high speed, only one resolution: VGA. I'm now trying to add one more resolutions (1280x720) to the USB20 descriptor.

But the camera is not even definable. Please see the code and tell me how to fix the descriptor.

#ifndef DESCRUSB2_H_ #define DESCRUSB2_H_  #include "CX3RDKOV5640.h" #include "cyu3mipicsi.h"  #include "uvc.h"  //     Standard High Speed Configuration Descriptor const uint8_t esUVCUSBHSConfigDscr[] = {     //     Configuration descriptor     0x09,                               //     Descriptor size     CY_U3P_USB_CONFIG_DESCR,            //     Configuration descriptor type     0xCD,0x00,                          //     Length of this descriptor and all sub descriptors     0x02,                               //     Number of interfaces     0x01,                               //     Configuration number     0x04,                               //     Configuration string index     0xC0,                               //     Config characteristics - self powered     0x32,                               //     Max power consumption of device (in 2mA unit) : 100mA      //     Interface Association Descriptor     0x08,                               //     Descriptor Size     ES_UVC_INTRFC_ASSN_DESCR,           //     Interface Association Descriptor Type     0x00,                               //     Interface number of the VideoControl interface that is associated with this function     0x02,                               //     Number of contiguous Video interfaces that are associated with this function     0x0E,                               //     Video Interface Class Code: CC_VIDEO     0x03,                               //     Subclass code: SC_VIDEO_INTERFACE_COLLECTION     0x00,                               //     Protocol: PC_PROTOCOL_UNDEFINED     0x00,                               //     String Descriptor index for interface      //     Standard Video Control Interface Descriptor (Interface 0, Alternate Setting 0)     0x09,                               //     Descriptor size     CY_U3P_USB_INTRFC_DESCR,            //     Interface Descriptor type     0x00,                               //     Index of this Interface     0x00,                               //     Alternate setting number     0x01,                               //     Number of end points - 1 Interrupt Endpoint     0x0E,                               //     Video Interface Class Code: CC_VIDEO     0x01,                               //     Interface sub class: SC_VIDEOCONTROL     0x00,                               //     Interface protocol code: PC_PROTOCOL_UNDEFINED.     0x00,                               //     Interface descriptor string index      //     Class specific VC Interface Header Descriptor     0x0D,                               //     Descriptor size     ES_UVC_CS_INTRFC_DESCR,             //     Class Specific Interface Descriptor type: CS_INTERFACE     0x01,                               //     Descriptor Sub type: VC_HEADER     0x00, 0x01,                         //     Revision of UVC class spec: 1.0 - Legacy version     0x50, 0x00,                         //     Total Size of class specific descriptors (till Output terminal)     0x00, 0x6C, 0xDC, 0x02,             //     Clock frequency : 48MHz(Deprecated)     0x01,                               //     Number of streaming interfaces     0x01,                               //     VideoStreaming interface 1 belongs to this VideoControl interface      //     Input (Camera) Terminal Descriptor     0x12,                               //     Descriptor size     ES_UVC_CS_INTRFC_DESCR,             //     CS_INTERFACE     0x02,                               //     VC_INPUT_TERMINAL subtype     0x01,                               //     ID of this input terminal     0x01, 0x02,                         //     ITT_CAMERA type. This terminal is a camera terminal representing the CCD sensor     0x00,                               //     No association terminal     0x00,                               //     Unused     0x00, 0x00,                         //     No optical zoom supported     0x00, 0x00,                         //     No optical zoom supported     0x00, 0x00,                         //     No optical zoom supported     0x03,                               //     Size of controls field for this terminal : 3 bytes     0x2A,0x00,0x02,                      //     No controls supported      //     Processing Unit Descriptor     0x0C,                               //     Descriptor size     ES_UVC_CS_INTRFC_DESCR,             //     Class specific interface desc type     0x05,                               //     Processing Unit Descriptor type: VC_PROCESSING_UNIT     0x02,                               //     ID of this unit     0x01,                               //     Source ID: 1: Connected to input terminal     0x00, 0x40,                         //     Digital multiplier     0x03,                               //     Size of controls field for this terminal: 3 bytes     0x5F,0x10,0x00,                      //     No controls supported     0x00,                               //     String desc index: Not used      //     Extension Unit Descriptor     0x1C,                               //     Descriptor size     ES_UVC_CS_INTRFC_DESCR,             //     Class specific interface desc type     0x06,                               //     Extension Unit Descriptor type     0x03,                               //     ID of this terminal     0xFF, 0xFF, 0xFF, 0xFF,             //     16 byte GUID     0xFF, 0xFF, 0xFF, 0xFF,     0xFF, 0xFF, 0xFF, 0xFF,     0xFF, 0xFF, 0xFF, 0xFF,     0x00,                               //     Number of controls in this terminal     0x01,                               //     Number of input pins in this terminal     0x02,                               //     Source ID : 2 : Connected to Proc Unit     0x03,                               //     Size of controls field for this terminal : 3 bytes     0x00, 0x00, 0x00,                   //     No controls supported     0x00,                               //     String descriptor index : Not used      //     Output Terminal Descriptor     0x09,                               //     Descriptor size     ES_UVC_CS_INTRFC_DESCR,             //     Class specific interface desc type     0x03,                               //     Output Terminal Descriptor type     0x04,                               //     ID of this terminal     0x01, 0x01,                         //     USB Streaming terminal type     0x00,                               //     No association terminal     0x03,                               //     Source ID : 3 : Connected to Extn Unit     0x00,                               //     String desc index : Not used      //     Video Control Status Interrupt Endpoint Descriptor     0x07,                               //     Descriptor size     CY_U3P_USB_ENDPNT_DESCR,            //     Endpoint Descriptor Type     ES_UVC_EP_CONTROL_STATUS,           //     Endpoint address and description: EP-2 IN     CY_U3P_USB_EP_INTR,                 //     Interrupt End point Type     0x40, 0x00,                         //     Max packet size: 64 bytes     0x01,                               //     Servicing interval      //     Class Specific Interrupt Endpoint Descriptor     0x05,                               //     Descriptor size     0x25,                               //     Class specific endpoint descriptor type     CY_U3P_USB_EP_INTR,                 //     End point sub type     0x40, 0x00,                          //     Max packet size = 64 bytes      //     Standard Video Streaming Interface Descriptor (Interface 1, Alternate Setting 0)     0x09,                               //     Descriptor size     CY_U3P_USB_INTRFC_DESCR,            //     Interface descriptor type     0x01,                               //     Interface number: 1     0x00,                               //     Alternate setting number: 0     0x01,                               //     Number of end points: 1 Bulk endpoint     0x0E,                               //     Interface class : CC_VIDEO     0x02,                               //     Interface sub class : SC_VIDEOSTREAMING     0x00,                               //     Interface protocol code : PC_PROTOCOL_UNDEFINED     0x00,                               //     Interface descriptor string index      //     Class-specific Video Streaming Input Header Descriptor     0x0E,                               //     Descriptor size     ES_UVC_CS_INTRFC_DESCR,             //     Class-specific VS interface type     0x01,                               //     Descriptor subtype : Input Header     0x01,                               //     1 format descriptor follows     0x47, 0x00,                         //     Total size of class specific VS descr     ES_UVC_EP_BULK_VIDEO,               //     EP address for BULK video data: EP 3 IN     0x00,                               //     No dynamic format change supported     0x04,                               //     Output terminal ID : 4     0x00,                               //     No Still image capture method supported     0x00,                               //     Hardware trigger not supported     0x00,                               //     Hardware to initiate still image capture not supported     0x01,                               //     Size of controls field : 1 byte     0x00,                               //     D2 : Compression quality supported - No compression      //     Class specific VS format descriptor     0x1B,                               //     Descriptor size     ES_UVC_CS_INTRFC_DESCR,             //     Class-specific VS interface Type     0x04,                               //     Subtype : VS_FORMAT_UNCOMPRESSED     0x01,                               //     Format desciptor index      0x02,                               //     Number of Frame Descriptors that follow this descriptor: 2      //     GUID, globally unique identifier used to identify streaming-encoding format: YUY2     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: 1 (640x480)     0x00,                               //     X dimension of the picture aspect ratio; Non-interlaced     0x00,                               //     Y dimension of the picture 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 1 - 640x480 @30fps     0x1E,                               //     Descriptor size     ES_UVC_CS_INTRFC_DESCR,             //     Descriptor type     0x05,                               //     Subtype: Uncompressed frame interface     0x01,                               //     Frame Descriptor Index: 1     0x00,                               //     No Still image capture method supported     0x80, 0x02,                         //     Width in pixel:  640     0xE0, 0x01,                         //     Height in pixel: 480     0x00, 0x00, 0xCA, 0x08,             //     Min bit rate (bits/s): 640 x 480 x 2 x 60 x 8 = 294912000     0x00, 0x00, 0x94, 0x11,             //     Max bit rate (bits/s): Fixed rate so same as Min     0x00, 0x60, 0x09, 0x00,             //     Maximum video or still frame size in bytes(Deprecated): 640 x 480 x 2     0x15, 0x16, 0x05, 0x00,             //     Default frame interval (in 100ns units): (1/60)x10^7     0x01,                               //     Frame interval type : No of discrete intervals     0x15, 0x16, 0x05, 0x00,             //     Frame interval 3: Same as Default frame interval      //     Class specific Uncompressed VS frame descriptor 2 - 720p@ 10fps     0x1E,                               //     Descriptor size     ES_UVC_CS_INTRFC_DESCR,             //     Descriptor type     0x05,                               //     Subtype: Uncompressed frame interface     0x02,                               //     Frame Descriptor Index: 2     0x00,                               //     No Still image capture method supported     0x00, 0x05,                         //     Width in pixel: 720     0xD0, 0x02,                         //     Height in pixel: 1280     0x00, 0x00, 0x65, 0x04,             //     Min bit rate @5fps (bits/s): 720 x 1280 x 2 x 5 x 8 = 811008000     0x00, 0x00, 0xBC, 0x34,             //     Max bit rate @60fps (bits/s). 720 x 1280 x 2 x 60 x 8 884736000     0x00, 0x20, 0x1C, 0x00,             //     Maximum video frame size in bytes(Deprecated): 1280 x 720 x 2     0x0A, 0x8B, 0x12, 0x00,             //     Default frame interval (in 100ns units): (1/60)x10^7     0x01,                               //     Frame interval type : No of discrete intervals     0x0A, 0x8B, 0x02, 0x00,             //     Frame interval 3: Same as Default frame interval      //     Endpoint descriptor for Bulk streaming video data     0x07,                               //     Descriptor size     CY_U3P_USB_ENDPNT_DESCR,            //     Endpoint Descriptor Type     ES_UVC_EP_BULK_VIDEO,               //     Endpoint address and description: EP 3 IN     CY_U3P_USB_EP_BULK,                 //     BULK End point     0x00,                               //     Packet Size: 512 bytes     0x02,     0x00                                //     Servicing interval for data transfers };    #endif //     DESCRUSB2_H_





#ifndef DESCRUSB2_H_#define DESCRUSB2_H_

#include "CX3RDKOV5640.h"#include "cyu3mipicsi.h"
#include "uvc.h"



// Standard High Speed Configuration Descriptorconst uint8_t esUVCUSBHSConfigDscr[] ={    // Configuration descriptor    0x09,                               // Descriptor size    CY_U3P_USB_CONFIG_DESCR,            // Configuration descriptor type    0xCD,0x00,                          // Length of this descriptor and all sub descriptors    0x02,                               // Number of interfaces    0x01,                               // Configuration number    0x04,                               // Configuration string index    0xC0,                               // Config characteristics - self powered    0x32,                               // Max power consumption of device (in 2mA unit) : 100mA
    // Interface Association Descriptor    0x08,                               // Descriptor Size    ES_UVC_INTRFC_ASSN_DESCR,           // Interface Association Descriptor Type    0x00,                               // Interface number of the VideoControl interface that is associated with this function    0x02,                               // Number of contiguous Video interfaces that are associated with this function    0x0E,                               // Video Interface Class Code: CC_VIDEO    0x03,                               // Subclass code: SC_VIDEO_INTERFACE_COLLECTION    0x00,                               // Protocol: PC_PROTOCOL_UNDEFINED    0x00,                               // String Descriptor index for interface
    // Standard Video Control Interface Descriptor (Interface 0, Alternate Setting 0)    0x09,                               // Descriptor size    CY_U3P_USB_INTRFC_DESCR,            // Interface Descriptor type    0x00,                               // Index of this Interface    0x00,                               // Alternate setting number    0x01,                               // Number of end points - 1 Interrupt Endpoint    0x0E,                               // Video Interface Class Code: CC_VIDEO    0x01,                               // Interface sub class: SC_VIDEOCONTROL    0x00,                               // Interface protocol code: PC_PROTOCOL_UNDEFINED.    0x00,                               // Interface descriptor string index
    // Class specific VC Interface Header Descriptor    0x0D,                               // Descriptor size    ES_UVC_CS_INTRFC_DESCR,             // Class Specific Interface Descriptor type: CS_INTERFACE    0x01,                               // Descriptor Sub type: VC_HEADER    0x00, 0x01,                         // Revision of UVC class spec: 1.0 - Legacy version    0x50, 0x00,                         // Total Size of class specific descriptors (till Output terminal)    0x00, 0x6C, 0xDC, 0x02,             // Clock frequency : 48MHz(Deprecated)    0x01,                               // Number of streaming interfaces    0x01,                               // VideoStreaming interface 1 belongs to this VideoControl interface
    // Input (Camera) Terminal Descriptor    0x12,                               // Descriptor size    ES_UVC_CS_INTRFC_DESCR,             // CS_INTERFACE    0x02,                               // VC_INPUT_TERMINAL subtype    0x01,                               // ID of this input terminal    0x01, 0x02,                         // ITT_CAMERA type. This terminal is a camera terminal representing the CCD sensor    0x00,                               // No association terminal    0x00,                               // Unused    0x00, 0x00,                         // No optical zoom supported    0x00, 0x00,                         // No optical zoom supported    0x00, 0x00,                         // No optical zoom supported    0x03,                               // Size of controls field for this terminal : 3 bytes    0x2A,0x00,0x02,                 // No controls supported
    // Processing Unit Descriptor    0x0C,                               // Descriptor size    ES_UVC_CS_INTRFC_DESCR,             // Class specific interface desc type    0x05,                               // Processing Unit Descriptor type: VC_PROCESSING_UNIT    0x02,                               // ID of this unit    0x01,                               // Source ID: 1: Connected to input terminal    0x00, 0x40,                         // Digital multiplier    0x03,                               // Size of controls field for this terminal: 3 bytes    0x5F,0x10,0x00,                 // No controls supported    0x00,                               // String desc index: Not used
    // Extension Unit Descriptor    0x1C,                               // Descriptor size    ES_UVC_CS_INTRFC_DESCR,             // Class specific interface desc type    0x06,                               // Extension Unit Descriptor type    0x03,                               // ID of this terminal    0xFF, 0xFF, 0xFF, 0xFF,             // 16 byte GUID    0xFF, 0xFF, 0xFF, 0xFF,    0xFF, 0xFF, 0xFF, 0xFF,    0xFF, 0xFF, 0xFF, 0xFF,    0x00,                               // Number of controls in this terminal    0x01,                               // Number of input pins in this terminal    0x02,                               // Source ID : 2 : Connected to Proc Unit    0x03,                               // Size of controls field for this terminal : 3 bytes    0x00, 0x00, 0x00,                   // No controls supported    0x00,                               // String descriptor index : Not used
    // Output Terminal Descriptor    0x09,                               // Descriptor size    ES_UVC_CS_INTRFC_DESCR,             // Class specific interface desc type    0x03,                               // Output Terminal Descriptor type    0x04,                               // ID of this terminal    0x01, 0x01,                         // USB Streaming terminal type    0x00,                               // No association terminal    0x03,                               // Source ID : 3 : Connected to Extn Unit    0x00,                               // String desc index : Not used
    // Video Control Status Interrupt Endpoint Descriptor    0x07,                               // Descriptor size    CY_U3P_USB_ENDPNT_DESCR,            // Endpoint Descriptor Type    ES_UVC_EP_CONTROL_STATUS,           // Endpoint address and description: EP-2 IN    CY_U3P_USB_EP_INTR,                 // Interrupt End point Type    0x40, 0x00,                         // Max packet size: 64 bytes    0x01,                               // Servicing interval
    // Class Specific Interrupt Endpoint Descriptor    0x05,                               // Descriptor size    0x25,                               // Class specific endpoint descriptor type    CY_U3P_USB_EP_INTR,                 // End point sub type    0x40, 0x00,                          // Max packet size = 64 bytes
    // Standard Video Streaming Interface Descriptor (Interface 1, Alternate Setting 0)    0x09,                               // Descriptor size    CY_U3P_USB_INTRFC_DESCR,            // Interface descriptor type    0x01,                               // Interface number: 1    0x00,                               // Alternate setting number: 0    0x01,                               // Number of end points: 1 Bulk endpoint    0x0E,                               // Interface class : CC_VIDEO    0x02,                               // Interface sub class : SC_VIDEOSTREAMING    0x00,                               // Interface protocol code : PC_PROTOCOL_UNDEFINED    0x00,                               // Interface descriptor string index
    // Class-specific Video Streaming Input Header Descriptor    0x0E,                               // Descriptor size    ES_UVC_CS_INTRFC_DESCR,             // Class-specific VS interface type    0x01,                               // Descriptor subtype : Input Header    0x01,                               // 1 format descriptor follows    0x47, 0x00,                         // Total size of class specific VS descr    ES_UVC_EP_BULK_VIDEO,               // EP address for BULK video data: EP 3 IN    0x00,                               // No dynamic format change supported    0x04,                               // Output terminal ID : 4    0x00,                               // No Still image capture method supported    0x00,                               // Hardware trigger not supported    0x00,                               // Hardware to initiate still image capture not supported    0x01,                               // Size of controls field : 1 byte    0x00,                               // D2 : Compression quality supported - No compression
    // Class specific VS format descriptor    0x1B,                               // Descriptor size    ES_UVC_CS_INTRFC_DESCR,             // Class-specific VS interface Type    0x04,                               // Subtype : VS_FORMAT_UNCOMPRESSED    0x01,                               // Format desciptor index
    0x02,                               // Number of Frame Descriptors that follow this descriptor: 2
    // GUID, globally unique identifier used to identify streaming-encoding format: YUY2    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: 1 (640x480)    0x00,                               // X dimension of the picture aspect ratio; Non-interlaced    0x00,                               // Y dimension of the picture 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 1 - 640x480 @30fps    0x1E,                               // Descriptor size    ES_UVC_CS_INTRFC_DESCR,             // Descriptor type    0x05,                               // Subtype: Uncompressed frame interface    0x01,                               // Frame Descriptor Index: 1    0x00,                               // No Still image capture method supported    0x80, 0x02,                         // Width in pixel:  640    0xE0, 0x01,                         // Height in pixel: 480    0x00, 0x00, 0xCA, 0x08,             // Min bit rate (bits/s): 640 x 480 x 2 x 60 x 8 = 294912000    0x00, 0x00, 0x94, 0x11,             // Max bit rate (bits/s): Fixed rate so same as Min    0x00, 0x60, 0x09, 0x00,             // Maximum video or still frame size in bytes(Deprecated): 640 x 480 x 2    0x15, 0x16, 0x05, 0x00,             // Default frame interval (in 100ns units): (1/60)x10^7    0x01,                               // Frame interval type : No of discrete intervals    0x15, 0x16, 0x05, 0x00,             // Frame interval 3: Same as Default frame interval

    // Class specific Uncompressed VS frame descriptor 2 - 720p@ 10fps    0x1E,                               // Descriptor size    ES_UVC_CS_INTRFC_DESCR,             // Descriptor type    0x05,                               // Subtype: Uncompressed frame interface    0x02,                               // Frame Descriptor Index: 2    0x00,                               // No Still image capture method supported    0x00, 0x05,                         // Width in pixel: 720    0xD0, 0x02,                         // Height in pixel: 1280    0x00, 0x00, 0x65, 0x04,             // Min bit rate @5fps (bits/s): 720 x 1280 x 2 x 5 x 8 = 811008000    0x00, 0x00, 0xBC, 0x34,             // Max bit rate @60fps (bits/s). 720 x 1280 x 2 x 60 x 8 884736000    0x00, 0x20, 0x1C, 0x00,             // Maximum video frame size in bytes(Deprecated): 1280 x 720 x 2    0x0A, 0x8B, 0x12, 0x00,             // Default frame interval (in 100ns units): (1/60)x10^7    0x01,                               // Frame interval type : No of discrete intervals    0x0A, 0x8B, 0x02, 0x00,             // Frame interval 3: Same as Default frame interval

    // Endpoint descriptor for Bulk streaming video data    0x07,                               // Descriptor size    CY_U3P_USB_ENDPNT_DESCR,            // Endpoint Descriptor Type    ES_UVC_EP_BULK_VIDEO,               // Endpoint address and description: EP 3 IN    CY_U3P_USB_EP_BULK,                 // BULK End point    0x00,                               // Packet Size: 512 bytes    0x02,    0x00                                // Servicing interval for data transfers};




#endif // DESCRUSB2_H_

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi,

Apart from adding "Number of Frame Descriptors that follow this descriptor" as 2, you need to add the additional descriptor size (Which is 0x1E of the 1280x720 resolution) to the "Total size of class specific VS descr" and "Length of this descriptor and all sub descriptors".

I have updated this in the attached code and tested the enumeration on FX3 Super speed explorer kit. Device enumerates properly.

Regards,

Savan

View solution in original post

0 Likes
20 Replies
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi,

Apart from adding "Number of Frame Descriptors that follow this descriptor" as 2, you need to add the additional descriptor size (Which is 0x1E of the 1280x720 resolution) to the "Total size of class specific VS descr" and "Length of this descriptor and all sub descriptors".

I have updated this in the attached code and tested the enumeration on FX3 Super speed explorer kit. Device enumerates properly.

Regards,

Savan

0 Likes

Dear Savj

Thank you very much!

if you will allow, one more question.

How to write descriptors for any MJPEG formats (the same resilutions, but in the MJPEG format)?

and they should go separately or can be added to the main descriptor?

In a word, please write in more detail. And then I'm completely new to this field of knowledge.

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

Hello vladimirostu_2251656 does the above change really get the data of 1280* 720.

This is my modification of the ov5640 project.Get 1280*720 data through usb2.0.But you can't.

Dear xwu_2656166

Thank you very much.

But I have a black screen when I use this code for USB2.0

0 Likes
Anonymous
Not applicable

What have you done?

How much data format usb2.0 can take,

I also have the same problem here (the black screen has no data),

I was in a hurry yesterday, I didn't write it specifically, but I made the change,

/*-----------------------------------------------------------------------*/

//  NO.1 CX3RDKOV5640Dscr.c   ÐÞ¸ÄÈçÏÂ

// 720p 60fps   -> 720p10fps

/*-----------------------------------------------------------------------*/

#if 0

/* Configuration parameters for 720p @60FPS for the OV5640 sensor */

CyU3PMipicsiCfg_t cfgUvc720p60NoMclk =  {

  CY_U3P_CSI_DF_YUV422_8_2,     /* dataFormat   */

  2,                           /* numDataLanes */

  1,                         /* pllPrd       */

  62,                         /* pllFbd       */

  CY_U3P_CSI_PLL_FRS_250_500M, /* pllFrs      */

  CY_U3P_CSI_PLL_CLK_DIV_4,   /* csiRxClkDiv  */

  CY_U3P_CSI_PLL_CLK_DIV_4,   /* parClkDiv    */

  0x00,                       /* mclkCtl      */

  CY_U3P_CSI_PLL_CLK_DIV_8,   /* mClkRefDiv   */

  1280,                       /* hResolution  */

  0x01                       /* fifoDelay    */

};

#endif

/* Configuration parameters for 720p @10FPS for the OV5640 sensor */

CyU3PMipicsiCfg_t cfgUvc720p60NoMclk =  {

  CY_U3P_CSI_DF_YUV422_8_2,     /* dataFormat   */

  2,                           /* numDataLanes */

  1,                         /* pllPrd       */

  62,                         /* pllFbd       */

  CY_U3P_CSI_PLL_FRS_500_1000M, /* pllFrs      */

  CY_U3P_CSI_PLL_CLK_DIV_8,   /* csiRxClkDiv  */

  CY_U3P_CSI_PLL_CLK_DIV_8,   /* parClkDiv    */

  0x00,                       /* mclkCtl      */

  CY_U3P_CSI_PLL_CLK_DIV_2,   /* mClkRefDiv   */

  1280,                       /* hResolution  */

  50                       /* fifoDelay    */

};

/*-----------------------------------------------------------------------*/

//  NO.2 CX3RDKOV5640Dscr.c

// 640x480@60fps   -> 720p@10fps

/*----------------------------------------------------------------------*/

#if 0

    /* Class specific Uncompressed VS frame descriptor 1 - 640x480@60fps*/

    0x1E,                               /* Descriptor size */

    ES_UVC_CS_INTRFC_DESCR,             /* Descriptor type*/

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

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

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

    0x80, 0x02,                         /* Width in pixel:  640 */

    0xE0, 0x01,                         /* Height in pixel: 480 */

    0x00, 0x00, 0x94, 0x11,             /* Min bit rate (bits/s): 640 x 480 x 2 x 60 x 8 = 294912000 */

    0x00, 0x00, 0x94, 0x11,             /* Max bit rate (bits/s): Fixed rate so same as Min  */

    0x00, 0x60, 0x09, 0x00,             /* Maximum video or still frame size in bytes(Deprecated): 640 x 480 x 2*/

    0x15, 0x16, 0x05, 0x00,             /* Default frame interval (in 100ns units): (1/60)x10^7 */

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

    0x15, 0x16, 0x05, 0x00,             /* Frame interval 3: Same as Default frame interval */

#endif

#if 1

   /* Class specific Uncompressed VS frame descriptor 1 - 720p@10fps*/

   0x1E,                               /* Descriptor size */

   ES_UVC_CS_INTRFC_DESCR,             /* Descriptor type*/

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

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

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

   0x00, 0x05,                         /* Width in pixel:  1280 */

   0xD0, 0x02,                         /* Height in pixel: 720 */

   0x00, 0x00, 0x65, 0x04,             /* Min bit rate (bits/s):720*1280*2*5*8 = */

   0x00, 0x00, 0xbc, 0x34,             /* Max bit rate (bits/s):720*1280*2*60*8  */

   0x00, 0x20, 0x1c, 0x00,             /* Maximum video or still frame size in bytes(Deprecated):1280* 720 x 2*/

   0x0A, 0x8B, 0x12, 0x00,             /* Default frame interval (in 100ns units): (1/60)x10^7 */

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

   0x0A, 0x8B, 0x02, 0x00,             /* Frame interval 3: Same as Default frame interval */

#endif

/*-----------------------------------------------------------------------*/

//  NO.3 CX3RDKOV5640.c

// VGA    ->      720P

/*-----------------------------------------------------------------------*/

#if 0

  /* Write VGA Settings */

  status = CyU3PMipicsiSetIntfParams (&cfgUvcVga30NoMclk, CyFalse);

  if (status != CY_U3P_SUCCESS)

  {

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

  }

  esOV5640_VGA_config();

  esOV5640_VGA_HS_config();

#endif

  /* Write 720pSettings */

  status = CyU3PMipicsiSetIntfParams (&cfgUvc720p60NoMclk, CyFalse);

  if (status != CY_U3P_SUCCESS)

  {

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

  }

  esOV5640_720P_config();

0 Likes

Dear xwu_2656166

I think we need to make the correct adjustment of the sensor OV5640

That is, for USB2 and USB3 there will be a different number of output frames per second.

0 Likes

That is, replace function:

esOV5640_720P_config();

with this

esOV5640_720P_config() for USB2,

i.e. esOV5640_720P_HS_config();

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

hello ,I mainly changed the frame rate of the ov5640 at 720p yesterday,

referenced document:

  OV5640 Auto Focus Camera ModuleApplication Notes (with MIPI Interface)  R2.12

On page 17 :

4.1.3 YCbCr 720p Video @ 30fps

write_i2c(0x3108, 0x02); // system divider  The divider here is 60fps PLL 1/2 =30fps

write_i2c(0x3035, 0x11); // pll

write_i2c(0x3036, 0x54); // pll

.. ... .. ... .

... . ... .

On page 26 :

4.2.3 YCbCr 720p @ 60fps

write_i2c(0x3035, 0x11); // pll

write_i2c(0x3036, 0x54); // pll

I presume...

YCbCr 720p @ 15fps clock1/4

write_i2c(0x3108, 0x04); // system divider

write_i2c(0x3035, 0x82); // PLL

write_i2c(0x3036, 0x69); // PLL

YCbCr 720p @ 7.5fps clock1/8

write_i2c(0x3108, 0x08); // system divider

write_i2c(0x3035, 0x82); // PLL

write_i2c(0x3036, 0x69); // PLL

Such an ov5640 output signal is 720P @7.5 FPS。

This is closer to usb2.0 speed。

But I have tested it, and I still have no data output。

I don't know if I missed some configuration。

In addition to lowering the frame rate

Looking forward to your reply。

Hello

I think we need to add the following values in the descriptor file:

maximum and minimum frame rates (FPS) and bitrates.

now I'll take a look

0 Likes
Anonymous
Not applicable

Dear vladimirostu_2251656

Now I have the same problem, I want to get (1280X720) from usb2.0, I have follow the code above,and I change the frame rate to 10FPS, but I always get the black screen. Have you solved this problem or there some advise from this problem

0 Likes
Anonymous
Not applicable

Hello vladimirostu

Whether to continue testing the 720p format of usb2.0,

I have new progress and problems.

I lowered the frame rate of 720p to 7.5 FPS。

Add the test point MIPI_DAT_1+ and MIPI_DAT_0- here to check the mipi data frequency,

After lowering the frame, the data frequency of mipi-data can be measured in half.

There was data in the dma channel, and I measured it,

I changed the image mode to test image mode, and got regular data(test image data)in dma, but blocked.

That is, the data is normal from the coms-> mipi-csi->gpif ->dma.

But there is a problem with the PC client and CX3 interaction  

 

regular work                    esUVCUvcApplnUSBEventCb() evtype= CY_U3P_USB_EVENT_SUSPEND
My callback returned,esUVCUvcApplnUSBEventCb() evtype= CY_U3_USB_EVENT_EP0_STAT_CPLT

Therefore, the black screen is normal, and the usb ep node is not working properly。

The problem is located in the usb ep0 node problem ,

Do you have an in-depth understanding of

[(usb host controlle) - video control-(usb ep0)]

and have no debug methods and opinions.

Looking forward to your reply

0 Likes

Hello dear colleagues

I had a long weekend

now I'm again adjusting the sensor OV5640

no results so far

I think, it is necessary to change also the parameter - the start line of the frame

0 Likes

I will write later in more detail

0 Likes
Anonymous
Not applicable

Hello All,

I would like to give few steps to debug the blank screen issue:

1. Setup image sensor to stream 720p@10fps or any frame rate.

2. Open the application and probe FV (Frame valid) and LV signals (Line valid) on an oscilloscope.

     a. You should observe FV time period of 100ms, LV period as (100/720ms) if you stream video at 10fps.

     b. Measure No of pixels in a line and no. of lines by pixel clock.

3. If you see continuous output in 2. a., you might want to check the FX3 firmware.

4. FX3 descriptor, probe control structure issues:

     a. Probe control structure, glProbeCtrl(/20). Fields to check: Max video frame size in bytes, Use 1st Video frame index, and Desired frame interval in the unit of 100ns: 15 fps.

     b. Descriptor field "Class specific Uncompressed VS Frame descriptor": Width in pixel, Height in Pixel, Maximum video or still frame size in bytes, Default frame interval, Frame Descriptor Index.

5. Enable DEBUG_PRINT_FRAME_COUNT macro from uvc.h file to see how much data is being received by FX3 and sent to Host.

6. Use DMA call back function to determine the amount of data received and determine if there is a short buffer at end of frame or not.

See if it helps.

Regards,

Savan

0 Likes

Dear colleagues

Directly to change mode 1280 * 720 from a mode 640 * 480 it will not be possible.

The reason is very simple.

In the 640 * 480 mode, binning (probably double) is most likely used,

so that in this mode almost the whole area of the video sensor is captured (640 * 4 = 2560, it is almost equal to 2592, 480 * 4 = 1920, it is almost equal to 1944).

That is, for the mode 1280 * 720 it is necessary to reduce the coefficient of binning - instead of 4 to make 2.

0 Likes
Anonymous
Not applicable

Hello, has the problem been solved? I see that the problem has been solved.

You said:

            “ That is, for the mode 1280 * 720 it is necessary to reduce the coefficient of binning - instead of 4 to make 2  ”

          I don't quite understand where to change.

     Can you elaborate on that? Thank you very much.

0 Likes
Anonymous
Not applicable

Hi ,savj

I wrote a my_vga_usb2.0() configuration, replacing esOV5640_Base_Config();Add esOV5640_VGA_HS_config (),

The VGA data flow can be displayed normally on the PC side.

Only my_vga_usb2.0(), no esOV5640_VGA_HS_config() 640*480 video stream will not be displayed properly,

esOV5640_VGA_HS_config ();This function is very important.

I would like to ask you to elaborate on the specific implementation of esOV5640_VGA_HS_config(),

and how to configure ov5640.

The esOV5640_VGA_HS_config() is exactly what the internal configuration is,

because the library I'm calling here doesn't see the internal implementation,

and can only guess.

My purpose is to realize the video stream of usb2.0 720p,

but I don't know how to configure esov5640_720p_HS_config();

At first I thought that this function might be the configuration for pLL, the crystal oscillator frequency,

as long as you reduce 720p to 15fps, but it's not just that.

I hope to get your guidance.

0 Likes

Yes, I also have a dev board CYUSB3KIT-003.

I now loaded the example USBBulkSourceSinkLED and watched it.

On my main computer (intel i7 win7 64 or win 10 pro and gigabyte GA-B250M-DS3H board) ) everything works without problems

Than I tried this devkit on other computer with win10

Through port usb2 all works.

Through port usb3 there are features.

The debug output says that the connection is present, it is defined as usb3.

The LED starts flashing.

But in the usbtreeview program it is visible that the device is in a state of permanent "enumerating".

Then after a while (about 1 minute), I see that the LED starts to light constantly.

And in the usbtreeview program, I see that the device is logically connected to the host usb2.

Images and output I will be sent later.

0 Likes

Sorry, prev answer is for other letter.

Now I made in usb3 connect: added resolution 1280*960 (success).

For usb3 I not have any good results.

I can not have any success in add resoutions.

Neither 1280*960 neiher 1290-*720, no 5 Mp.

I added descriptors for usb2 descriptor and handlers in code. Is good. But I have a black screen.

But I not understand how change mipi settings and how configure ov5640 sensor?

Analogue usb3?

I understand that need use gpif designer for add new resolution, but not know how.

0 Likes

I somewhere on the forum saw a similar question, there it is described how to use GPIF II to add a new extension to CX3 camera, but now I can not find these messages.

0 Likes