1 Overview
This task is to debug the touch screen driver on the flykar I. mx 6 quqd sabrelite Development Board. The touch screen chip is goodix's gt828 chip and the touch screen interface is I2C.
Operating System: Android 4.0.4
Kernel version: 3.0.15
2 debugging steps 2.1 hardware connection 2.1.1 development board hardware interface
The Development Board has provided independent interfaces for touch screen, which are as follows:
It provides a set of I2C, power supply, ground, and gpio ports.
2.1.2 gt828 hardware interface
The hardware interface of the touch screen chip gt828 is as follows:
Here, Int Is the interrupt pin, reset is the reset pin, and the other thing to note is that the chip voltage is 3.3 V.
2.1.3 connection
After you are familiar with the hardware interfaces of the Development Board and the chip, the next step is to connect them.
1) The first is the power supply pin. Because the power supply of the touch screen interface of the Development Board is 5 V, and the chip voltage is 3.3 V, you need to connect the power supply of 3.3v with the chip.
2) connect the I2C pin. the I2C of the development board itself has a K pull-up resistor, so no external pull-up resistor is needed.
3) connect the gpio_9 of the development board to the int port of the chip to control interruption.
4) A gpio is required to control the reset of the chip, but the gpio foot of the touch screen interface of the Development Board has only one gpio_9. Therefore, find another gpio foot to control the reset.
The connection method is as follows:
1 vcc33 => 3.3 V
2 Gnd => ground
3 SDA => 6 i2c3_sda
4 SCL => 5 i2c3_scl
5 Int => 4 gpio9
6 reset => disp0_contrast
Note: The int and reset feet do not need to be connected to the upper resistance.
2.2 driver Modification
1. Put the driver files gt813_827_828.c and gt813_827_828.h provided by the manufacturer to the kernel directory kernel_imx/Drivers/input/touchscreen.
2. Modify the header file gt813_827_828.h.
1) modify the macro switch:
# Definegtp_change_x2y 1 // X, Y coordinate interchange # definegtp_create_wr_node 0 // if no online upgrade is performed, set it to 0, otherwise, the # definegtp_ics_slot_report 1 is not compiled. // The Android 4.0 is configured as a slot to report coordinates.
2) modify the int and reset pin Definitions
#define GTP_RST_PORT MX6Q_SABRELITE_TP_RST#define GTP_INT_PORT MX6Q_SABRELITE_CAP_TCH_INT1
Specifically, mx6q_sabrelite_tp_rst and mx6q_sabrelite_cap_tch_int1 are defined in the arch/ARM/Plat-mxc/include/Mach/sabrelite. h file:
#define MX6Q_SABRELITE_TP_RST IMX_GPIO_NR(2,0)#define MX6Q_SABRELITE_CAP_TCH_INT1 IMX_GPIO_NR(1, 9)
How are these two pins defined? Refer to hardware connection:
5 Int => 4 gpio9
6 reset => disp0_contrast
First, let's look at the int foot and connect it to the CPU's gpio9. we search for gpio_9 on The Datasheet of I. mx 6quad and find iomuxc_sw_mux_ctl_pad_gpio09. Its mux_mode is described as follows:
MUX Mode Select Field.Select 1 of 7 iomux modes to beused for pad: GPIO_9.NOTE: Pad GPIO_9 is involved inDaisy Chain.000 ALT0 — Select signalESAI_RX_FS.- Configure registerIOMUXC_ESAI_RX_FS_SELECT_INPUT for mode ALT0.001 ALT1 — Select signalWDOG1_B.010 ALT2 — Select signalKEY_COL6.- Configure registerIOMUXC_KEY_COL6_SELECT_INPUT for mode ALT2.011 ALT3 — Select signalCCM_REF_EN_B.100 ALT4 — Select signalPWM1_OUT.101 ALT5 — Select signalGPIO1_IO09.110 ALT6 — Select signal SD1_WP.- Configureregister IOMUXC_USDHC1_WP_ON_SELECT_INPUT for mode ALT6.
The alt5 mode is gpio1_io09, so it is configured as imx_gpio_nr (1, 9). Similarly, the reset script is configured as imx_gpio_nr (2, 0 ).
3) modify resolution:
# Ifgtp_custom_cfg # define gtp_max_height 800 # define gtp_max_width 480 # define gtp_int_trigger 1 // 0: falling 1: rising # else // Screen Resolution # define gtp_max_height 6400 # define gtp_max_width 9600 # define gtp_int_trigger 1 # endif
4) modify other macro definitions:
// # Definegtp_int_cfg initi_gpio_sfn (0xf) // comment out # definegtp_gpio_as_input (PIN) do {\ gpio_direction_input (PIN) ;\} while (0) # define (PIN) do {\ gpio_direction_input (PIN) ;\} while (0)
3. Configure I2C Information
Find mxc_i2c2_board_info in arch/ARM/mach-mx6/board-ma6q_sabrelite.c and add:
I2C_BOARD_INFO("Goodix-TS",0x5d),
After the modification is complete, as shown in the following figure:
staticstruct i2c_board_info mxc_i2c2_board_info[] __initdata = {{ I2C_BOARD_INFO("egalax_ts",0x4), .irq =gpio_to_irq(MX6Q_SABRELITE_CAP_TCH_INT1),},{ I2C_BOARD_INFO("Goodix-TS",0x5d),},};
Then configure the I2C speed to KB:
static struct imxi2c_platform_data mx6q_sabrelite_i2c_data = {.bitrate = 400000,};
4. compile.
1) Add:
obj-$(CONFIG_TOUCHSCREEN_GT828) += gt813_827_828.o
2) Add the following content to the kconfig file in the same directory:
configTOUCHSCREEN_GT828 tristate "GT828 touchscreen driver" depends on I2C help Say Yhere to support GT828/813/827 touchscreen. Tocompile this driver as a module, choose M here: the module will be called gt828_ts
3) Configure menuconfig
Run make menuconfig in the kenel directory.
Go to the configuration page and enable the switch of the gt828 driver:
Device Drivers -> Input device support -> Touchscreens-> <*>GT828 touchscreen driver
4) execute make uimage in the kenel directory for compilation. After the compilation is successful, generate the uimage file, and then execute make bootimage In the android source code directory to generate the boot. imgfile.
5) Burn the boot. imgfile to the TF card and start the system.
3. Software Debugging
1. After the system is started, it is found that the serial port printing of the system is faulty. You can only use ADB to log on and run the dmesg command to view the kernel message. It is found that the kernel has always output such a log:
GTP-ERROR->>[339]I@C transfer error.errno:-110
It indicates that there is a problem with I2C communication. Check the pins and find that the SDA and SCL of I2C are exchanged with each other, and then re-weld the SDA and the SCL.
2. restart the system and find that I2C still cannot communicate. The log is as follows:
<4><<-GTP-INFO->>[362]Datanot ready!<4><<-GTP-INFO->>[362]Datanot ready!<4><<-GTP-INFO->>[362]Datanot ready!<4><<-GTP-INFO->>[362]Datanot ready!
This error is generated in the terminal function driven by the touch screen. Continue to view the log. The output of the dmesg does not include the printing of the gt828 driver initialization function. The initialization function of the gt828 will print the following information:
[ 4.192103] <<-GTP-FUNC->>[1108]Func:goodix_ts_probe[ 4.197196] <<-GTP-DEBUG->>[1110]I2C addr:5d[ 4.201501] <<-GTP-INFO->>[1113]GTP DriverVersion:V1.2<2012/06/08>…
I suspect that dmesg printing is incomplete, so the complete kernel log can only solve the problem of Serial Output of the Development Board.
3. After countless attempts, I finally solved the problem of the serial port output of the Development Board. The solution was to change the serial port output of U-boot to ttymxc1, and the original port was ttymxc0.
4. restart the system and view the serial port print log. The initialization information of the gt828 driver is still unavailable. After several attempts, we found that the driver Loading Function on gt828 can change late_initcall to module_init. The modification is as follows:
module(goodix_ts_init);module_exit(goodix_ts_exit);
After the modification, compile and start the system. The driver initialization log is found as follows:
<<-GTP-INFO->>[1278]GTPdriver install.<<-GTP-DEBUG->>[973]I2Caddr:5d<<-GTP-INFO->>[976]GTPDriver Version:V1.2<2012/06/08><<-GTP-INFO->>[977]GTPDriver build@11:21:04,Jun 18 2013<<-GTP-DEBUG->>[637]len1=112,len2=0,len3=0<<-GTP-DEBUG->>[655]SENSORID:0<<-GTP-DEBUG->>[706]X_MAX= 800,Y_MAX = 1280,TRIGGER = 0x00<<-GTP-DEBUG->>[837]INTtrigger type:0<<-GTP-INFO->>[1046]GTPworks in interrupt mode.<<-GTP-INFO->>[741]ICVERSION:00_0000i2c-core: driver [isl29023] usinglegacy suspend methodi2c-core: driver [isl29023] usinglegacy resume method <<-GTP-INFO->>[362]Datanot ready!<<-GTP-INFO->>[362]Datanot ready!<<-GTP-INFO->>[362]Datanot ready!<<-GTP-INFO->>[362]Datanot ready!<<-GTP-INFO->>[362]Datanot ready!
From the IC version: 00_0000, the I2C communication is abnormal.
So I checked the software and hardware again. After N attempts, I confirmed that the software was okay. The RST and INT ports of the hardware also worked normally, and the rest may be I2C hardware problems.
Change the i2c3 to i2c2. After the hardware is changed, find mxc_i2c1_board_info in the board-ma6q_sabrelite.c, add:
I2C_BOARD_INFO("Goodix-TS",0x5d),
Recompile and burn the system.
5. After the system is started, the log is normal and the touch screen is working properly!