Touch configuration for Storyboard on Toradex Colibri iMX6ULL Eval Board

I was working with a customer who needed to enable the touch support on one of our hardware partner boards from Toradex - Colibri iMX6ULL with the Colibri Eval-v3 carrier board.  There is a 7 inch 800x480 capacitive touch screen attached using an interposer adapter board.
 
The customer was using the great Toradex Easy Installer process to bring up first Linux then Storyboard on the target with no problems however the touch hardware was not working or enabled in Linux.
 
I did some investigations as the process has changed recently it seems so I worked through the steps. Unfortunately I don't have the exact hardware so I replicated this on my Colibri iMX6ULL with Aster base board and the 7 inch capacitive touch display.
 
I was able to successfully enable touch input and run Storyboard with the touch screen enabled. This was not anything specific to Storyboard but rather Linux platform setup but it was fun to figure out in any case...

As a base Linux build I used the latest Toradex Easy Installer console image 3.0b4 which boots to a simple white console screen and by default has mouse input but of course no touch. To fix this i needed to update the device tree for the board to enable the touch screen driver and configure the pin multiplexing options:
TDX X11 2.6-snapshot colibri-imx6ull ttymxc0

Colibri-iMX6ULL_Console-Image 3.0b4.254 20200421

colibri-imx6ull login: root
root@colibri-imx6ull:~#
You may first need to configure the kernel for the correct screen resolution as I did for this 7 inch panel at 800x480 pixels. To configure the correct display resolution set the vidargs environment variable according to your module as described below in the command from the Linux console. [For more information refer to the Display Output, Resolution and Timings article.]
root@colibri-imx6ull:~#fw_setenv vidargs 'video=mxsfb:800x480M-16@60,pixclockpol=1'
This modern 3.0b4 kernel is configured to use the ubi file system format for the flash partitions and is likely what you would end up using in a production device.  You can see the ubi partitions listed using the Linux console command here and the dtb one is the partition we need to update:
root@colibri-imx6ull:~# ubinfo -a
UBI version:                    1
Count of UBI devices:          1
UBI control device major/minor: 10:58
Present UBI devices:            ubi0

ubi0
Volumes count:                          4
Logical eraseblock size:                126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:    4059 (515395584 bytes, 491.5 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                128
Count of bad physical eraseblocks:      5
Count of reserved physical eraseblocks:  75
Current maximum erase counter value:    27
Minimum input/output unit size:          2048 bytes
Character device major/minor:            246:0
Present volumes:                        0, 1, 2, 3

Volume ID:  0 (on ubi0)
Type:        static
Alignment:  1
Size:        67 LEBs (8507392 bytes, 8.1 MiB)
Data bytes:  5753280 bytes (5.4 MiB)
State:      OK
Name:        kernel
Character device major/minor: 246:1
-----------------------------------
Volume ID:  1 (on ubi0)

Type:        static

Alignment:  1

Size:        2 LEBs (253952 bytes, 248.0 KiB)

Data bytes:  39990 bytes (39.0 KiB)

State:      OK

Name:        dtb

Character device major/minor: 246:2
-----------------------------------
Volume ID:  2 (on ubi0)
Type:        static
Alignment:  1
Size:        8 LEBs (1015808 bytes, 992.0 KiB)
Data bytes:  0 bytes
State:      OK
Name:        m4firmware
Character device major/minor: 246:3
-----------------------------------
Volume ID:  3 (on ubi0)
Type:        dynamic
Alignment:  1
Size:        3901 LEBs (495333376 bytes, 472.3 MiB)
State:      OK
Name:        rootfs
Character device major/minor: 246:4

There are some instructions on how to update the dtb files here if you are interested:
https://www.toradex.com/community/questions/22626/update-fdt-1.html

I have rebuilt the device tree dtb files from source with the appropriate device driver pin changes (see attaches and dtb and associated dts, .dtsi source files): [if you want to try this yourself later for your own hardware it takes a few steps.... ]
https://developer.toradex.com/device-tree-customization#imx-6ull-based-modules
https://developer.toradex.com/knowledge-base/build-u-boot-and-linux-kernel-from-source-code#Toolchain

...and for the iMX6ULL specifically I applied the patch to the arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtsi device tree source file which enables the touch screen hardware as per here:
https://developer.toradex.com/knowledge-base/first-steps-with-capacitive-touch-display-7-inch-parallel#colibri-imx6ull

What you will need to do is copy across these updated dtb files for your SoM and baseboard combination (I attached the files for both the wifi and non wifi modules depending on which flavour you want) using WinSCP to say the /boot folder on the target then run these commands to update them to the hidden dtb partition Volume ID:  1 (on ubi0):
root@colibri-imx6ull:~#ubiupdatevol /dev/ubi0_1 /boot/imx6ull-colibri-eval-v3.dtb
root@colibri-imx6ull:~#ubiupdatevol /dev/ubi0_1 /boot/imx6ull-colibri-wifi-eval-v3.dtb
Now the hardware configuration is enabled then you can tell the Kernel to load the touch driver on next boot:

To load the touch driver module use:
modprobe atmel_mxt_ts
To load the driver module automatically at boot time, creating a file atmel_mxt_ts.conf in the modules-load.d directory is required:
echo atmel_mxt_ts > /etc/modules-load.d/atmel_mxt_ts.con
When the board boots next you should hopefully see the touchscreen enabled and you can interact with the simple Xterm console by touching it.  

From the Linux serial console boot log you should hopefully see:
:
[    6.988744] atmel_mxt_ts 0-004a: Touchscreen size X799Y479
[  OK  ] Mounted Kernel Debug File System.
[    7.022892] input: Atmel maXTouch Touchscreen as /devices/soc0/soc/2100000.aips-bus/21a0000.i2c/i2c-0/0-004a/input/input2
:
Once this base touch support is working you can simply copy over the Storyboard runtime, launcher scripts and your application files to the target which takes a couple of minutes then you are ready to run! [Tip: My learned colleague Nik Schultz recently hosted an awesome webinar on this which is a must see if you want to see how easy it is:
https://info.cranksoftware.com/resources/webinar/preparing-your-storyboard-built-project-for-linux-environment-deployments ]

You can see from the trace output above that the touch screen is located on input2 which means that for Storyboard I amended the launcher scripts to set the mtdev device to be /dev/input/event2 as follows:
$SB_ENGINE/bin/sbengine -vvvv -omtdev,device=/dev/input/event2 <my_app.gapp>
This configuration still auto starts the terminal screen on boot but that can be modified to boot into the Storyboard application instead though that is simple to change if needed.
 
The config process is very similar for other Toradex boards so hopefully you find it useful.
 
Garry
 
0

Comments

1 comment
  • Official comment

    As a follow-up and for completeness you can find the Toradex Linux images and build pages here:
    https://developer.toradex.com/software/linux/linux-software

    The application setup and autostart is pretty simple to change and is documented as follows:
    https://support.cranksoftware.com/hc/en-us/articles/360041876412-How-to-prepare-your-target-platform-to-auto-boot-a-Storyboard-application-with-Linux-systemd

    For this Toradex iMX6ULL 3.0b4 Poky Linux base image it uses systemd for apps management and you can see that this is set to run the graphical user target by default (and hence runs the xterm console on the screen). 

    root@colibri-imx6ull:# systemctl get-default
    graphical.target

    To change the autostart to run Storyboard we can as a first step switch this off and revert to a simple multi-user.target which shows the Linux console and for development you can manually run the application or deploy from the Designer using SCP.

    root@colibri-imx6ull:# systemctl set-default multi-user.target
    Removed /etc/systemd/system/default.target.
    Created symlink /etc/systemd/system/default.target → /lib/systemd/system/multi-user.target.

    The second step as shown in the app note link above is then to add your service to autostart the Storyboard application so that it runs automatically on boot.

    Garry

Please sign in to leave a comment.

Didn't find what you were looking for?

New post