Touch not working on capacitive display with Linux and iMX7

When attempting to use the 7" capacitive display in Linux, I am able to get video to display but the touchscreen does not respond to any touch.

I followed the guides listed below:

https://developer.toradex.com/knowledge-base/first-steps-with-capacitive-touch-display-7-inch-parallel#Colibri_iMX6ULLiMX7

And ran the following commands at Uboot:

setenv vidargs 'video=mxsfb:800x480M-16@60,pixclockpol=1'
saveenv
setenv fdt_fixup 'fdt addr ${fdt_addr_r} && fdt resize && fdt set /soc/aips-bus@30800000/i2c@30a50000/atmel_mxt_ts@4a pinctrl-0 <0x00000043> && fdt set /soc/aips-bus@30800000/i2c@30a50000/atmel_mxt_ts@4a interrupt-parent <0x00000041> && fdt set /soc/aips-bus@30800000/i2c@30a50000/atmel_mxt_ts@4a interrupts <0x00000009 0x00000002> && fdt set /soc/aips-bus@30800000/i2c@30a50000/atmel_mxt_ts@4a status okay && fdt set /soc/aips-bus@30400000/pwm@30670000 status disabled && run fdt_fixup2'
setenv fdt_fixup2 'fdt set /soc/aips-bus@30400000/pwm@30680000 status disabled && fdt set /soc/aips-bus@30000000/iomuxc@30330000/imx7d-eval-v3/touchgpios fsl,pins <0x00000018 0x00000270 0x00000000 0x00000000 0x00000000 0x00000074 0x0000001c 0x00000274 0x00000000 0x00000000 0x00000000 0x00000074>'
saveenv

Followed by: modprobe atmel_mxt_ts after booting into Linux.

I connected the capacitive touch adapter as follows:

Capacitive Touch Adapter pin → Col Evalution board pin

1 → SODIMM_194

2 → SODIMM_196

3 → GND

4 → SODIMM_28

5 → SODIMM_30

6 → 3.3V

If I connect a logic analyzer to the SDA and SCL pins on the back of the display, I see a single i2c word transmitted at system bootup. Later in Linux, I get the following output when trying to detect i2c devices.

root@colibri-imx7-emmc:~# i2cdetect -y -r 3
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- 4a -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Which makes it appear that my touchscreen is connecting to the Linux OS.

What next steps would you recommend to debug this? I was hoping to not need to recompile the device tree yet if that isn’t needed.

hi @dshaffer

Could you share the dmesg log in a file?
What is the output of lsmod?

Have you done any other changes to the Software except the U-Boot changes?

Best regards, Jaski

See attachment for the dmesg log. There are two in there, the first before I run modprobe atmel_mxt_ts and the second from after. The output of lsmod is

root@colibri-imx7-emmc:~# lsmod
Module                  Size  Used by
atmel_mxt_ts           18342  0
usb_f_rndis            16349  2
u_ether                12888  1 usb_f_rndis
mcp251x                 9941  0
can_dev                12106  1 mcp251x
libcomposite           45297  10 usb_f_rndis
configfs               26615  3 usb_f_rndis,libcomposite

And we have not made any other changes to the software beyond the U-Boot changes.

dmesg_output

Here are a couple of images of our hardware setup. The additional probes are for the logic analyzer which we added later in our debugging.

Hardware_Images

Jaski,
I have not compiled a devicetree before, but so far I have seen the following links on your site:

https://developer.toradex.com/device-tree-customization

https://developer.toradex.com/knowledge-base/build-u-boot-and-linux-kernel-from-source-code

Would you recommend I follow these to build a new kernel?

Thanks,
Daniel

hi Daniel

Yeah, you don’t need to build a new kernel but just a new devicetree file (.dtb) with the changes provided in the guide you already followed above.

Best regards, Jaski

I’m struggling to figure out how to make these changes. I’ve cloned the linux source as suggested here onto a Ubuntu virtual machine to use as build environment. And I made the changes to a file called /arch/arm/boot/dts/imx7-colibri-my-carrier.dtsi as suggested here. Can you point me to a guide I should read next? Based on various other questions on the forum I tried the following:

colibri@colibri-VirtualBox:~/toradex-source/linux-toradex$ sudo apt-get install gcc-arm-linux-gnueabihf
colibri@colibri-VirtualBox:~/toradex-source/linux-toradex$ export ARCH=arm
colibri@colibri-VirtualBox:~/toradex-source/linux-toradex$ export CROSS_COMPILE=arm-linux-gnueabihf-
colibri@colibri-VirtualBox:~/toradex-source/linux-toradex$ make colibri_imx7_defconfig
colibri@colibri-VirtualBox:~/toradex-source/linux-toradex$ make dtbs

And now I’m running into issues with the make process finding include files which I can find with a manual search:

colibri@colibri-VirtualBox:~/toradex-source/linux-toradex$ make dtbs
scripts/kconfig/conf  --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     scripts/mod/devicetable-offsets.h
  DTC     arch/arm/boot/dts/imx7d-cl-som-imx7.dtb
In file included from arch/arm/boot/dts/imx7d.dtsi:45:0,
                 from arch/arm/boot/dts/imx7d-cl-som-imx7.dts:15:
arch/arm/boot/dts/imx7s.dtsi:44:43: fatal error: dt-bindings/clock/imx7d-clock.h: No such file or directory
compilation terminated.
scripts/Makefile.lib:313: recipe for target 'arch/arm/boot/dts/imx7d-cl-som-imx7.dtb' failed
make[1]: *** [arch/arm/boot/dts/imx7d-cl-som-imx7.dtb] Error 1
arch/arm/Makefile:341: recipe for target 'dtbs' failed
make: *** [dtbs] Error 2

hi Daniel

I know it is not easy at the beginning.

And I made the changes to a file called /arch/arm/boot/dts/imx7-colibri-my-carrier.dtsi as suggested here

Under the Menu “Colibri iMX7 Instructions” at this link, you can see which files should be changed at which line. It is also possible to create a patch and then apply this to the sources in git.

And now I’m running into issues with the make process finding include files which I can find with a manual search:

For the compilation, you need to install and configure a specific Toolchain as described here.

Once you have done your changes, you can just launch make imx7d-colibri-emmc-eval-v3.dtb.

Best regards,
Jaski

Jaski,

I decided to just try verifying my toolchain was setup correctly, so I followed your link to Build U-Boot and stepped through the process.

  1. Download, extract, and link gcc-linaro
  2. Clone the 2016.11-toradex u-boot and toradex_4.9-2.3.x-imx linux-toradex source
  3. Update $PATH, $ARM, and $CROSS_COMPILE
  4. Install additional dependencies (device-tree-compiler, u-boot-tools, bc, build-essentials, etc)
  5. Change into the u-boot-toradex directory, make colibri_imx7_emmc_defconfig, make -j3 2>&1 | tee build.log, and then get the error shown in the attached file.build.log

It seems to not be able to locate the include file, even though it is located in the include/ directory inside of the u-boot-toradex folder. Have you seen this issue before? I feel like I missed a step in the Build U-Boot instructions, but I read through it several times and didn’t see a step that I’d skipped.

You did almost everything right. The U-Boot folder is just if you want to recompile, which is in general not needed for devicetree compilation. So for the compilation of the devicetree, you should launch the command from the linux source folder after setting up the Environment correctly.

I knew U-Boot would be optional, but I was trying to verify my environment was correct. I can skip the U-Boot test though.

I moved on to the linux source folder and tried to build the default kernel and also the device tree. I didn’t make any changes yet to the device tree, to make sure that the default builds correctly. I did the following:

cd linux-toradex/
make clean
git fetch
git status
make colibri_imx7_defconfig
echo $ARCH; echo $CROSS_COMPILE; echo $PATH
dtc -v
make -j3 zImage 2>&1
make imx7d-colibri-eval-v3.dtb

When I do so, I get the following errors (which are similar to the ones I pointed out earlier):

  CHK     scripts/mod/devicetable-offsets.h
  DTC     arch/arm/boot/dts/imx7d-colibri-eval-v3.dtb
In file included from arch/arm/boot/dts/imx7d.dtsi:45:0,
                 from arch/arm/boot/dts/imx7d-colibri.dtsi:43,
                 from arch/arm/boot/dts/imx7d-colibri-eval-v3.dts:44:
arch/arm/boot/dts/imx7s.dtsi:44:43: fatal error: dt-bindings/clock/imx7d-clock.h: No such file or directory
 #include <dt-bindings/clock/imx7d-clock.h>
                                           ^
compilation terminated.
scripts/Makefile.lib:313: recipe for target 'arch/arm/boot/dts/imx7d-colibri-eval-v3.dtb' failed
make[1]: *** [arch/arm/boot/dts/imx7d-colibri-eval-v3.dtb] Error 1
arch/arm/Makefile:336: recipe for target 'imx7d-colibri-eval-v3.dtb' failed
make: *** [imx7d-colibri-eval-v3.dtb] Error 2

(See attached files for full terminal output if desired build_log)

I still don’t seem to be able to build the device tree, which I’m assuming means that I have something wrong in my environment. However, it seems like I’ve followed all of the pertinent steps in the suggested guides for my board. Do you have any debug steps that I can take?

Thank you,

Daniel

Note: Edited for clarity.

My problems building turned out to be an issue with a bad pull from git. The symbolic links weren’t working properly (similar to this other question). Now I’m working on flashing the touch screen with an updated dtb file as suggested in your other answer here Jaski. Thank you for that post.

After building an updated imx7d-colibri-emmc-eval-v3.dtb file, I’m running into issues when I attempt to load it to the board. My system hangs after showing “Starting kernel …” and fails to continue booting.

The steps I take are:

/* Build the linux device tree and image */
$ cd
$ git clone -b toradex_4.9-2.3.x-imx https://git.toradex.com/linux-toradex.git
$ cd linux-toradex
$ vi arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
$ make colibri_imx7_defconfig
$ make imx7d-colibri-emmc-eval-v3.dtb

/* Build an image file to install on the module w/ Toradex Easy Installer */
$ cd
$ tar -xf colibri-imx7-emmc_lxde-image-tezi_2.7-20180104.tar
$ cd Colibri-iMX7-eMMC_LXDE-Image_2.7/
$ mkdir Colibri-iMX7-eMMC_LXDE-Image.bootfs
$ cd Colibri-iMX7-eMMC_LXDE-Image.bootfs/
$ tar xJf ../Colibri-iMX7-eMMC_LXDE-Image.bootfs.tar.xz
$ cp ~/linux-toradex/arch/arm/boot/dts/imx7d-colibri-emmc-eval-v3.dtb .
$ tar cJf ../Colibri-iMX7-eMMC_LXDE-Image.bootfs.tar.xz *
$ cd ../
$ vi image.json
$ cp -r ../Colibri-iMX7-eMMC_LXDE-Image_2.7/ /media/colibri/USBDISK/

When I look at the file arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi, it doesn’t match the patch listed here. The source I have already lists the interrupt-parent as &gpio1, for example. My source looks like the following after I edit it:

/* the PCAPs use SODIMM 28/30, also used for PWM<B>, PWM<C>, aka pwm2, pwm3.
   so if you enable one of the PCAP controllers disable the pwms */
    /* Atmel maxtouch controller */
    atmel_mxt_ts: atmel_mxt_ts@4a {
        compatible = "atmel,maxtouch";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_gpiotouch>;
        reg = <0x4a>;
        interrupt-parent = <&gpio1>;
        interrupts = <9 IRQ_TYPE_EDGE_FALLING>; /* SODIMM 28 */
        reset-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; /* SODIMM 30 */
        status = "okay";
    };

/* ..................... more code here .........................*/

/* the PCAPs use SODIMM 28/30, also used for PWM<B>, PWM<C>, aka pwm2, pwm3.
   so if you enable one of the PCAP controllers disable the pwms */
&pwm2 {
    status = "disabled";
};

&pwm3 {
    status = "disabled";
};

Should I just be building and copying the ~/linux-toradex/arch/arm/boot/dts/imx7d-colibri-emmc-eval-v3.dtb file like I am; or do I actually need to build more of the kernel like the zimage or something else?

Thanks,

Daniel

Edit: The last commit in the repository I am using is from Dec. 17, 2018 and is commit 5758a8e648a3947d974fbcaad49db6e513a77a9d. I’m assuming I have a different commit than is being referenced in the linked instructions.

hi @dshaffer

You are mixing things up.

git clone -b toradex_4.9-2.3.x-imx

This is the branch for Bsp 2.8b5.

cp -r …/Colibri-iMX7-eMMC_LXDE-Image_2.7

Here you are using Bsp 2.7.

So either you checkout the branch toradex_4.1-2.0.x-imx if you want to use Bsp 2.7 or you update to Bsp 2.8b5 and use the device tree (.dtb) you compiled with the branch 4.9-2.3.

Best regards, Jaski

Thank you Jaski, that fixed my errors. The screen is working now and responding to touches. I don’t see a way to promote your response to an answer, so if I don’t see you promote it yourself shortly I’ll write up an answer of my own incorporating your fixes.

Thanks,
Daniel

Thanks for the Information and the files.

I was hoping to not need to recompile the device tree yet if that isn’t needed.

Actually the idea of fdt_fixup was to provide a simple solution without compiling the devicetree, but Unfortunately this is only working with a specific software version. So overall it is not a proper solution. I would recommend you to recompile the devicetree.

Sorry for the inconvenience.

Best regards, Jaski

Perfect that it works. Thanks for the feedback.