cancel
Showing results for 
Search instead for 
Did you mean: 

How to turn on/off backlight of STM32H747I_DISCO board

Louie88
Associate III

I would like to turn off the backlight if the LCD module of STM32H747I_DISCO board. I figured out that the PJ12 (LCD_BL_CTRL, PORT = J PIN = 12) probably controls the backlight of the LCD module (from schematics). The "PJ12" is initialized in "main.MX_GPIO_Init()" and it is set to output to level low (GPIO_PIN_RESET) during POR. 

I tried to set PJ12 to high and low with the follow HAL call:

 

 

void Screen1View::handleTickEvent()
{
	if (++tickCount >= ScreenUpdateCount)
	{
		tickCount = 0;
		updateScreen();
		if (++lcdBackLightCount >= TurnOffLcdBacklightCount)
		{
			lcdBackLightCount = 0;
			// Turn off LCD
			HAL_GPIO_WritePin(GPIOJ, LCD_BL_Pin, GPIO_PIN_SET);
			// HAL_GPIO_WritePin(GPIOJ, LCD_BL_Pin, GPIO_PIN_RESET);
		}
	}
}

 

 

 

but it did nothing. Backlight of the LCD stays always on.

The test app is based on TouchGFX.

Any idea?

Thanks,

Louis

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @Louie88 ,

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.

View solution in original post

9 REPLIES 9
mƎALLEm
ST Employee

Thread moved to STM32 MCUs Embedded forum board as it has no relation to the TouchGFX usage but to the BSP of the board.

Forget about TouchGFX for the moment, did you try to set/reset that pin and see what happens with the backlight?

 

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.
Louie88
Associate III

His SofLit,

I am sorry for the wrong forum. Yes, I did, please check my original post. I use HAL write pin method.

HAL_GPIO_WritePin(GPIOJ, LCD_BL_Pin, GPIO_PIN_SET);

Louis

Hello,

According to the LCD board schematic, it seems the back light control pin is not connected to the LCD back light controller input (EN):

mALLEm_0-1740125821484.png

You need to solder R4.

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.
Dor_RH
ST Employee

Hello @Louie88,

Yes, it is the right function: 

HAL_GPIO_WritePin(GPIOJ, LCD_BL_Pin, GPIO_PIN_SET);

But try to configure the GPIO pin as bellow: 

GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

I hope my answer has helped you. When your question is answered, please select this topic as solution that answered you, it will help others find that answer faster.

Thanks for your contribution.

Dor_RH

Thanks Dor_RH,

It is actually done in main.c MX_GPIO_Init() method:

20250221-MX_GPIO_Initpng.png

I think mƎALLEm is right (see above post). The R4 is really not assembled in MB166 LCD Module (See the attached microscope image) so the BL_CTRL (PJ12) GPIO output does nothing with the backlight enable pin. It is always connected to CABC pin which is a pin of the CN2 connector (whatever it is).  

Thanks,

Louis

Hi mƎALLEm,

Thanks for your valuable note, I think you are right. The R4 is really not assembled in MB166 LCD Module (See the attached microscope image) so the BL_CTRL (PJ12) GPIO output does nothing with the backlight enable pin. It is always connected to CABC pin which is a pin of the CN2 connector (whatever it is).  The R5 pullup resistor is also omitted...

Now the question is may I shortcut the CABC signal (whatever it is) with BL_CTRL to make the backlight control work?

Thanks,

Louis

 

Hello,

Try to disconnect CABC by removing R1 +R5 and solder R4 to connect BL_CTRL.

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.

Hello @Louie88 ,

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.

Thanks mƎALLEm!!!

It works fine without soldering anything on the TFT Module, however it sets the BRIGHTNESS of the display and does not turn off the BACKLIGHT. If you run an application from battery then it is a nice feature to turn of the display after say 10 minutes (whatever) idle time to spare with the battery energy. (Backlight is around 100mA or more ...)

I found turning off the backlight is not implemented in "TouchGFXHAL.cpp". According to the OTM8009A user's manual the command 'WRCTRLD (53H) Write CTRL Display' can be used to tur on/off the LCD Module. I have not tried that yet but I will. 

Thanks,

Louis

Edit: I am sorry, I was wrong, the:

LCD_SetBrightness(0);

completely turns of the backlight. Forget my earlier notes. Thanks!