cancel
Showing results for 
Search instead for 
Did you mean: 

How to control the LCD backlight in Touchgfx on STM32H747I DISCO board

rahulz916
Associate

Hi all

          I am using stm32H747I-disco board .Can anyone please help with the example to control the brightness of the display

 

 

Thank you.

8 REPLIES 8
Kenwang
Associate III

Back light is controled by CABC pin , however this pin did not connect to mcu, so it can't be control.

Kenwang_0-1740382758872.png

 

mƎALLEm
ST Employee

Hello,

See also this thread.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

"R4" is marked "N/A", does it mean that the R4 resistor is not installed, so the backlight is controlled by CABC instead of BL_CTRL?

N/A means Not Applicable: not soldered by default.

"so the backlight is controlled by CABC instead of BL_CTRL?" 

-> Most probably yes.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
rahulz916
Associate

Thanks for confirming.

But to control brightness of the screen I found an example but it does not have interaction with hardware.

I found the  this function in touchgfxhal.cpp

void LCD_SetBrightness(int value)
    {
        HAL_DSI_ShortWrite(&hdsi,
                           0, DSI_DCS_SHORT_PKT_WRITE_P1,
                           OTM8009A_CMD_WRDISBV, (uint16_t)(value * 255) / 100);
    }
 
Please tell me how to integrate this code

In the view, try that:

 

extern "C" {
void LCD_SetBrightness(int value);
}

/* Set the brightnessto 100% at the screen startup */
void Screen1View::setupScreen()
{
    Screen1ViewBase::setupScreen();
    LCD_SetBrightness(100);
}
To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Kenwang
Associate III

I haven’t actually implemented the backlight adjustment function myself. I only spent some time working with TouchGFX on this MCU, so if I make any mistakes, please feel free to correct me.

https://youtu.be/pQOMrdUP6-g

From the schematic, the screen backlight is controlled by the STLD40DPUR chip. According to its datasheet, the backlight brightness should be adjusted using a PWM signal. However, the PJ12 pin does not support PWM functionality. If R4 is populated, it should be possible to control the backlight using this method.

As for the sample code you mentioned, it includes a backlight adjustment function because TouchGFX sample codes support multiple development boards, and STM32H747-DISCO is just one of them. This particular code is likely not applicable to this board.

It seem that the Backlight is controlled over CABC signal by default. You don't need to modify anything on the  board. It seems the backlight is controlled by the LCD controller itself.

I tested the control of the backlight using void LCD_SetBrightness(int value) declared in TouchGFXHAL.cpp.

For example in Model.cpp:

#include <gui/model/Model.hpp>
#include <gui/model/ModelListener.hpp>

extern "C" {
void LCD_SetBrightness(int value);
}

Model::Model() : modelListener(0)
{

}
volatile int i;
void Model::tick()
{
	LCD_SetBrightness(i/60);
	i++;
	if(i>6000) i = 0;
}

This changes the backlight progressively.

Hope that helps.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.