Link copied to clipboard!

How to adjust backlight in stm modules?

Changing the level of backlight in STM modules such as RVT101, RVT70, RVT50 is possible by controling PWM signal.
To start with a proper connection of the display and PC using STlink, as well as using proper software TouchGFX is required.
The key to change the intensity of displays backlight is setting proper value of TIM15.

Backlight is control with HW PWM output of TIM15 you can adjust it by changing PWM duty from 0 to 998. 0 means no backlight and 998 is max. Look at tim.c in template project.

sConfigOC.OCMode = TIM_OCMODE_PWM1;

 

sConfigOC.Pulse = 998;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
sConfigOC.OCIdleState = TIM_OCIDLESTATE_RESET;
sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET;
if (HAL_TIM_PWM_ConfigChannel(&htim15, &sConfigOC, TIM_CHANNEL_1) != HAL_OK)
{
Error_Handler();
}

You can also change it directly on registers.

TIM15.CCR1 = Your_new_pulse_value;

DISCOVER OUR

Whitepaper

Achieve the perfect user-display interaction with the right Touch Sensor IC. Ever faced issues with phantom touch events or certification? Boost your R&D like a pro with our Whitepaper!