Toradex 7" capacitive touch on viola / imx8x

Hi I have been trying to get your 7” Capacitive Touch Display to work with the viola Carrier board and Colibri IMX8QXP.

But have not yet gotten it to work and I’m running out of ideas on what could be wrong ^^
Just to be clear the display works fine it’s just the touch that do not currently work for me.
It works fine using the Aster carrier board with the Toradex provided overlay but it seems I must be making some mistake somewhere when I try to get It to work on the Viola.
I’m passing the entire dmesg as a file as well but down below I’m passing just the error, how the cables are connected and the overlay I’ve created hopefully you’ll be able to discern if I’ve done any mistake. ^^

This is the error I get when I use dmesg

[    5.644590] atmel_mxt_ts 18-004a: __mxt_read_reg: i2c transfer failed (-5)
[    5.644766] atmel_mxt_ts 18-004a: mxt_bootloader_read: i2c recv failed (-5)
[    5.644778] atmel_mxt_ts 18-004a: Trying alternate bootloader address
[    5.644937] atmel_mxt_ts 18-004a: mxt_bootloader_read: i2c recv failed (-5)
[    5.645132] atmel_mxt_ts: probe of 18-004a failed with error -5

dmesg full log

I followed your instructions for the touch adapter and you can see my wiring bellow.

X1, Pin 1: I2C_SDA X9, Pin 6: I2C_SDA
X1, Pin 2: I2C_SCLX9, Pin 5: I2C_SCL
X1, Pin 3: GNDX9, Pin 7: GND
X1, Pin 4: TOUCH_INT#X9, Pin 42: SODIMM_28 (PWM_B)
X1, Pin 5: TOUCH_RESET#X9, Pin 43: SODIMM_30 (PWM_C)
X1, Pin 6: +3.3VX9, Pin 4: +3.3V

This is the custom overlay I’ve written. It’s based on the ATMEL-MXT one provided by you.
custom overlay dtsfile.

We are currently running Torizon version 4

At your overlay source file you have

 interrupts = <21 IRQ_TYPE_EDGE_FALLING>;            /* SODIMM 107 */
 reset-gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;         /* SODIMM 106 */

Why does your comments say SODIMM 106/107? You need SODIMM_28/30

Could you try nightly Torizon 5.2 build? It has a pre-built overlay for touch adapter- colibri-imx8x_atmel-mxt-adapter_overlay.dtbo . Please check this article for details.

Could you try nightly Torizon 5.2 build? It has a pre-built overlay for touch adapter- colibri-imx8x_atmel-mxt-adapter_overlay.dtbo .

Your modifications should be correct based on the older 4.0 device tree. Just as a sanity check can you try a Torizon 5.2 build and apply this overlay: http://git.toradex.com/cgit/device-tree-overlays.git/tree/overlays/colibri-imx8x_atmel-mxt-adapter_overlay.dts?h=toradex_5.4-2.3.x-imx

This is specific for the capacitive touch adapter and should work. If it doesn’t then maybe we need to re-review your hardware connections.

Also by the way is there a reason you’re on Torizon 4.0? That version has been deprecated and much of our current tooling and such no longer works with 4.0.

Best Regards,
Jeremias

Greetings @Masj,

Can you confirm that you’re on Torizon 4.0. The reason I ask is cause in your question you also provided that you’re on the Colibri i.MX8X version 1.0D, correct? As far as I’m aware we never released a version of Torizon 4.0 that was compatible with revision 1.0D.

Next question which specific overlay of ours did you base your overlay on? If you are on Torizon 4.0 then we have an old reference overlay that should work here: http://git.toradex.com/cgit/device-tree-overlays.git/tree/overlays/colibri-imx8x_atmel-mxt_overlay.dts?h=toradex_4.14-2.3.x-imx

Notice the kernel branch 4.14-2.3.x-imx which should match the kernel we used back on 4.0.

Best Regards,
Jeremias

I can confirm that I’m using Torizon 4.0 we are using it on both revision D and earlier releases.
It will require a different source during the project init, but the source for revision D has been available since long before we got our hands on a hand on a chip with revision D.
It works and behaves just like the older revisions so getting this to work on revision B is fine as well.

We used the overlay you linked. It is made for the aster carrier board, and it works fine on them.
In order to get them to work with the viola which do not have the same pins available as the aster board.
I understood it like i had to do the following changes.
Had to change the Interrupts

from
20 IRQ_TYPE_EDGE_FALLING
to
21 IRQ_TYPE_EDGE_FALLING

I changed the reset-gpios as the new pinns where under another gpio group

from 
&gpio3 24 GPIO_ACTIVE_HIGH
to 
&gpio0 22 GPIO_ACTIVE_HIGH

in the pinctrl_mxt_ts i set the pinns to the following

SC_P_UART1_TX_LSIO_GPIO0_IO21  0x20
SC_P_UART1_RX_LSIO_GPIO0_IO22  0x20

and i had to set status disabled for &pwm0, &pwm1 as they otherwise are conflicting.
I don’t know if there is anything else i need to change inorder to get the touch adapter up an working?

Alright I’ll do a sanity check with Torizon 5.2 but I have some questions regarding TorizonCore-Builder.

I find the instructions a bit lacking is it supposed to be deployed on my docker host?
if so then it is complaining about a lack of an arm64/8 release, to download and run.

If it is supposed to run on my development machine then I’m lacking the file structure as It runs but fails as it expects a certain folder structure and certain files which are not available.
dt checkout crashes and dt apply crashes logicically as there is no such target directory on my development machine.

The TorizonCore-Builder dt command should have an build or validate function as I might not always want to deploy the change. just check if it is valid/builds, just a suggestion for future releases.

Yes the Builder tool is mean to run on a development host with Docker capabilities. I’m unsure of the errors you’re referring to without seeing the full error messages.

As for your feedback, dto apply will build and prep the overlay for deployment but it won’t actually deploy the changes till you use the deploy command.

Best Regards,
Jeremias

Thanks it seems that I missed the dto command.
I’m given the following error when running the dt/dto command. I’ve tried to setup the directory tree structure and the find command can locate it but it still triggers the following fault.

torizoncore-builder dto apply device-trees/overlays/colibri-imx8x_atmel_2-mxt_overlay.dts
Triggers:

find: ‘/storage/sysroot/ostree/deploy’: No such file or directory
An unexpected Exception occured. Please provide the following stack trace to
the Toradex TorizonCore support team:


Traceback (most recent call last):
  File "/builder/torizoncore-builder", line 173, in <module>
    mainargs.func(mainargs)
  File "/builder/tcbuilder/cli/dto.py", line 123, in do_dto_apply
    dto_apply_cmd(dtos_path=args.dtos_path,
  File "/builder/tcbuilder/cli/dto.py", line 44, in dto_apply_cmd
    applied_overlay_basenames = dto.get_applied_overlays_base_names(storage_dir)
  File "/builder/tcbuilder/backend/dto.py", line 28, in get_applied_overlays_base_names
    overlays_txt_path = get_active_overlays_txt_path(storage_dir)
  File "/builder/tcbuilder/backend/dto.py", line 13, in get_active_overlays_txt_path
    path = os.path.join(dt.get_dt_changes_dir(storage_dir), dt.get_dtb_kernel_subdir(storage_dir), "overlays.txt")
  File "/builder/tcbuilder/backend/dt.py", line 77, in get_dtb_kernel_subdir
    answer = subprocess.check_output(f"set -o pipefail && find {storage_dir}/sysroot/ostree/deploy -type d -name dtb -print -quit | sed -r -e 's|.*/(usr/lib/modules/)|\\1|'", shell=True, text=True).strip()
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'set -o pipefail && find /storage/sysroot/ostree/deploy -type d -name dtb -print -quit | sed -r -e 's|.*/(usr/lib/modules/)|\1|'' returned non-zero exit status 1.

Maybe I should create a new thread for this but I’ve also had problems with the version of Torizon 5 you’re currently providing on your guide page. knowledge-base/build-torizoncore
I’ve had Torizon 5 up and running before but the version referred to in your guide seems to be broken for the imx8x. I’m doing a clean installation and only tries to build the provided default torizon-core-docker and the following error occurs a while into the build process.

ERROR: Task (/home/developer/yocto-torizon-5/build/conf/../../layers/meta-toradex-nxp/recipes-kernel/linux/linux-toradex_5.4-2.3.x.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3963 tasks of which 1717 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 6 seconds

Summary: 1 task failed:
  /home/developer/yocto-torizon-5/build/conf/../../layers/meta-toradex-nxp/recipes-kernel/linux/linux-toradex_5.4-2.3.x.bb:do_compile
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.

For the TorizonCore Builder issue you first need to use the images command to unpack a Torizon image as described here: https://developer.toradex.com/knowledge-base/torizoncore-builder-tool#Getting_a_Toradex_Easy_Installer_image

Otherwise the tool won’t know what OS image you intend to apply your changes onto.

As for the Yocto build issue. Is there anymore info on what exactly the error was? Also are you building based on the default.xml? According to our recent builds internally there shouldn’t be any known issues with the builds. So I’m not quite sure what’s going on to have caused an issue here.

Best Regards,
Jeremias

Ah thanks that solved everything, you should add a warning explaining that you need to setup an image instead of crashing.

Yes I’ve just used everything default it is a fresh fetch on a freshly installed ubuntu 20.04. No changes to the repo whatsoever.

I’ve done a sanity check now on 5.2 but the same error as on Torizon 4 returns

Updated recipe for Torizon 5

/dts-v1/;
/plugin/;

#include "dt-bindings/interrupt-controller/irq.h"
#include "dt-bindings/gpio/gpio.h"
#include "dt-bindings/pinctrl/pads-imx8qxp.h"

/ {
        compatible = "toradex,colibri-imx8x";
};

&i2c1 {
        #address-cells = <1>;
        #size-cells = <0>;
        status = "okay";
        /* Atmel maxtouch controller */
        atmel_mxt_ts: atmel_mxt_ts@4a {
                compatible = "atmel,maxtouch";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_mxt_ts>;
                reg = <0x4a>;
                interrupt-parent = <&lsio_gpio0>;
                interrupts = <21 IRQ_TYPE_EDGE_FALLING>;                /* SODIMM 28 */
                reset-gpios = <&lsio_gpio0 22 GPIO_ACTIVE_HIGH>;        /* SODIMM 30 */
                status = "okay";
        };
};

&iomuxc {
        colibri-imx8qxp {
                pinctrl_mxt_ts: mxt-ts {
                        fsl,pins = <
                                IMX8QXP_UART1_TX_LSIO_GPIO0_IO21                0x4000021       /* SODIMM  28 */
                                IMX8QXP_UART1_RX_LSIO_GPIO0_IO22                0x21            /* SODIMM  30 */
                        >;
                };
        };
};


&pwm0 {
        status = "disabled";
};

&pwm1 {
        status = "disabled";
};

I did take the value 0x4000021 from imx8qxp-colibri.dtsi as it was a preprepared group there.
I did try setting the previous values has ofcourse been tested aswell “0x20”

		pinctrl_atmel_adap: mxt-ts-adapter {
			fsl,pins = <
				IMX8QXP_UART1_TX_LSIO_GPIO0_IO21		0x4000021	/* SODIMM  28 */
				IMX8QXP_UART1_RX_LSIO_GPIO0_IO22		0x21		/* SODIMM  30 */
			>;
		};

But it results in the same error as before found on Torizon 4

dmesg

[    7.165771] atmel_mxt_ts 17-004a: __mxt_read_reg: i2c transfer failed (-5)
[    7.172917] atmel_mxt_ts 17-004a: mxt_bootloader_read: i2c recv failed (-5)
[    7.203317] atmel_mxt_ts 17-004a: Trying alternate bootloader address
[    7.207416] atmel_mxt_ts 17-004a: mxt_bootloader_read: i2c recv failed (-5)
[    7.089094] atmel_mxt_ts: probe of 17-004a failed with error -5

lsmod seems to load the module correctly atleast

joydev                 32768  0
atmel_mxt_ts           40960  0
imx8qxp_adc            20480  0
mcp251x                24576  0

I just to validate but I’m using this command to publish a new dts file to the device
torizoncore-builder dto deploy --remote-host 172.23.6.128 --remote-username ***** --remote-password ***** device-trees/overlays/test_atmel.dts

Could you try with the pre-made overlay we have for the iMX8X and capacitive touch adapter: http://git.toradex.com/cgit/device-tree-overlays.git/tree/overlays/colibri-imx8x_atmel-mxt-adapter_overlay.dts?h=toradex_5.4-2.3.x-imx