How to custom UVC properites in CX3 firmware

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

cross mob
ArSa_3842301
Level 3
Level 3
25 sign-ins 10 replies posted 10 questions asked

Hi,

We are currently developing the firmware for a camera application based on CX3 IC. I realiced that CX3 is able to communicate with laptop, in order to manipulete the camera sensor, through two differet ways : by own driver or by standar UVC driver (V1.1 concretely).


We have decided to chose the standar UVC driver option to implement the communication betwen the laptop and the camera sensor. So, actually we can set and get whatever Camera Terminal controls (Exposure Time, Focus, etc) or whatever Processing Unit controls (Brightness,Contrast, etc). To do that, we follow the following approach:

- In laptop side, We have an application wich works with openCV library. Because it give us the possibility to interact with a camera based on UVC driver.

- In CX3 firmware side, we have the knoledge to modify the following files:
          - cycx3_uvcdscr.c = in this file we can enable or disable both Camera terminal controls and Processing Unit controls,              contemplated on UVC V1.1.
          - cycx3_uvc.c = in this file we must customize the CyCx3UvcAppUSBSetupCB function (Callback to handle the USB                    Setup Requests and UVC Class events). for set all necessary fields of each enabled property in cycx3_uvcdscr.c.                         Among the fields we can find the following:                                                                                                        CX3_USB_UVC_GET_LEN_REQ,CX3_USB_UVC_GET_INFO_REQ,CX3_USB_UVC_GET_MIN_REQ,CX3_USB_UVC_GET_MAX_REQ,CX3_USB_UVC_GET_RES_REQ,CX3_USB_UVC_GET_DEF_REQ,CX3_USB_UVC_GET_CUR_REQ and CX3_USB_UVC_SET_CUR_REQ. All this fields serve to set the amount of bytes, the maximum and minimum values and to write and read the value of the property.

 

Continuing with this, We would like to ask you the next question:

- It is possible to custom the data type of each property? I mean, for example, by default the exposure time is a double type. And We can not understand if it is set in cycx3_uvcdscr.c or it only depens of the UVC driver and it means that this field is not modifiable. Because we want to send directly the value in milliseconds, as a double, and convert it on a hexadecimal value inside the CX3 and send it to camera sensor. If we go to USB Video Class V1.1 document, we can see that the Exposure Time (Absolute) Control has 4 bytes of wLength, so how could we write the value directly in milliseconds?.

ArSa_3842301_0-1611573095495.png

 

0 Likes
1 Solution
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi,

The field definition (for example, 4 byte value in Exposure Time (Absolute) Control is expressed in 100us units) comes from UVC specification and not from descriptor file.

So, for Exposure Time (Absolute) Control the resolution available is 0.1 ms. From your description, I think you need value 1 to indicate 1ms instead of 100us. You can consider this option - From the UVC host application API you can indicate 100us for which value 1 goes to the USB device. In the firmware, you can interpret it as 1ms. That is, a mapping can be designed.

If any other filed definition is not as you need and if mapping like above is not possible, then you will have go with extension unit. Please refer to extension unit implemented in AN75779 

Regards,

Hemanth

View solution in original post

0 Likes
1 Reply
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi,

The field definition (for example, 4 byte value in Exposure Time (Absolute) Control is expressed in 100us units) comes from UVC specification and not from descriptor file.

So, for Exposure Time (Absolute) Control the resolution available is 0.1 ms. From your description, I think you need value 1 to indicate 1ms instead of 100us. You can consider this option - From the UVC host application API you can indicate 100us for which value 1 goes to the USB device. In the firmware, you can interpret it as 1ms. That is, a mapping can be designed.

If any other filed definition is not as you need and if mapping like above is not possible, then you will have go with extension unit. Please refer to extension unit implemented in AN75779 

Regards,

Hemanth
0 Likes