How to Enable and Configure ILI2510 Touchscreen on the Forlinx OK6254 Platform (Linux 6.1 Kernel)?

In the development of industrial HMI, including smart terminals, self-service kiosks, and embedded display systems, integrating display screens with touch input is a crucial engineering task. During fast-paced project cycles, developers often need to adapt and troubleshoot display modules of different sizes, interfaces, and touch controllers, depending on the specific hardware configurations.

1. Background

This guide offers a clear, step-by-step process for integrating a 15.6-inch Dual-LVDS display panel with an ILI2510 touch controller on the Forlinx Embedded OK6254-C SBC, operating on the Linux 6.1.33 kernel.

2. Display Configuration

2.1 Display

Modify the forlinx _ contorl node in/OK62xx-linux-kernel/arch/arm64/boot/DTS/Ti/OK62xx.dtsi as shown in the figure below:

Modifying forlinx_control node in OK62xx.dtsi for Dual-LVDS display configuration

2.2 Touchscreen

2.2.1 Adding the Device Tree Node

Refer to the schematic based on the hardware connection at P34 to confirm that the hardware is connected via I2C2.

Hardware schematic showing ILI2510 touchscreen connected via I2C2 at P34

Consult the chip manual to check its multiplexing functionality (since the default I2C2 interface is already configured, no modifications are necessary).

ILI2510 chip manual pin multiplexing and functionality table

Perform the multiplexing in /OK62xx-linux-kernel/arch/arm64/boot/dts/ti/OK62xx.dtsi:

Comment out the original interface.

Commenting out the original I2C2 interface in the OK62xx.dtsi device tree

Add it to the usr_led_pins_default node and modify it as shown in the diagram.

Updating usr_led_pins_default node with AM62X_IOPAD configurations for touchscreen

AM62X_IOPAD(0x0e0, PIN_INPUT, 7) /* (V20) VOUT0_DATA10 /
AM62X_IOPAD(0x0e4, PIN_OUTPUT, 7) / (AA23) VOUT0_DATA11 */

Add a new node under the main_i2c2 node:

Adding the ilitek_251x device node configuration to the main_i2c2 bus

touchscreen: ilitek_251x@41 {
compatible = "ilitek,ili251x";
reg = <0x41>;
pinctrl-0 = <&usr_led_pins_default>;
interrupt-parent = <&main_gpio0>;
interrupts = <55 IRQ_TYPE_EDGE_FALLING>;
reset-gpios = <&main_gpio0 56 GPIO_ACTIVE_LOW>;
wakeup-source;
status = "okay";
};

2.2.2 Loading the Kernel Driver

Enter Ok62xx-linux-kernel to configure menuconfig.

forlinx@ubuntu:~/62xx/OK62xx-linux-sdk$ cd OK62xx-linux-kernel/
forlinx@ubuntu:~/62xx/OK62xx-linux-sdk/OK62xx-linux-kernel$ make menuconfig ARCH=arm64

Load the driver under Device Drivers > Input device support > Touchscreens, selecting the driver in the red box.

Selecting the Ilitek ILI210x/ILI251x I2C touchscreen driver in Linux kernel menuconfig

Recompile the kernel and place the compiled Image and OK6254-C.dtb files in the /boot directory. Save and restart the development board. During the Uboot phase, select the screen configuration as follows:

Selecting the appropriate display screen configuration during the U-Boot boot phase

2.2.3 Calibrating the Screen and Configuring Rules

1. View the node

Terminal output showing identified display nodes including LVDS-1

card0-LVDS-1 corresponds to lvds1.

2. Set udev

root@OK62xx:/# vi /etc/udev/rules.d/touchscreen.rules
SUBSYSTEM=="input", ACTION=="change|add", ATTRS{name}=="ili210x_i2c", ENV{WL_OUTPUT}="LVDS-1"

Enter the following command to configure udev rules:

Applying udev rules for the ILI210x I2C touchscreen device in the terminal

3. Use the command vi /etc/xdg/weston/weston.ini to open the screen calibration file and uncomment it. To enable the screen calibration tool.

root@OK62xx:/# vi /etc/xdg/weston/weston.ini

Editing weston.ini configuration to enable the touchscreen calibrator tool

If the file does not exist, add the following content at the end:

[libinput]
touchscreen_calibrator=true

4. Screen Calibration

root@OK62xx:/# weston-touch-calibrator "LVDS-1" --debug -v

After entering the command, touch the red crosses on the screen in sequence to obtain the calibration values.

Running weston-touch-calibrator to obtain coordinates and calibration matrix

5. Configure the environment variable

root@OK62xx:/# vi /etc/udev/rules.d/ws-calibrate.rules

Delete the original content and add the following:

SUBSYSTEM=="input", ATTRS{name}=="ili210x_i2c", ENV{LIBINPUT_CALIBRATION_MATRIX}="1.014184 -0.032956 -0.007435 -0.008599 1.035186 0.004496", ENV{ID_INPUT_KEY}="1"

Configuring the LIBINPUT_CALIBRATION_MATRIX in the ws-calibrate.rules file

Save and reboot the device.

In the development of embedded display terminals, adapting touchscreens might seem like a minor feature, but it has a significant impact on the overall human-machine interaction experience. For developers who require screen customization, interface expansion, and project implementation, mastering the entire touchscreen adaptation process can greatly enhance product development efficiency and improve troubleshooting capabilities.

The Forlinx Embedded platform offers a reliable hardware foundation along with a comprehensive software development environment. This aids developers in efficiently integrating systems, from low-level drivers to high-level applications. If you are involved in the development of displays, HMI, or industrial terminal products, this article could be a valuable reference for adapting your project.




Contact Sales Team

Our sales team will connect you with FAE engineers for one-on-one technical support.

Talk to Our Engineers

Get a Quote

Get pricing and project evaluation support from our team.

Request a Quote

Apply for Samples

Submit your request to receive product samples for evaluation.

Get Samples

Join Facebook Group

Get Forlinx technical updates and hands-on sharing from our experts.

Join Now