linux驱动开发:lcd模块简介

版权声明:学习记录,积少成多 https://blog.csdn.net/changliang7731/article/details/53071872

作为人机交互的display界面,lcd屏幕一直扮演着很重要的角色。试想一下,如果你的电子设备没有显示屏,那么人机交互将变成什么样的?比如说手机~
一般情况,LCD屏需要驱动器和控制器。拿51单片机入门的lcd1602来讲,他本身就集成了驱动电路。
我们可以根据它的spec来完成单片机部分的控制部分,你可以把这部分理解为控制器。

接下来回到主题:我手上的开发板 s5pv210.IC本身集成了LCD控制器。

而显示屏部分这边用的是7寸屏:AT070TN92
我看了下应该是友善所谓的S701.不过理论上只要是7寸屏,参数都差不多,配置的地方也差不多.现在的显示屏分为两个部分,一部分是显示用,另一部分touch screen做交互用。我们讲的LCD部分指的是显示部分,Touch Screen部分会单独分开讲。

1.S5PV210部分:
这边主要讲下它的LCD控制器:
The Display controller consists of logic for transferring image data from a local bus of the camera interface
controller or a video buffer located in system memory to an external LCD driver interface. The LCD driver interface
supports three kinds of interface, namely, RGB-interface, indirect-i80 interface, and YUV interface for writeback.
The display controller uses up to five overlay image windows that support various color formats, 256 level alpha
blending, color key, x-y position control, soft scrolling, and variable window size, among others.
The display controller supports various color formats such as RGB (1 bpp to 24 bpp) and YCbCr 4:4:4 (only local
bus). It is programmed to support the different requirements on screen related to the number of horizontal and
vertical pixels, data line width for the data interface, interface timing, and refresh rate.
The display controller transfers the video data and generates the necessary control signals, such as,
RGB_VSYNC, RGB_HSYNC, RGB_VCLK, RGB_VDEN and SYS_CS0, SYS_CS1, SYS_WE. In addition to
generating control signals, the display controller contains data ports for video data (RGB_VD[23:0], and SYS_VD),
as shown in

这里写图片描述
稍微总结下:
1.支持三种驱动方式的屏幕: RGB类型,i80类型,YUV类型.我们的屏幕属于RGB类型的
2.传送数据的方式:1.通过相机控制总线或者 framebuffer方式传送数据到LCD驱动器.我们使用framebuffer方式.
3.与我们无关:支持5个自带的window,windows的参数:可以调节位置,设置颜色,透明度,调节大小等。
4.LCD控制器支持的颜色编码格式:RGB (1 bpp to 24 bpp) and YCbCr 4:4:4
5.LCD驱动器需要的信号,这个由LCD控制器产生.
RGB_HSYNC:水平同步信号
RGB_VSYNC:垂直同步信号
VCLK:像素时钟.
RGB_VDEN:数据有效信号


编码方式:
我们用的是framebuffer,RGB屏,所以需要了解下这边:
The display controller requests the specified memory format of frame buffer. The table below shows some
examples of each display mode.
这里写图片描述
1. AEN: Specifies the transparency value selection bit.
AEN = 0: Selects ALPHA0.
AEN = 1: Selects ALPHA1.
If per-pixel blending is set, then this pixel blends with alpha value selected by AEN.
Alpha value is selected by SFR as ALPHA0_R, ALPHA0_G, ALPHA0_B, ALPHA1_R, ALPHA1_G, and
ALPHA1_B.
For more information, refer to the section on “SFR”.
2. D [23:16] = Red data, D [15:8] = Green data, and D [7:0] = Blue data.

这里写图片描述

这里写图片描述
1. AEN: Specifies the transparency value selection bit.
AEN = 0: Selects ALPHA0.
AEN = 1: Selects ALPHA1.
If per-pixel blending is set, then this pixel blends with alpha value selected by AEN.
Alpha value is selected by SFR as ALPHA0_R, ALPHA0_G, ALPHA0_B, ALPHA1_R, ALPHA1_G, and ALPHA1_B.
For more information, refer to the section on “SFR”.
2. D [22:15] = Red data, D [14:7] = Green data, and D [6:0] = Blue data.

这里写图片描述

这里写图片描述
1.AEN: Specifies the transparency value selection bit.
AEN = 0: Selects ALPHA0.
AEN = 1: Selects ALPHA1.
If per-pixel blending is set, then this pixel blends with alpha value selected by AEN.
Alpha value is selected by SFR as ALPHA0_R, ALPHA0_G, ALPHA0_B, ALPHA1_R, ALPHA1_G, and ALPHA1_B.
For more information, refer to the section on “SFR”.
2. D [17:12] = Red data, D [11:6] = Green data, and D [5:0] = Blue data

这里写图片描述
后面还有好多种编码方式,就不列出来了.
上述主要讲了下如果使用framebuffer,那么你该如何按照你想要的需求编辑内存中的数据,达到你想要的显示效果?
这边提供了n种方式选择.所谓的bpp指的是bit per pixel.每个像素所需的bit数.
我们拿 32BPP (8888) Mode 这个来讲

首先 先讲像素:
一个像素由 R,G,B三种颜色组成。我们以此为依据来对每个像素进行编码.
再引入一个概念:color depth.通常如果你的显示器是8bit的,那么它理论上能显示的颜色是2^8*2^8*2^8=16.7M
如果你的显示器是10bit的,那么是1073.7M。这样同一张全色彩的图片,你在10bit的显示器上看要比8bit的显示器上要鲜明,漂亮很多。
这里写图片描述
同样,显示器本身有 6bit/8bit/10bit之分。传送的数据信号也是有的。32BPP的数据格式是 XX[R][G][B]
bit dis
32:24 no care
23:16 R data
15:8 G data
7:0 B data
我们就是采用这种编码方式。同样这边的数据信号是8bit的.

这里写图片描述

这里写图片描述
重点来了: 信号的产生和时序
这里写图片描述

这里写图片描述

这里写图片描述

这边全是我们讲的重点,时序看不懂,那就GG。一切免谈。

后面还有timing的标准:VESA标准中,规定了每个常用timing的所有参数的信息。比如我们的显示屏是800*480的。
我们可以输出800*480@30hz或者 800*480@60hz的timing给LCD驱动器.
我们可以看一个timing参数:
这里写图片描述

这里写图片描述

这样讲吧,写一个裸机的LCD的驱动程序还是有一定的难度的。可惜当初研究uboot的时候没有整理笔记。包括现在,我也只是在记笔记,并不是在写博客。一个因为懒,一个因为没耐心,另一个因为知识水平不够.

时序图的话,或许这张比较稍微好看些:
这里写图片描述

这里写图片描述

比如800*600 60hz
Hsync:一个Hsync结束,一行的数据即传输完成,一行有传输600个像素数据,当800个Hync传输结束,800行的数据传输结束。此时,差不多一个Vync结束。
刷新率:1s内画面刷新次数.800*600@60hz代表1s传输60张画面.

猜你喜欢

转载自blog.csdn.net/changliang7731/article/details/53071872