一 說明
不帶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開發板調試筆記
推薦閱讀最新更新時間:2025-03-26 17:39




設計資源 培訓 開發板 精華推薦
- 迅為IMX6開發板Android應用-AndroidStudio-calculator測試
- 玩轉 ESP32 + Arduino (二十) SIM800L上傳數據到OneNet(新版Mqtts)
- 玩轉 ESP32 + Arduino (二十一) SPIFFS文件系統 (已棄用)
- 玩轉 ESP32 + Arduino (二十二) SIM800L上傳數據到阿里IOT(溫濕度和LBS)(NTP對時)
- 玩轉 ESP32 + Arduino (二十三) 多文件系統及全局變量
- 玩轉 ESP32 + Arduino (二十四) SD卡讀寫
- 玩轉 ESP32 + Arduino (二十五) SSD1306庫驅動OLED
- 玩轉 ESP32 + Arduino(二十六) 按鍵控制庫 OneButton
- 玩轉 ESP32 + Arduino(二十七) ESP對象
- 0.9 至 3.3V DC 至 DC 便攜式單路輸出電源
- LTC3412A,一個 2.5V、4A 降壓型穩壓器,在突發模式操作中
- LT1021CIN8-5 負串聯電壓基準的典型應用
- 具有遠程感應功能的 LTC3649EFE 5Vout 降壓型穩壓器的典型應用電路
- NCP301LSN18T1 1.8V 窗口電壓檢測器的典型應用
- 基于米爾6ull核心板的底板
- LTC3555EUFD-3 高效電源路徑管理器和三路降壓穩壓器的典型應用電路
- 基于SPV1050能量收集器和電池充電器的薄膜太陽能智能手表
- LT3472EDD 演示板,升壓型 DC/DC 轉換器,Vin = 2.7V - 4.2V,Vout1 = 15V @ 25mA-45mA Vout2 = -8V @ 35mA-65mA
- 使用 Analog Devices 的 LT1328 的參考設計