0

I am trying to get ER-TFTM070_5 display with capacitive touch screen to work. I hae gotten as far as getting the screen it self to work. Now I am facing a challenge to get the touch screen digitiser to work. Panel has FT5206 touchscreen controller which should work with edt_ft5x06 kernel module as far as I can tell. Controller is wired to I2C and GPIO17 to CTP_INT interrupt and GPIO27 to CTP_WAKE (which perhaps is not strictly necessary)

I2C device is connected as shown by the probing:

    pi@raspberrypi:~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- 35 -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: 70 -- -- -- -- -- -- --  

I have made a minimalist DTS overlay for the touch screen as found on an other forum:

// Definitions for FocalTech System Touchcontroller by I2C bus.
/dts-v1/;
/plugin/;

/{
        compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

    fragment@0 {
            target = <&i2c1>;
            __overlay__ {
                    status = "okay";
            };
    };

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

    fragment@2 {
            target = <&i2c1>;
            __overlay__ {
                    #address-cells = <1>;
                    #size-cells = <0>;

                    edt_ft5x06: edt_ft5x06@35 {
                            compatible = "edt,edt-ft5x06";
                            reg = <0x35>;
                            pinctrl-names = "default";
                            interrupt-parent = <&gpio>;
                            interrupts = <17 0x8>;
                    };
            };
    };

    __overrides__ {
                addr = <&edt_ft5x06>, "reg:0";
        };
};

I have added also edt_ft5x06 module to /etc/modules-load.d/ft5x06.conf to be loaded on boot time. Overlay by itself should be OK but I had problems getting fbtft_device module to load so I added it manually and it worked...

How ever there are some problems with the module when loading it that can be seen from dmesg:

[    6.880936] [vc_sm_connected_init]: installed successfully
[    6.909969] videodev: Linux video capture interface: v2.00
[    6.957459] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    6.969147] edt_ft5x06 1-0035: touchscreen probe failed
[    6.969228] edt_ft5x06: probe of 1-0035 failed with error -121
[    6.996842] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[    7.009314] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[    

I have not been able to figure out what is that -121 error code referring to. There is nothing at /dev/input except the mice so touchscreen is definitely not working. GPIO17 is free as shown by:

sudo cat /sys/kernel/debug/pinctrl/3f200000.gpio/pinmux-pins
pin 17 (gpio17): (MUX UNCLAIMED) (GPIO UNCLAIMED)

What I am missing here and what is that -121 error code referring to? I tried to to look for it in the kernel module source code but no such luck.

0

Turns out that above DTS file is correct apart from the address that should be 0x38. Wake interrupt line was pulled low and the controller was hibernating hence the 0x35 address. After fixing the interrupt line and correcting the address touchscreen works like it should be. Here is corrected DTS file for reference:

// Definitions for FocalTech System Touchcontroller by I2C bus.
/dts-v1/;
/plugin/;

/{
        compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

        fragment@0 {
                target = <&i2c1>;
                __overlay__ {
                        status = "okay";
                };
        };

        fragment@1 {
                target = <&gpio>;
                __overlay__ {
                        edt_ft5x06_pins: edt_ft5x06_pins {
                                brcm,pins = <17 27>; /* GPIO */
                                brcm,function = <0 1>; /* in */
                                brcm,pull = <2 2>; /* up */
                        };
                };
        };

        fragment@2 {
                target = <&i2c1>;
                __overlay__ {
                        #address-cells = <1>;
                        #size-cells = <0>;

                        edt_ft5x06: edt_ft5x06@38 {
                                compatible = "edt,edt-ft5x06";
                                reg = <0x38>;
                                pinctrl-names = "default";
                                interrupt-parent = <&gpio>;
                                interrupts = <17 0x8>;
                                touchscreen-size-x = <800>;
                                touchscreen-size-y = <480>;
                        };
                };
        };

        __overrides__ {
                addr = <&edt_ft5x06>, "reg:0";
        };
};

Also the error codes shown on dmesg where from I2C subsystem and meaning of the codes can be found from here: https://developer.electricimp.com/resources/i2cerrors

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.