A40i use notes: call the system's built-in driver GT911 touch screen

I. Introduction

        In general, when using capacitive touch screen, it is directly driven by USB, but I mentioned the problem in the previous article, that is, the problem that the USB touch screen and the platform I use are not particularly compatible, and the problem phenomenon is repeated again. Probably it is no problem to use the USB interface of the linux core board to connect the touch chip of ILTTEK, but when using the GT911 touch chip of GOODIX with the IIC to USB drive-free board, there will be multi-finger touch and then the touch screen will fail. You need to re-plug the following touch screens USB, or restarting the program, these two are unbearable. After a long time of debugging, as a novice at the bottom of the system, I really can't solve this incompatibility problem. Later, I tried my best to study how to use the direct driver. way, skip the USB driver-free board, and directly use the system resource IIC bus signal and RST and INT pins to call the GT911 chip driver to control the touch screen. And after several days of research during off-duty hours and patient emails with after-sales, I finally lived up to my expectations!

2. Environment

Allwinner A40i (Feiling A40i core board)


2401 source package

3. Text

First attach my changes file resourcehttps://download.csdn.net/download/qq_37603131/86797324

1. Hardware modification part

Use the TWI1 interface of the core board, find two pins to configure RST and INT, and configure the sys_configFCU2401.fex file. The core modification in the file is as follows:

twi1_used        = 1
twi1_scl         = port:PB18<2><default><default><default>
twi1_sda         = port:PB19<2><default><default><default>
;capacitor tp configuration capacitive touch
;external int function
;wakeup output function
;notice ---    tp_int_port &  tp_io_port use the same port
;compatible       device name
;ctp_used		  use or not
;ctp_name		  used as a distinction gd series, adapted to the screen resolution
;ctp_twi_id		  used as selection iic of adapter,optional 1, 2
;ctp_twi_addr     specify iic Device address, related to hardware
;ctp_screen_max_x touchpad x maximum coordinate
;ctp_screen_max_y touchpad y maximum coordinate
;ctp_revert_x_flag Does it need to be reversed x Coordinate, need to be set to 1, otherwise set to 0
;ctp_revert_y_flag Does it need to be reversed y Coordinate, need to be set to 1, otherwise set to 0
;ctp_exchange_x_y_flag Do you need xy Coordinate swap
;ctp_power_ldo	  Touch Screen Power Configuration
;ctp_power_ldo_vol Touch screen voltage configuration
;ctp_int_port	  Capacitive screen interrupt signal GPIO configure
;ctp_wakeup		  Capacitive screen wake-up signal GPIO configure
compatible          = "allwinner,sun50i-ctp-para"
ctp_used            = 1
ctp_name            = "gt9xx_ts"
ctp_twi_id          = 1
ctp_twi_addr        = 0x14
ctp_screen_max_x    = 800
ctp_screen_max_y    = 480
ctp_touch_panel_max_x  = 800
ctp_touch_panel_max_y  = 480
ctp_revert_x_flag   = 0
ctp_revert_y_flag   = 0
ctp_exchange_x_y_flag = 0
ctp_power_ldo       = "vcc-ctp"
ctp_power_ldo_vol   = 3300

ctp_int_port        = port:PH02<6><default><default><default>
ctp_wakeup          = port:PH05<1><default><default><0>

;compatible Configuration name
;ctp_list_used Support touch screen list
;ft5x_ts       support ft5x_ts module
;gt82x	       Ditto
;gt9xx_ts      Ditto
;gt9xxnew_ts   Ditto
;gt811	       Ditto
;zet622x       Ditto
;aw5306_ts     Ditto
compatible          = "allwinner,sun50i-ctp-list"
ctp_list_used	    = 1
ft5x_ts             = 1
gt82x               = 1
gt9xx_ts            = 1
gt9xxnew_ts         = 1
gt811               = 1
zet622x             = 1
aw5306_ts	    = 1

        Need to pay attention to the pin configuration mode, and the id of TWI to correspond. I used to be the default TWI3, and the default id was 3. I have not changed the ID when I replaced TWI1. Later, I was confused and changed the mode of the TWI pin. Here is the configuration resource In part, I have to say that this config file independently developed by Feiling is very fast for those who do not need in-depth learning and professional linux. There is no need to study the device tree in depth. Most functions only need to modify this configuration file. That's it. At present, I use this configuration file to modify many interfaces, such as SATA, CAN, 485, 232, dual network ports, resistive touch, capacitive touch, LVDS, LCD, dual LVDS1080P, GPIO and so on.

The next thing that needs to be modified is the system configuration part. For the file sun8iw11p1smp_oka40i_c_defconfig, you need to open the link in the file to GT911 driver. The macros are all selected in the system configuration file, where m and y can be set. The meaning of m is to compile the ko file, and the driver needs to be loaded manually. The meaning of y is to not compile the ko file, and it will be automatically loaded in the system driver. When debugging the driver, you need to find out where there is a problem. Select m to compile, and then use y to automatically load it. You don't need to learn a program to call the driver, and directly execute the driver by default. 

Here I turn on the macro CONFIG_TOUCHSCREEN_GT9XXNEW_TS=y in the system configuration file, and compile it with the GT911 driver when executing build.sh.

        After that, compile the system image package and update the image file to the board. The only fly in the ointment is that the touch screen is recognized as a mouse, and the mouse pointer will appear when the screen is clicked. Continue to study how to recognize it as a touch screen, remove the mouse pointer, and insert the mouse pointer. The mouse does not appear until the real mouse is on.

I tossed and turned in the early morning and couldn't fall asleep. I looked at my mailbox. Feiling Technology sent a method to remove the mouse pointer in qt. I looked at the method and got some inspiration. It may not be removed through qt, but to delete something in the environment variable. , so began the road to get up and test.

amend as below:

Delete the evdevmouse part of the qt5.9.sh environment variable in the resource, so the touch is normal, and the mouse pointer is no longer displayed. But at this time, it is impossible to connect to a wired mouse, so this environment variable has to be specially marked again. It is only used for gt911 touch screen and does not support limited mouse. In fact, I did not have access to the mouse test, because at home No wired mouse, woohoo~

4. Conclusion

Persistence is victory! With dreams and goals, you will not stop moving forward.

Tags: Linux

Posted by N-Bomb(Nerd) on Fri, 21 Oct 2022 23:23:28 +0530