STM32-LTDC, LCD-TFT, LVGL(MCU3) Lecture 34| LTDC peripheral configuration part-1

  • Post author:
  • Post category:Blog

 

LTDC peripheral configuration part-1

 

Configure the LTDC peripheral

Let’s create a new function called “LTDC_Init” to configure the LTDC peripheral. Our task is to set the background color of the LCD module to red by configuring the LTDC peripheral.

Since we have already initialized the LCD module with several commands, it is now ready to receive signals over the RGB interface. Enabling the LTDC peripheral and configuring it to send the red background color should result in the display of the color on the LCD module.

To begin initializing the LTDC peripheral, we need to modify various configuration registers. Therefore, we must first enable the peripheral clock for the LTDC. This can be achieved in the APB2ENR of the RCC since the configuration registers of the LTDC fall under the APB2 clock domain.

To enable the clock, we can use the following code:

REG_SET_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN_Pos);

Configure the LTDC peripheral
Figure 1. LTDC_Init function

 

  • After that, Configure horizontal synchronization timings
  • Configure the vertical synchronization timings
  • Configure the background color (let’s use RED)
  • Default polarity for hsync, vsync, ltdc_clk, DE
  • Enable the LTDC peripheral

To understand the required polarity, you need to refer to the LCD module’s datasheet. For instance, hsync is usually active low, indicating the start of a line when asserted. However, certain display modules may have different requirements, such as an active high hsync. In such cases, it may be necessary to modify the signal polarities. Nevertheless, for most displays, the default polarities work fine, and no configuration is needed.

Once you enable the peripheral, all signals will be transmitted, and the red color should appear on the display. We will cover the coding aspect of this in the upcoming article.

 

FastBit Embedded Brain Academy Courses

Click here: https://fastbitlab.com/course1

 

FastBitLab

The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.

Leave a Reply