为 Raspberry pi 3b+

问题描述

我在让我的触摸屏与我的树莓派一起工作时遇到了一些麻烦,我相信我已经很接近了。任何建议都会很棒!我正在使用带有 mxT640U 和 RaspBerry pi 3b+ 的触摸屏,内核是 5.10.17-v7+。有人告诉我使用这里提供的 Atmel linux 设备驱动程序:

https://github.com/atmel-maxtouch/linux/blob/maxtouch-v3.14/drivers/input/touchscreen/atmel_mxt_ts.c

我已经写了一个参考树莓派文档的设备覆盖,像这样在引脚 13 上复位并在 19 上中断: 请注意,我已经尝试了各种目标,因为我希望最终使用软件 I2C,因为我的引脚 2 和 3 已经被使用了,尽管起初我想让它与硬件引脚一起使用。当我使用 或 进行编译时,我在 dmesg 中收到一条消息:“正在加载树外模块污点内核。”当我使用 时,我没有收到此消息。我不确定这是为什么,我假设它与我的问题有关。

/dts-v1/;
/plugin/;
/ {
        compatible = "brcm,bcm2835";
        fragment@0 {
                target = <&i2c_arm>;
                __overlay__ {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        status = "okay";
                        atmel_mxt_ts@4c {
                                compatible = "atmel,atmel_mxt_ts";
                                reg = <0x4c>;
                                reset-gpios = <&gpio 13 0>;
                                interrupt-parent = <&gpio>;
                                interrupts = <19 2>; /* Falling edge only */
                                pinctrl-names = "default";
                                pinctrl-0 = <&mxtPins>;
                        };
            
                };
        };

        fragment@1 {
            target = <&gpio>;
            __overlay__ {
                mxtPins: mxtPinsi {
                    brcm,pins = <19>;
                    brcm,function = <0>; /* in */
                    brcm,pull = <2>; /* up pull */
                };
            };
        };
};

我已经编译了这棵树:

sudo dtc -O dtb -o atmel-mxt-ts.dtbo -b 0 -@ atmel-mxt-ts.dts

在 /boot/overlays 目录中并将其添加到我的 config.txt 中:

dtparam=i2c_arm=on
dtoverlay=atmel-mxt-ts

这是 sudo vcdbg log msg 的输出

001586.682: brfs: File read: /mfs/sd/overlays/overlay_map.dtb
001658.158: brfs: File read: 1523 bytes
001660.969: brfs: File read: /mfs/sd/config.txt
001661.530: dtparam: i2c_arm=on
001669.836: dtparam: i2c_arm_baudrate=100000
001678.417: brfs: File read: 2182 bytes
001688.908: brfs: File read: /mfs/sd/overlays/atmel-mxt-ts.dtbo
001697.064: Loaded overlay 'atmel-mxt-ts'
001697.193: dtparam: audio=on

我尝试过在启动后手动安装模块以及在启动期间使用以下 Makefile 安装模块。

obj-m+=atmel_mxt_ts.o
KDIR ?= "/lib/modules/$(shell uname -r)/build"

all:
    $(MAKE) -C "$(KDIR)" M="$(CURDIR)" modules
install:
    $(MAKE) -C "$(KDIR)" M="$(CURDIR)" modules_install
    depmod -A
clean:
    $(MAKE) -C "$(KDIR)" M="$(CURDIR)" clean

这似乎无关紧要,在两种情况下都会给我同样的错误

[    6.940569] atmel_mxt_ts: loading out-of-tree module taints kernel.
[    6.953920] atmel_mxt_ts 1-004c: Resetting chip
[    8.074320] atmel_mxt_ts 1-004c: __mxt_write_reg_crc: i2c send Failed (-5)
[    8.074347] atmel_mxt_ts 1-004c: Bootloader address: 26
[    8.074588] atmel_mxt_ts 1-004c: mxt_bootloader_read: i2c recv Failed (-121)
[    8.074605] atmel_mxt_ts 1-004c: Trying alternate bootloader address
[    8.074620] atmel_mxt_ts 1-004c: Bootloader address: 26
[    8.074857] atmel_mxt_ts 1-004c: mxt_bootloader_read: i2c recv Failed (-121)
[    8.075147] atmel_mxt_ts: probe of 1-004c Failed with error -121

当我在驱动程序中定义调试时,我会得到一些初始 crc 检查的打印件。我相信这是在触摸屏的配置上。这是否意味着触摸屏未编程?

[51854.376226] atmel_mxt_ts 1-004c: Got Reset GPIO
[51854.376749] atmel_mxt_ts 1-004c: Direction is ouput
[51854.376769] atmel_mxt_ts 1-004c: Resetting chip
[51855.512094] atmel_mxt_ts 1-004c: Reg address 0
[51855.512122] atmel_mxt_ts 1-004c: Write CRC: Data[0] = 0,crc = 0x0
[51855.512139] atmel_mxt_ts 1-004c: Write CRC: Data[1] = 0,crc = 0x0
[51855.512155] atmel_mxt_ts 1-004c: Write CRC: Data[2] = 0,crc = 0x0
[51855.512410] atmel_mxt_ts 1-004c: __mxt_write_reg_crc: i2c send Failed (-5)
[51855.512431] atmel_mxt_ts 1-004c: Bootloader address: 26
[51855.512670] atmel_mxt_ts 1-004c: mxt_bootloader_read: i2c recv Failed (-121)
[51855.512686] atmel_mxt_ts 1-004c: Trying alternate bootloader address
[51855.512701] atmel_mxt_ts 1-004c: Bootloader address: 26
[51855.512941] atmel_mxt_ts 1-004c: mxt_bootloader_read: i2c recv Failed (-121)
[51855.513147] atmel_mxt_ts: probe of 1-004c Failed with error -121

最后为了完整起见,这里是 i2cdetect -y 1 的输出(这是没有加载驱动程序,在我看来,当驱动程序无法初始化时,它会将重置引脚设置为高电平,从而切断触摸屏 i2c 芯片的电源):

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- 4c -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

先谢谢你,如果我能提供任何额外的调试信息,请告诉我。

最好的, 欧文

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)