2025-02-20 04:51 AM - last edited on 2025-02-20 05:08 AM by mƎALLEm
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
2025-02-20 05:09 AM - edited 2025-02-20 05:13 AM
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?
2025-02-20 06:39 AM
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
2025-02-21 12:19 AM - edited 2025-02-21 04:40 AM
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):
You need to solder R4.
2025-02-21 04:02 AM - edited 2025-02-21 05:21 AM
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
2025-02-21 10:33 AM
Thanks Dor_RH,
It is actually done in main.c MX_GPIO_Init() method:
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
2025-02-21 10:38 AM
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