因为这款arm属于开源项目,很多资料网上都有,废话不说,这里直接讲调试时遇到的问题。
我用的GT911采用标准I2C通信方式,从机地址一般是0x5d或者0x14供使用者选择。通过i2c-tools调试工具发现的第一个问题就是扫不到设备。通过询问硬件工程师询问知道i2c是挂在1组上,修改设备树也扫不到,后来发现是i2c的接口松动,大乌龙。
第二个问题就是在CRT串口上重复性的打印一些错误信息如图:
[ 449.776201] read strings
[ 450.783483] dwc3 fcc00000.dwc3: device reset
[ 450.783639] android_work: did not send uevent (0 0 (null))
[ 450.830457] android_work: did not send uevent (0 0 (null))
[ 451.906228] ffs_data_put(): freeing
[ 451.916406] read descriptors
[ 451.916457] read strings
这些错误信息是因为烧写线在烧写完之后还没有拔掉导致的,拔掉就好了。
第三个遇见的问题是触摸功能不可用,修改设备树添加/修改节点和配置menuconfig。
我的设备树文件放在SDK的kernel/arch/arm64/boot/dts/rockchip的目录下
添加/修改rk3568-evb.dtsi:
&i2c1 {
//status = "disabled";//hujl add 2022.11.20
status = "okay";
pinctrl-names = "default";
//pinctrl-0 = <&i2c1m0_up_xfer>;
clock-frequency = <400000>;
i2c-scl-rising-time-ns = <138>;
i2c-scl-falling-time-ns = <4>;
gt9xx: gt9xx@14 {
//gt9xx: gt9xx_ts@14 {
compatible = "goodix,gt9xx";
reg = <0x14>;
interrupt-parent = <&gpio0>;
interrupts = <RK_PB5 IRQ_TYPE_LEVEL_LOW>;
pinctrl-names = "default", "int-output-low","int-output-high", "int-input";
pinctrl-0 = <&ts_int_default>;
pinctrl-1 = <&ts_int_output_low>;
pinctrl-2 = <&ts_int_output_high>;
pinctrl-3 = <&ts_int_input>;
reset-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>;
touch-gpio = <&gpio0 RK_PB5 IRQ_TYPE_EDGE_RISING>;
status = "ok";
tp-size = <911>;
//tp-supply = <&vcc3v0_tp>;
//tp-supply = <&vcc_tp>;
max-x = <272>; //480
max-y = <480>; //272
touchscreen-inverted-x;// 新添加
touchscreen-swapped-x-y;// 新添加
touchscreen-max-id = <11>;
touchscreen-size-x = <1024>;
touchscreen-size-y = <600>;
touchscreen-max-w = <512>;
touchscreen-max-p = <512>;
touchscreen-key-map = <172>, <158>; /*KEY_HOMEPAGE=172, KEY_BACK=158,
KEY_MENU=139*/
goodix,slide-wakeup = <0>;
goodix,type-a-report = <0>;
goodix,driver-send-cfg = <0>;
goodix,resume-in-workqueue = <0>;
goodix,int-sync = <1>;
goodix,swap-x2y = <0>;
goodix,esd-protect = <1>;
goodix,auto-update-cfg = <0>;
goodix,power-off-sleep = <0>;
goodix,pen-suppress-finger = <0>;
goodix,cfg-group0 = [
53 D0 02 00 05 05 F5 D5 21 48 2D 0F 5A 41 0E 05 00 00 32 32 20 00 05 14 14 1A 14 8B 2B 00
];
};
};
在pinctrl的节点里添加
gt9xx {
ts_int_default: ts-int-default {
rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>; //int
};
ts_int_output_low: ts-int-output-low {
rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_output_low_pull_up>;
};
ts_int_output_high: ts-int-output-high {
rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_output_high_pull_up>;
};
ts_int_input: ts-int-input {
rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
tp {
tp_gpio: tp-gpio {
rockchip,pins =
<0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>,
<0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
vcc-tp {
vcc_tp_en: vcc-tp-en {
rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
格式可能有点问题,需要再修饰一下。
在kernel目录下执行make ARCH=arm64 menuconfig进入config图形化配置界面:
---Device Drivers
--->Input device support
---->Touchscreens下选中(空格)
<*>Atmel mXT I2C Touchscreen和<*>Goodix gt9xx support for rockchip platform,他其他的全部关掉,退出后重新编译把boot.img烧写进板子里即可。
第五个问题目前还没有解决,关于触摸屏触摸错位的,希望如果有大佬明白关键点在哪儿的,还请不吝赐教。问题是:左上和右下两角按键误差不大但存在误差,有些影响手感,另外几个按键按照左上右下的对称轴呈现对称反转的触摸点,是错误的。讲起来有些抽象,但实际情况很直观,
大概长这样,AD触摸没问题,点B按键C有反应,点C按键B有反应,所以是关于左上右下的一个轴对称反转,总之就是触摸有问题。参考网上的一些文章和代码,作者做了三个方向的修改,但都以失败结束。其实感觉
1.vi打开 /etc/xdg/weston/weston.ini在最后添加了
[output]
name=DSI-1
transform=180
保存重启以后,现象没有发生变化,还是触摸有问题。
2.修改设备树代码:
在SDK/kernel/arch/arm64/boot/dts/rockchip路径下rk3568-evb.tdsi设备树文件,在我用到的i2c设备树节点内添加以下属性:
//touchscreen-inverted-x;// 新添加
//touchscreen-inverted-y;//
touchscreen-swapped-x-y;// 新添
这三行代码来回注释,均无效
3.修改了驱动代码:
在SDK/kernel/drivers/input/touchscreen/gt9xx路径下 gt9xx.c文件修改了
static u8 gtp_change_x2y = TRUE;
static u8 gtp_x_reverse = FALSE;
static u8 gtp_y_reverse = TAUE;
这三个TRUE和FALSE也是换着改,仍然没有效果