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);
- 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