cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

VlKh_2251656
Contributor II

Hello.

I have a denebola devboard (CX3 + OV5640)

I hope add any resolutions to USB2 type connection.

I made

1) add frame descriptors in descriptor file (for example 1280*720)

    /* Class specific Uncompressed VS frame descriptor 2 - 720p@ 60fps*/

    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: 1280 */

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

    0x00, 0x00, 0x57, 0x00,             /* Min bit rate

    0x00, 0x00, 0xBC, 0x34,             /* Max bit rate

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

    0x0A, 0x8B, 0x0E, 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 */

2) add handler in code

if(FrameIndex == 0x01)

{

/* 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();

}

else if(FrameIndex == 0x02)

{

/* 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();

}

But I not understand how setup gpif , mipi lanes and probes, and ov5640 registers with this resolution

Many thanks

0 Likes
1 Solution
KandlaguntaR_36
Moderator
Moderator

Please refer this App Note: How to Interface a MIPI® CSI-2 Image Sensor with EZ-USB® CX3:

http://www.cypress.com/file/126136/download

I have created an example MIPI configuration project for 720p 5fps.

Here is the MIPI configuration of the same.

/* OV5640_YUY2_Resolution0 :  */

CyU3PMipicsiCfg_t OV5640_YUY2_Resolution0 =

{

    CY_U3P_CSI_DF_YUV422_8_2,  /* CyU3PMipicsiDataFormat_t dataFormat */

    2,                          /* uint8_t numDataLanes */

    2, /* uint8_t pllPrd */

    89, /* uint16_t pllFbd */

    CY_U3P_CSI_PLL_FRS_250_500M, /* CyU3PMipicsiPllClkFrs_t pllFrs */

    CY_U3P_CSI_PLL_CLK_DIV_4, /* CyU3PMipicsiPllClkDiv_t csiRxClkDiv */

    CY_U3P_CSI_PLL_CLK_DIV_4, /* CyU3PMipicsiPllClkDiv_t parClkDiv */

    0,                /* uint16_t mClkCtl */

    CY_U3P_CSI_PLL_CLK_DIV_2, /* CyU3PMipicsiPllClkDiv_t mClkRefDiv */

    1280,        /* uint16_t hResolution */

    50                        /* uint16_t fifoDelay */

};

UVC Probe Control Setting - 720p@ 5 fps are fine.

Do the following modifications in the firmware.

1. Modify the High Speed descriptor part - Add third frame index (720p, 5fps). Min bit rate and maximum bit rate to 1280 x 720 x 2 x 8 x 5 fps

2. Change the Counter values - LD_ADDR_COUNT and LD_DATA_COUNT counters need to be modified as per the selected data bus width and DMA Buffer size . Refer An75779. Becasue you are using 36 KB buffer size

3. Add the Mipi configration as said above

4. Also change the camera setting using the Brute Force method.

Once you do the above changes, check the device enumeration.

It supposed to come up as UVC  + CDC device. Open Device Manager and look for the UVC (Imaging devices) and CDC (COM Port) devices.

View solution in original post

35 Replies
VlKh_2251656
Contributor II

How I understand, this code

/* 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    */

};

is not correction in usb2 connection mode?

0 Likes
KandlaguntaR_36
Moderator
Moderator

Vladimir,

As per the description of 720P, 60fps and 2 bytes per pixel, the bandwidth is coming more than 110 MBps (Greater USB 2.0 theoritical bandwidth). This does not support in USB 2.0 mode.

Practically CX3 can achive around 35 MBps in USB 2.0 mode. Hence, we have to set the image configuration less than 35 MBps.

Can you please provide the image sensor configuration?

1. CSI Clock

2. H_Active and H_Blanking

3. V_Active and V_Blanking

4. Frames per second

5. Bytes per pixel

The above values help me to calculate the bandwidth. Then, I can suggest whether it can be supported.

Regards,

Sridhar

VlKh_2251656
Contributor II

Dear Sridhar,

The point is that I do not know them.

1. CSI Clock

2. H_Active and H_Blanking

3. V_Active and V_Blanking

4. Frames per second

5. Bytes per pixel

There values are underfinded for me.

I agree reduce the frame rate of video, even 10 or 5 frames per second is enough.

May be 1280*720 @ 10 fps,

or 1280*960 @ 5 fps

Many thanks

0 Likes
KandlaguntaR_36
Moderator
Moderator

Vladimar,

I can reduce the frame rate and provide you the MIPI CSI2 Receiver configuration.

But what about the configuring the sensor at the same rate?

Did you get the settings of the same from the Omni Vision?

What exactly is your requirement here?

I hope that you have gone through the example project provided with SDK in this default path: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\cx3_examples\cycx3_uvc_ov5640

Regards,

Sridhar

0 Likes
VlKh_2251656
Contributor II

In fact of the matter

I have NDA with OV, but I do not have technical support on their part

I made my own resolution change from 1280*20 to 1280*960 in USB3 mode

I tried to add the resolution 1280*720 in USB2 mode but not successfully.

Now I look at cycx3_uvc_ov5640 project

0 Likes
VlKh_2251656
Contributor II

I see the gpif II edit window, but is not enable...

0 Likes
VlKh_2251656
Contributor II

Dear Sridhar

I see method:

CyCx3_ImageSensor_Set_720p();

Can I use this function in USB2 mode?

0 Likes
KandlaguntaR_36
Moderator
Moderator

Vladimir,

We can not use CyCx3_ImageSensor_Set_720p(); in USB 2.0 due to bandwidth constraint.

You can use only CyCx3_ImageSensor_Set_Vga in USB 2.0 in the example firmware. If you want to stream 720P video in USB 2.0 you have to reduce the frame rate.

This needs the sensor settings from the sensor manufacturer.

>> I made my own resolution change from 1280*20 to 1280*960 in USB3 mode.

How did you do this?

0 Likes
VlKh_2251656
Contributor II

Changed descriptor for usb3 and ov5640 settings

0 Likes
VlKh_2251656
Contributor II

It's usb3 descriptor for project uvc+cdc

0 Likes
KandlaguntaR_36
Moderator
Moderator

How did you get the settings for OV5640?

Have you received from the OV?

0 Likes
VlKh_2251656
Contributor II

he said that for them we are too small and they will not support us.

I myself made a method of brute-force options

As example.

CAM_REG OV5640_960_SS_CLK[] =

{

//2 lane 60 FPS - UYVY

{OV5640_SYSTEM_CTRL00, 0x42},

{OV5640_SCCB_SYSTEM_CTRL01, 0x03},

{OV5640_PAD_OUTPUT_ENABLE01, 0x00},

{OV5640_PAD_OUTPUT_ENABLE02, 0x00},

{OV5640_SC_PLL_CTRL0, 0x18},

{OV5640_SC_PLL_CTRL1, 0x11},

{OV5640_SC_PLL_CTRL2, 0x54},

{OV5640_SC_PLL_CTRL3, 0x13},

{OV5640_SYS_ROOT_DIVIDER, 0x01}, //01 - For 60 FPS, 02 - For 30 FPS

};

CAM_REG_16 OV5640_960_SS_TIMINGS[] =

{

{OV5640_IMAGE_FLIP, 0x4701},

//{OV5640_IMAGE_MIRROR, 0x01},

{OV5640_X_INC, 0x3131},

{OV5640_X_START_HI, 0x0000}, // 0

{OV5640_X_END_HI, 0x0a3f}, // 2623

{OV5640_DVP_OUT_WIDTH_HI, 0x0500}, // 1280

{OV5640_HOR_SIZE_HI, 0x0764}, // 1892 = 1280 + 612

{OV5640_HOFFSET_HI, 0x0010}, // 16

{OV5640_Y_START_HI, 0x0008}, // 250 = (1944 - 960*2)/2 - 1 = 11. But 8.

{OV5640_Y_END_HI, 0x07a7}, // 1705 = 1455 - 250 = 720*2 + 15 - 250

{OV5640_DVP_OUT_HEIGHT_HI, 0x03c0}, // 960

{OV5640_VERT_SIZE_HI, 0x0484}, // 756 = 736 + 20

{OV5640_VOFFSET_HI, 0x0004}, // 4

};

I'm sorry.

I can not show more because of the nda whis OV

Made from1280*720 example

0 Likes
VlKh_2251656
Contributor II

We have a datasheet of OV5640, but is confidential document.

Only for us.

Many thanks.

0 Likes
KandlaguntaR_36
Moderator
Moderator

Well,

In order to stream 720p @ 15fps in USB 2.0 do the following.

1. Modify the 720P sensor settings for 15 fps by the brute -force options.

2. Generate the MIPI Configuration settings for the same from the MIPI Configuration Utility. Open a new project and generate. Copy the configuration in the main project.

3. Add the descriptors for in High-speed configuration.

4. Add the Probe control settings

VlKh_2251656
Contributor II

Dear SRDR

Generate the MIPI Configuration settings for the same from the MIPI Configuration Utility.

How? Please tell me.

Where is MIPI Configuration Utility ?

I've never used this application before.

Please tell in detail how to use it?

Where to find it?

How to create a new project or modify an existing one?

How to create the necessary settings?

How to save and generate the project?

How to add to what is available?

0 Likes
VlKh_2251656
Contributor II

what do I have to choose here?

0 Likes
VlKh_2251656
Contributor II

Picture in additions...

0 Likes
VlKh_2251656
Contributor II

I chose this.

It is right (images in additions)?

0 Likes
VlKh_2251656
Contributor II

And how, after all, after that configure the sensor OV5640 in mode USB2? As well as in the mode USB3 ?

Use esOV5640_720P_config() ?

Or again, to select by brute force?

0 Likes
VlKh_2251656
Contributor II

For USB2, 1280*720 and 5 fps it's right?

/* OV5640_YUY2_720p :  */

CyU3PMipicsiCfg_t OV5640_YUY2_720p_usb2 =

{

    CY_U3P_CSI_DF_YUV422_8_2,  /* CyU3PMipicsiDataFormat_t dataFormat */

    2,                          /* uint8_t numDataLanes */

    1, /* uint8_t pllPrd */

    -1, /* uint16_t pllFbd */

    CY_U3P_CSI_PLL_FRS_500_1000M, /* CyU3PMipicsiPllClkFrs_t pllFrs */

    CY_U3P_CSI_PLL_CLK_DIV_8, /* CyU3PMipicsiPllClkDiv_t csiRxClkDiv */

    CY_U3P_CSI_PLL_CLK_DIV_8, /* CyU3PMipicsiPllClkDiv_t parClkDiv */

    0,                /* uint16_t mClkCtl */

    CY_U3P_CSI_PLL_CLK_DIV_2, /* CyU3PMipicsiPllClkDiv_t mClkRefDiv */

    1280,        /* uint16_t hResolution */

    50                        /* uint16_t fifoDelay */

};

// UVC Probe Control Setting - 720p@ 5 fps

uint8_t const gl720pProbeCtrl_USB2[CX3_APP_MAX_PROBE_SETTING] = {

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

    0x01,                              // Use 1st Video format index

    2,                              // Use 2nd Video frame index

    0x80, 0x84, 0x1e, 0x00,            // Desired frame interval in 100ns = (1/60)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: 720 x 1280 x 2

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

};

In additions here my project (added 1280*720 @5 fps in USB2 mode). Please, help me check all errors. !

0 Likes
KandlaguntaR_36
Moderator
Moderator

Please refer this App Note: How to Interface a MIPI® CSI-2 Image Sensor with EZ-USB® CX3:

http://www.cypress.com/file/126136/download

I have created an example MIPI configuration project for 720p 5fps.

Here is the MIPI configuration of the same.

/* OV5640_YUY2_Resolution0 :  */

CyU3PMipicsiCfg_t OV5640_YUY2_Resolution0 =

{

    CY_U3P_CSI_DF_YUV422_8_2,  /* CyU3PMipicsiDataFormat_t dataFormat */

    2,                          /* uint8_t numDataLanes */

    2, /* uint8_t pllPrd */

    89, /* uint16_t pllFbd */

    CY_U3P_CSI_PLL_FRS_250_500M, /* CyU3PMipicsiPllClkFrs_t pllFrs */

    CY_U3P_CSI_PLL_CLK_DIV_4, /* CyU3PMipicsiPllClkDiv_t csiRxClkDiv */

    CY_U3P_CSI_PLL_CLK_DIV_4, /* CyU3PMipicsiPllClkDiv_t parClkDiv */

    0,                /* uint16_t mClkCtl */

    CY_U3P_CSI_PLL_CLK_DIV_2, /* CyU3PMipicsiPllClkDiv_t mClkRefDiv */

    1280,        /* uint16_t hResolution */

    50                        /* uint16_t fifoDelay */

};

UVC Probe Control Setting - 720p@ 5 fps are fine.

Do the following modifications in the firmware.

1. Modify the High Speed descriptor part - Add third frame index (720p, 5fps). Min bit rate and maximum bit rate to 1280 x 720 x 2 x 8 x 5 fps

2. Change the Counter values - LD_ADDR_COUNT and LD_DATA_COUNT counters need to be modified as per the selected data bus width and DMA Buffer size . Refer An75779. Becasue you are using 36 KB buffer size

3. Add the Mipi configration as said above

4. Also change the camera setting using the Brute Force method.

Once you do the above changes, check the device enumeration.

It supposed to come up as UVC  + CDC device. Open Device Manager and look for the UVC (Imaging devices) and CDC (COM Port) devices.

View solution in original post

VlKh_2251656
Contributor II

Many thanks...

The fact is that the OV5640 sensor settings are unknown ...

And the brute force method does not always work ...

0 Likes
VlKh_2251656
Contributor II

Sorry...

Project is empty?

0 Likes
KandlaguntaR_36
Moderator
Moderator

This project address only MIPI CSI-2 block configuration.

Click on cx3config.cycx

0 Likes
VlKh_2251656
Contributor II

Many thanks

0 Likes
VlKh_2251656
Contributor II

Dear SRDR,

In sdk 1.3.3:

Unable to load the file as it looks like you are attempting to open an Invalid or Corrupted CX3 Configuration File.

see attach

Many thanks

0 Likes
KandlaguntaR_36
Moderator
Moderator

Can you please update to SDK 1.3.4  and try?

Please go to FX3 SDK page and download the 1.3.4 version and install it.

0 Likes
VlKh_2251656
Contributor II

Yes, I downloaded it and installed it some time ago this version (1.3.4) on another computer.

On the main computer, development is now underway on version 1.3.3.

Then you have to convert the project ...

Thank you very much!

0 Likes
KandlaguntaR_36
Moderator
Moderator

You can select either SDK 1.3.4 or 1.3.3 through the settings as shown below.

It is recommended to use SDK 1.3.4 since it comes with improvements and additional functionalities.

pastedImage_0.png

VlKh_2251656
Contributor II

Many thanks!

Please, see attach

any tabs?

0 Likes
VlKh_2251656
Contributor II

Sorry, any errors (in attach)

Maybe something else needs to be change?

0 Likes
KandlaguntaR_36
Moderator
Moderator

Please build the project and check whether there is any errors in the Console.

Click on the CX3 Receiver Configuration Tab to see other tabs.

0 Likes
VlKh_2251656
Contributor II

Console out:

12:59:31 **** Build of configuration Release for project UVC_CDC_2 ****

cs-make all

'Building file: ../cycx3_uvc.c'

'Invoking: Cross ARM C Compiler'

arm-none-eabi-gcc -mcpu=arm926ej-s -marm -mthumb-interwork -O3 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall  -g -D__CYU3P_TX__=1 -I"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/fw_lib/1_3_3/inc" -std=gnu11 -MMD -MP -MF"cycx3_uvc.d" -MT"cycx3_uvc.o" -c -o "cycx3_uvc.o" "../cycx3_uvc.c"

'Finished building: ../cycx3_uvc.c'

' '

'Building file: ../cycx3_uvcdscr.c'

'Invoking: Cross ARM C Compiler'

arm-none-eabi-gcc -mcpu=arm926ej-s -marm -mthumb-interwork -O3 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall  -g -D__CYU3P_TX__=1 -I"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/fw_lib/1_3_3/inc" -std=gnu11 -MMD -MP -MF"cycx3_uvcdscr.d" -MT"cycx3_uvcdscr.o" -c -o "cycx3_uvcdscr.o" "../cycx3_uvcdscr.c"

'Finished building: ../cycx3_uvcdscr.c'

' '

'Building file: ../cyfx_gcc_startup.S'

'Invoking: Cross ARM GNU Assembler'

arm-none-eabi-gcc -mcpu=arm926ej-s -marm -mthumb-interwork -O3 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall  -g -x assembler-with-cpp -I"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/fw_lib/1_3_3/inc" -MMD -MP -MF"cyfx_gcc_startup.d" -MT"cyfx_gcc_startup.o" -c -o "cyfx_gcc_startup.o" "../cyfx_gcc_startup.S"

'Finished building: ../cyfx_gcc_startup.S'

' '

'Building file: ../cyfxtx.c'

'Invoking: Cross ARM C Compiler'

arm-none-eabi-gcc -mcpu=arm926ej-s -marm -mthumb-interwork -O3 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall  -g -D__CYU3P_TX__=1 -I"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/fw_lib/1_3_3/inc" -std=gnu11 -MMD -MP -MF"cyfxtx.d" -MT"cyfxtx.o" -c -o "cyfxtx.o" "../cyfxtx.c"

'Finished building: ../cyfxtx.c'

' '

'Building target: UVC_CDC_2.elf'

'Invoking: Cross ARM C Linker'

arm-none-eabi-gcc -mcpu=arm926ej-s -marm -mthumb-interwork -O3 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall  -g -T "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/fw_build/fx3_fw/fx3.ld" -nostartfiles -Xlinker --gc-sections -L"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/fw_lib/1_3_3/fx3_release" -L"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\ARM GCC\/lib/gcc/arm-none-eabi/4.8.1" -L"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\ARM GCC\/arm-none-eabi/lib" -Wl,-Map,"UVC_CDC_2.map" -Wl,-d -Wl,--no-wchar-size-warning -Wl,--entry,CyU3PFirmwareEntry -o "UVC_CDC_2.elf"  ./cycx3_uvc.o ./cycx3_uvcdscr.o ./cyfx_gcc_startup.o ./cyfxtx.o   -lcy_ov5640 -lcyu3mipicsi -lcyu3lpp -lcyfxapi -lcyu3threadx -lc -lgcc

'Finished building target: UVC_CDC_2.elf'

' '

cs-make --no-print-directory post-build

'Generate boot-loadable binary image'

'C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/util/elf2img/elf2img.exe' -i UVC_CDC_2.elf -o UVC_CDC_2.img -v

Note: 256 bytes of interrupt vector code have been removed from the image.

Endian-ness    : Little

      Use the "-vectorload yes" option to retain this code.

Entry point    : 0x4000ca44

Program header table offset: 0x00000034

Program header count       : 3

Program header entry size  : 0x0020

Copying data from program header:

Addr=0x00000100 Size(words)=0x0000088a FileSize=0x0000088a Offset=0x00000100 Flags=0x00000005

Copying data from program header:

Addr=0x40003000 Size(words)=0x00004000 FileSize=0x00004000 Offset=0x00003000 Flags=0x00000005

Copying data from program header:

Addr=0x40013000 Size(words)=0x0000232c FileSize=0x0000232c Offset=0x00013000 Flags=0x00000005

Copying data from program header:

Addr=0x40030000 Size(words)=0x00000e94 FileSize=0x000007e2 Offset=0x00020000 Flags=0x00000006

' '

'Invoking: Cross ARM GNU Print Size'

arm-none-eabi-size --format=berkeley "UVC_CDC_2.elf"

   text    data     bss     dec     hex filename

110296    8072    6832 125200   1e910 UVC_CDC_2.elf

'Finished building: UVC_CDC_2.siz'

' '

12:59:33 Build Finished (took 1s.758ms)

Good? Strange...

0 Likes
VlKh_2251656
Contributor II

Many thanks!

0 Likes