2025-02-20 4:51 AM - last edited on 2025-02-20 5: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
Solved! Go to Solution.
2025-02-25 12:53 AM
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.
2025-02-20 5:09 AM - edited 2025-02-20 5: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 6: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 4: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 4:02 AM - edited 2025-02-21 5: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
2025-02-24 12:04 AM - edited 2025-02-24 12:09 AM
Hello,
Try to disconnect CABC by removing R1 +R5 and solder R4 to connect BL_CTRL.
2025-02-25 12:53 AM
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.
2025-02-25 4:03 AM - edited 2025-02-25 4:09 AM
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!