一 说明
不带GPU功能,只能使用linuxFB方式运行QT程序
STM32MP15-Ecosystem-v2.1.0 release
tf-a-stm32mp-2.2.r2-r0
u-boot-stm32mp-2020.01.r2-r0
linux-stm32mp-5.4.56-r0
Buildroot: buildroot-2021.02.10
tslib: tslib-1.22
qt-everywhere-src-5.12.10
qt-opensource-linux-x64-5.12.10.run
Arm GNU Toolchain: gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf
二 屏幕驱动
屏幕是800x480的RGB-LCD,与开发板的硬件接口与ST官方开发板STM32MP157-EVAL的RGB-LTDC接口引脚一致。
首先修改设备树文件arch/arm/boot/dts/stm32mp157d-custom.dts:
根节点添加panel_backlight和panel_rgb节点
/ {
......
panel_backlight: panel-backlight {
compatible = 'pwm-backlight';
pwms = <&pwm4 1 5000000>;
brightness-levels = <0 32 64 96 128 160 192 224 255>;
power-supply = <&v3v3>;
default-brightness-level = <7>;
status = 'okay';
};
panel_rgb: panel-rgb {
compatible = 'custom,rgb-lcd5';
backlight = <&panel_backlight>;
status = 'okay';
port {
rgb_panel_in: endpoint {
remote-endpoint = <<dc_ep0_out>;
};
};
};
......
};
<dc节点追加内容如下:
<dc {
pinctrl-names = 'default', 'sleep';
pinctrl-0 = <<dc_pins_b>;
pinctrl-1 = <<dc_pins_sleep_b>;
status = 'okay';
port {
#address-cells = <1>;
#size-cells = <0>;
ltdc_ep0_out: endpoint@0 {
reg = <0>;
remote-endpoint = <&rgb_panel_in>;
};
};
};
接着修改设备树文件arch/arm/boot/dts/stm32mp157d-custom.dtsi:
&timers4节点追加用于控制屏幕背光的内容如下
&timers4 {
status = 'okay';
/* spare dmas for other usage */
/delete-property/dmas;
/delete-property/dma-names;
pwm4: pwm {
pinctrl-0 = <&pwm4_pins_b>;
pinctrl-1 = <&pwm4_sleep_pins_b>;
pinctrl-names = 'default', 'sleep';
#pwm-cells = <2>;
status = 'okay';
};
};
接着修改屏幕驱动文件drivers/gpu/drm/panel/panel-simple.c:
platform_of_match数组中添加自己屏幕的匹配数据
static const struct of_device_id platform_of_match[] = {
......
{
.compatible = 'custom,rgb-lcd5',
.data = &custom_rgb_lcd5_desc,
},{
/* sentinel */
}
};
添加自己屏幕的时序参数及相关描述信息
static const struct drm_display_mode custom_rgb_lcd5_mode = {
.clock = 33300, /* LCD像素时钟,单位:KHz */
.hdisplay = 800, /* LCD X轴像素个数 */
.hsync_start = 800 + 88, /* LCD X轴 + hbp 像素个数 */
.hsync_end = 800 + 88 + 48, /* LCD X轴 + hbp + hspw 像素个数*/
.htotal = 800 + 88 + 48 + 40, /* LCD X轴 + hbp + hspw + hfp */
.vdisplay = 480, /* LCD Y轴像素个数 */
.vsync_start = 480 + 32, /* LCD Y轴 + vbp 像素个数 */
.vsync_end = 480 + 32 + 3, /* LCD Y轴 + vbp + vspw 像素个数 */
.vtotal = 480 + 32 + 3 + 13, /* LCD Y轴 + vbp + vspw + vfp */
.vrefresh = 60, /* LCD刷新率,单位:HZ */
.flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
};
static const struct panel_desc custom_rgb_lcd5_desc = {
.modes = &custom_rgb_lcd5_mode,
.num_modes = 1,
.bpc = 8,
.size = {
.width = 117,
.height = 67,
},
.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
};
三 触摸驱动
我手上开发板配套的RGB-LCD使用的触摸芯片型号为GT9147,通信接口使用的是开发板的i2c2,除此之外还有RST复位引脚和IRQ中断引脚。为了使Linux内核匹配该设备驱动,需要修改arch/arm/boot/dts/stm32mp157d-custom.dts设备树文件。在&i2c2节点下追加如下内容:
&i2c2 {
pinctrl-names = 'default', 'sleep';
pinctrl-0 = <&i2c2_pins_a>;
pinctrl-1 = <&i2c2_pins_sleep_a>;
i2c-scl-rising-time-ns = <185>;
i2c-scl-falling-time-ns = <20>;
clock-frequency = <400000>;
status = 'okay';
/* spare dmas for other usage */
/delete-property/dmas;
/delete-property/dma-names;
goodix_ts: gt9147@14 {
compatible = 'goodix,gt9147';
reg = <0x14>;
interrupt-parent = <&gpioe>;
interrupts = <1 IRQ_TYPE_EDGE_RISING>;
irq-gpios = <&gpioe 1 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpioa 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
status = 'okay';
};
};
Linux源码中已有gt9147的驱动文件drivers/input/touchscreen/goodix.c,只需要配置内核使能该驱动即可。该驱动文件匹配列表如下:
static const struct of_device_id goodix_of_match[] = {
{ .compatible = 'goodix,gt1151' },
{ .compatible = 'goodix,gt5663' },
{ .compatible = 'goodix,gt5688' },
{ .compatible = 'goodix,gt911' },
{ .compatible = 'goodix,gt9110' },
{ .compatible = 'goodix,gt912' },
{ .compatible = 'goodix,gt927' },
{ .compatible = 'goodix,gt9271' },
{ .compatible = 'goodix,gt928' },
{ .compatible = 'goodix,gt967' },
{ .compatible = 'goodix,gt9147',},
{ }
};
四 测试显示和触摸
4.1 配置Linux
1、使能DRM(Direct Rendering Module)驱动(st源码默认配置已使能配置)
Device Drivers --->
Graphics support --->
<*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) --->
<*> DRM Support for STMicroelectronics SoC Series
Display Panels --->
<*> support for simple panels
Backlight & LCD device support --->
<*> Generic PWM based Backlight Driver
开启DRM驱动的传统FB(FrameBuffer)框架:
Device Drivers --->
Graphics support --->
<*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) --->
[*] Enable legacy fbdev support for your modesetting driver
2、使能Goodix I2C触摸芯片驱动(st源码默认配置已使能配置)
Device Drivers --->
Input device support --->
[*] Touchscreens --->
<*> Goodix I2C touchscreen
4.2 配置Buildroot
1、使能libdrm库用来调用DRM驱动测试屏幕
Target packages --->
Libraries --->
Graphics --->
[*] libdrm --->
[*] Install test programs
2、使能evtest用来测试触摸
Target packages --->
Hardware handling --->
[*] evtest
3、使能字库(后面配置Qt环境变量会用到,否则后面在开发板运行软件会无法正常显示字符)
Target packages --->
Fonts, cursors, icons, sounds and themes --->
[*] DejaVu fonts
[*] mono fonts (NEW)
[*] sans fonts (NEW)
[*] serif fonts (NEW)
[*] sans condensed fonts (NEW)
[*] serif condensed fonts (NEW)
配置完成后重新make然后接下来使用新编译的文件系统启动开发板进行测试。
4.3 测试
4.3.1 屏幕测试
使用modetest测试屏幕显示。查看该命令使用帮助如下:
# modetest --help
usage: modetest [-acDdefMPpsCvrw]
Query options:
-c list connectors
-e list encoders
-f list framebuffers
-p list CRTCs and planes (pipes)
Test options:
-P -s -C test hw cursor -v test vsynced page flipping -r set the preferred mode for all connectors -w -a use atomic API -F pattern1,pattern2 specify fill patterns Generic options: -d drop master after mode set -M module use the given driver -D device use the given device Default is to dump all info. 直接执行modetest命令会自动扫描并尝试打开显示设备,如下: # modetest ...... trying to open device 'amdgpu'...failed trying to open device 'imx-drm'...failed trying to open device 'virtio_gpu'...failed ...... trying to open device 'stm'...done Encoders: id crtc type possible crtcs possible clones 31 35 DPI 0x00000001 0x00000000 Connectors: id encoder status name size (mm) modes encoders 32 31 connected DPI-1 117x67 1 31 modes: index name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot #0 800x480 64.62 800 888 936 976 480 512 515 528 33300 flags: phsync, pvsync; type: preferred, driver props: 1 EDID: flags: immutable blob blobs: value: 2 DPMS: flags: enum enums: On=0 Standby=1 Suspend=2 Off=3 value: 0
上一篇:STM32MP157构建OpenSTLinux的QT镜像和SDK
下一篇:STM32MP157开发板调试笔记
推荐阅读最新更新时间:2026-03-25 11:35
- 用于 7VIN 至 16VIN、1.5V 和 1.2V 输出的 LTM4628EV DC/DC 模块稳压器的典型应用电路
- 使用 Analog Devices 的 LTC3728LIGN 的参考设计
- DER-406 - 适用于 A19 灯的 5.76 W 高 PF 非隔离降压-升压型 TRIAC 调光 LED 驱动器
- ADR5045B 5V 输出精密微功率并联模式电压基准的典型应用
- LT3970EDDB-3.42 2.5V 降压转换器的典型应用
- MC78M08BDTG 8V 电流调节器的典型应用
- LT1021DCN8-5 精密电压基准的典型应用
- DER-282 - 100W, 扁平(11 mm), LLC DC-DC转换器
- REF193 低压差开尔文连接电压基准的典型应用电路
- LT3088EM 线性稳压器用于添加软启动的典型应用



DS1000Z数字示波器中文使用说明
【Follow me第三季第4期】英飞凌CY8CPROTO-063-BLE开发板全任务实战源码
非常经典的关于LLC的杨波博士论文
XC6406PP60DL






京公网安备 11010802033920号