Brightness control with KBA225062

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

cross mob
roMo_4201811
Level 2
Level 2
First like received

Hello,

I edited my project using the steps described in KBA225062 to enable brightness control, but the brightness slider does not appear in camera controls of any of the video tools (Amcap, MPC-HC, ecamview). All sliders are grayed out.

Any suggestions how to get the slider to appear?

pastedImage_2.png

1 Solution

Hello,

Please comment all the changes that you made from the KBA and make the following changes and let me know if you are able to see the brightness slider.

1. Inside the Processing Unit Descriptor found in cycx3_Uvcdscr.cmake the following change:

pastedImage_0.png

2. Inside the function CyCx3AppUSBSetupCB in cycx3_uvc.c, you can find the following line of code:

else if (CY_U3P_GET_LSB(wIndex) == CX3_APP_CONTROL_INTERFACE)

Replace everything inside this elseif statement with the following lines of code:

        isHandled = CyTrue;

        if((wIndex == 0x200) && (wValue == 0x200))/*Brightness*/

        {

        switch(bRequest)

        {

                      case CX3_USB_APP_GET_INFO_REQ:

                         gl16GetControl = 3;

                         CyU3PUsbSendEP0Data (2, (uint8_t*)&gl16GetControl);

                         isHandled = CyTrue;

        break;

                      case CX3_USB_APP_GET_MIN_REQ:

                      gl16GetControl = 0;

                      CyU3PUsbSendEP0Data (2, (uint8_t*)&gl16GetControl);

                      break;

                      case CX3_USB_APP_GET_MAX_REQ:

                      gl16GetControl = 100;

                      CyU3PUsbSendEP0Data (2, (uint8_t*)&gl16GetControl);

                      break;

                      case CX3_USB_APP_GET_RES_REQ:

                      gl16GetControl = 1;

                          CyU3PUsbSendEP0Data (2, (uint8_t*)&gl16GetControl);

                          break;

                      case CX3_USB_APP_GET_CUR_REQ:

                      gl16GetControl = 15;

                      CyU3PUsbSendEP0Data (2, (uint8_t*)&gl16GetControl);

                      break;

                      case CX3_USB_APP_GET_DEF_REQ:

                      gl16GetControl = 15;

                      CyU3PUsbSendEP0Data (2, (uint8_t*)&gl16GetControl);

                      break;

                      case CX3_USB_APP_SET_CUR_REQ:

                      status = CyU3PUsbGetEP0Data(16,(uint8_t*)&gl16SetControl,&readCount);

                      break;

Make sure that you declare the global variables gl16GetControl and glSetControl at the start of cycx3_uvc.c file as follows:

uint16_t gl16GetControl = 0;

uint16_t gl16SetControl = 0;

3. Now build the project and check if you are able to see the brightness slider. I verified this on my end using denebola kit and found that it was there.

Note: This just makes the brightness slider appear only. As you might be knowing to actually change the brightness, you need to write to the corresponding register of the mage sensor. This can be done by writing the value obtained in the global variable gl16SetControl to the appropriate register of the image sensor via I2C.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

View solution in original post

0 Likes
5 Replies
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

Please confirm that you are using the denebola kit and want to implement the brightness control feature in the SDK project Cx3UvcOV5640.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
lock attach
Attachments are accessible only for community members.

Hi,

I am using the Denebola kit with our own imager board with OnSemi AR0144 imager. I got the imager board working streaming images @ 30ips before starting this brightness enhancement. My code is derived from the project Cx3UvcOV5640 but has obviously been changed to support the new imager. Any help you can provide is appreciated.

Regards,

Rockie

0 Likes

Hello,

Please comment all the changes that you made from the KBA and make the following changes and let me know if you are able to see the brightness slider.

1. Inside the Processing Unit Descriptor found in cycx3_Uvcdscr.cmake the following change:

pastedImage_0.png

2. Inside the function CyCx3AppUSBSetupCB in cycx3_uvc.c, you can find the following line of code:

else if (CY_U3P_GET_LSB(wIndex) == CX3_APP_CONTROL_INTERFACE)

Replace everything inside this elseif statement with the following lines of code:

        isHandled = CyTrue;

        if((wIndex == 0x200) && (wValue == 0x200))/*Brightness*/

        {

        switch(bRequest)

        {

                      case CX3_USB_APP_GET_INFO_REQ:

                         gl16GetControl = 3;

                         CyU3PUsbSendEP0Data (2, (uint8_t*)&gl16GetControl);

                         isHandled = CyTrue;

        break;

                      case CX3_USB_APP_GET_MIN_REQ:

                      gl16GetControl = 0;

                      CyU3PUsbSendEP0Data (2, (uint8_t*)&gl16GetControl);

                      break;

                      case CX3_USB_APP_GET_MAX_REQ:

                      gl16GetControl = 100;

                      CyU3PUsbSendEP0Data (2, (uint8_t*)&gl16GetControl);

                      break;

                      case CX3_USB_APP_GET_RES_REQ:

                      gl16GetControl = 1;

                          CyU3PUsbSendEP0Data (2, (uint8_t*)&gl16GetControl);

                          break;

                      case CX3_USB_APP_GET_CUR_REQ:

                      gl16GetControl = 15;

                      CyU3PUsbSendEP0Data (2, (uint8_t*)&gl16GetControl);

                      break;

                      case CX3_USB_APP_GET_DEF_REQ:

                      gl16GetControl = 15;

                      CyU3PUsbSendEP0Data (2, (uint8_t*)&gl16GetControl);

                      break;

                      case CX3_USB_APP_SET_CUR_REQ:

                      status = CyU3PUsbGetEP0Data(16,(uint8_t*)&gl16SetControl,&readCount);

                      break;

Make sure that you declare the global variables gl16GetControl and glSetControl at the start of cycx3_uvc.c file as follows:

uint16_t gl16GetControl = 0;

uint16_t gl16SetControl = 0;

3. Now build the project and check if you are able to see the brightness slider. I verified this on my end using denebola kit and found that it was there.

Note: This just makes the brightness slider appear only. As you might be knowing to actually change the brightness, you need to write to the corresponding register of the mage sensor. This can be done by writing the value obtained in the global variable gl16SetControl to the appropriate register of the image sensor via I2C.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
lock attach
Attachments are accessible only for community members.

Yes that worked! The brightness slide is there. I will now make the other changes described in kba225062 to process the brightness value.

Thanks very much for your help.

Rockie

0 Likes

I was able to get it fully operational by just adding my sensor specific function calls to your code. Much easier than kba225062. I was able to add gain control as well. Consider this item closed.

Thanks for your support.

Rockie

0 Likes