Skip to main content
Louie88
Senior
February 20, 2025
Solved

How to turn on/off backlight of STM32H747I_DISCO board

  • February 20, 2025
  • 3 replies
  • 3396 views

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

 

Best answer by mƎALLEm

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.

3 replies

mƎALLEm
Technical Moderator
February 20, 2025

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
Louie88Author
Senior
February 20, 2025

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

mƎALLEm
Technical Moderator
February 21, 2025

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."
Louie88
Louie88Author
Senior
February 21, 2025

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

 

ST Employee
February 21, 2025

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

Louie88
Louie88Author
Senior
February 21, 2025

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