Killjoy99
Posts: 4
Joined: Tue Jun 06, 2017 7:06 pm

RPI3 and Goodix GT9271 Touchscreen

Tue Jun 06, 2017 10:33 pm

Hello Everyone,

I have spent quite some time trying to get my new touch panel to work with my RPI3. The touch panel communicates through I2C and 2 GPIO for the incoming interrupt and reset control. At first, my timing for this project seemed perfect as there has been a recent kernel build that included a overlay/module for this specific IC.
https://github.com/raspberrypi/linux/pu ... 28b5cc1cdf

I started by updating my system (Originally loaded Kivy Pie Version: 0.9b) to the 4.9.29 kernel so I could load up the overlay. I attached the screen to the RPI3 running 3.3V to PIN1, I2C SDA to PIN3, I2C SCL to PIN5, INT to PIN7, GND to PIN9 and RESET to PIN11. Next, I added "dtoverlay=goodix" to the end of the /boot/config.txt and rebooted the system. I was able to use "sudo vcdbg log msg" and verify that the goodix overlay was loaded correctly. Unfortunately, I was unable to get any touch events within my app and on further inspection, no inputs were shown under "cat /proc/bus/input/devicescat".

After digging through the DEVICE TREES, OVERLAYS, AND PARAMETERS info and going through multiple .dts file iterations, I'm unable to get anything working. It seems like a still have a huge gap in my understandings of how overlays operate on this system. For example, the GT9721 datasheet lists out an adsorbent number of registers (~95 Bytes) that hold of the data associated with up to 10 fingers of multi-touch readings that need to be read every time the interrupt gets sent. A quick look over any of the .dts files and its obvious that there is no information within that directs the reading of this data let alone what to do with it when its arrives.

So... what exactly am I missing here? The device tree system configures the hardware on the RPI3, but what is responsible for bridging the gap over to usable data within my app? Should this overlay allow the touch screen to be displayed under my input devices? I have plenty of experience with I2C peripherals on the RPI3 and could go the route of taking the interrupts/data inside the app but was hoping there was a cleaner way. The official 7" display for example, reads into the app as input provider events and the rest is handled. Manually taking in the I2C data and rebuilding the multi-touch events in software seems like quite the daunting task.

Thanks in advance as any help would be much appreciated...
Brian

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1822
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: RPI3 and Goodix GT9271 Touchscreen

Wed Jun 07, 2017 10:10 am

The goodix driver is the "missing link" between the Device Tree configuration and input data. DT declares that there is a device on the I2C bus at address 0x14, and that GPIOs 4 and 17 provide interrupt and reset facilities. The kernel searches the module aliases for a module that provides support for the device, then loads the module and calls the relevant probe function. Provided the probe succeeds, the driver will then make the devices functionality available to the system.

We don't have one of the Goodix screens here to test, but by commenting out some of the driver's checking I can get it to load and see the input device it creates. I suggest you run "dmesg | grep Goodix" and post the output here.

N.B. "cat /proc/bus/input/devicescat" does not exist, but I presume that "devicescat" (which should be "devices") is a typo in this post only and that you run the correct command.

Killjoy99
Posts: 4
Joined: Tue Jun 06, 2017 7:06 pm

Re: RPI3 and Goodix GT9271 Touchscreen

Wed Jun 07, 2017 4:06 pm

Thank you for the response and exlanation PhilE.

You are correct that the typo in cat command was only present in the post. Using "cat /proc/bus/input/devices" on the RPI results in no output.

Likewise, "dmesg | grep Goodix" does not give any results. Please let me know if you want the entire dmesg log.

Here is the i2cdetect output so you can see the system does in fact show the correct address.

Code: Select all

[email protected]:~$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- 14 -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Thanks, Brian

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1822
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: RPI3 and Goodix GT9271 Touchscreen

Wed Jun 07, 2017 4:12 pm

Please post the whole dmesg output. Also tell me what "sudo modprobe goodix" returns.

How did you upgrade the kernel to 4.9.29?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1822
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: RPI3 and Goodix GT9271 Touchscreen

Wed Jun 07, 2017 4:13 pm

While you're at it, it might save time to include config.txt and cmdline.txt.

Killjoy99
Posts: 4
Joined: Tue Jun 06, 2017 7:06 pm

Re: RPI3 and Goodix GT9271 Touchscreen

Wed Jun 07, 2017 4:38 pm

There was no output from "sudo modprobe goodix". Yes, I updated to 4.9.29. I believe the exact command was "sudo rpi-update d8a8b0eb02281af00f56760e938ac1104711e553".

- dmesg

Code: Select all

[email protected]:~$ dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.29-v7+ ([email protected]) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #1000 SMP Sun May 21 20:11:31 BST 2017
[    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt:Machine model: Raspberry Pi 3 Model B Rev 1.2
[    0.000000] cma: Reserved 8 MiB at 0x2e400000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] On node 0 totalpages: 192512
[    0.000000] free_area_init_node: node 0, pgdat 80c6ee00, node_mem_map add64000
[    0.000000]   Normal zone: 1692 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 192512 pages, LIFO batch:31
[    0.000000] percpu: Embedded 14 pages/cpu @aefa7000 s25600 r8192 d23552 u57344
[    0.000000] pcpu-alloc: s25600 r8192 d23552 u57344 alloc=14*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 190820
[    0.000000] Kernel command line: 8250.nr_uarts=0 bcm2708_fb.fbwidth=1280 bcm2708_fb.fbheight=800 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  dwc_otg.lpm_enable=0 logo.nologo console=ttyS0,115200 kgdboc=ttyS0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 usbcore.autosuspend=-1 elevator=deadline rootwait quiet consoleblank=0 loglevel=1
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 741420K/770048K available (7168K kernel code, 483K rwdata, 2012K rodata, 1024K init, 778K bss, 20436K reserved, 8192K cma-reserved)
[    0.000000] Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xaf800000 - 0xff800000   (1280 MB)
    lowmem  : 0x80000000 - 0xaf000000   ( 752 MB)
    modules : 0x7f000000 - 0x80000000   (  16 MB)
      .text : 0x80008000 - 0x80800000   (8160 kB)
      .init : 0x80b00000 - 0x80c00000   (1024 kB)
      .data : 0x80c00000 - 0x80c78fd4   ( 484 kB)
       .bss : 0x80c7a000 - 0x80d3ca64   ( 779 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  Build-time adjustment of leaf fanout to 32.
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] arm_arch_timer: Architected cp15 timer(s) running at 19.20MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[    0.000008] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[    0.000021] Switching to timer-based delay loop, resolution 52ns
[    0.000317] Console: colour dummy device 80x30
[    0.000336] console [tty1] enabled
[    0.000359] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[    0.000377] pid_max: default: 32768 minimum: 301
[    0.000716] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000726] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001706] Disabling cpuset control group subsystem
[    0.001867] CPU: Testing write buffer coherency: ok
[    0.001908] ftrace: allocating 22386 entries in 66 pages
[    0.054545] CPU0: update cpu_capacity 1024
[    0.054563] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.054640] Setting up static identity map for 0x100000 - 0x100034
[    0.056839] CPU1: update cpu_capacity 1024
[    0.056846] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.057560] CPU2: update cpu_capacity 1024
[    0.057567] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.058236] CPU3: update cpu_capacity 1024
[    0.058243] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.058325] Brought up 4 CPUs
[    0.058335] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[    0.058340] CPU: All CPU(s) started in HYP mode.
[    0.058344] CPU: Virtualization extensions available.
[    0.059109] devtmpfs: initialized
[    0.070355] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
[    0.070625] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.070640] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.071185] pinctrl core: initialized pinctrl subsystem
[    0.072080] NET: Registered protocol family 16
[    0.074410] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[    0.083237] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.083243] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.083397] Serial: AMBA PL011 UART driver
[    0.085260] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[    0.085783] uart-pl011 3f201000.serial: could not find pctldev for node /soc/[email protected]/uart0_pins, deferring probe
[    0.155120] bcm2835-dma 3f007000.dma: DMA legacy API manager at af80f000, dmachans=0x1
[    0.156934] SCSI subsystem initialized
[    0.157085] usbcore: registered new interface driver usbfs
[    0.157160] usbcore: registered new interface driver hub
[    0.157249] usbcore: registered new device driver usb
[    0.164095] raspberrypi-firmware soc:firmware: Attached to firmware from 2017-05-15 16:57
[    0.165541] clocksource: Switched to clocksource arch_sys_counter
[    0.212341] VFS: Disk quotas dquot_6.6.0
[    0.212418] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.212619] FS-Cache: Loaded
[    0.212860] CacheFiles: Loaded
[    0.224970] NET: Registered protocol family 2
[    0.225880] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.225988] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.226173] TCP: Hash tables configured (established 8192 bind 8192)
[    0.226262] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.226304] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.226512] NET: Registered protocol family 1
[    0.226929] RPC: Registered named UNIX socket transport module.
[    0.226934] RPC: Registered udp transport module.
[    0.226938] RPC: Registered tcp transport module.
[    0.226943] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.227950] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 7 counters available
[    0.230196] workingset: timestamp_bits=14 max_order=18 bucket_order=4
[    0.246127] FS-Cache: Netfs 'nfs' registered for caching
[    0.247087] NFS: Registering the id_resolver key type
[    0.247116] Key type id_resolver registered
[    0.247121] Key type id_legacy registered
[    0.249513] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.249616] io scheduler noop registered
[    0.249622] io scheduler deadline registered (default)
[    0.249910] io scheduler cfq registered
[    0.255465] BCM2708FB: allocated DMA memory ee510000
[    0.255486] BCM2708FB: allocated DMA channel 0 @ af80f000
[    0.284421] Console: switching to colour frame buffer device 160x50
[    0.303607] bcm2835-rng 3f104000.rng: hwrng registered
[    0.303715] vc-cma: Videocore CMA driver
[    0.303720] vc-cma: vc_cma_base      = 0x00000000
[    0.303726] vc-cma: vc_cma_size      = 0x00000000 (0 MiB)
[    0.303731] vc-cma: vc_cma_initial   = 0x00000000 (0 MiB)
[    0.303942] vc-mem: phys_addr:0x00000000 mem_base=0x3dc00000 mem_size:0x3f000000(1008 MiB)
[    0.319191] brd: module loaded
[    0.328049] loop: module loaded
[    0.328061] Loading iSCSI transport class v2.0-870.
[    0.328582] usbcore: registered new interface driver smsc95xx
[    0.328597] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    0.554684] Core Release: 2.80a
[    0.554693] Setting default values for core params
[    0.554722] Finished setting default values for core params
[    0.755109] Using Buffer DMA mode
[    0.755115] Periodic Transfer Interrupt Enhancement - disabled
[    0.755119] Multiprocessor Interrupt Enhancement - disabled
[    0.755125] OTG VER PARAM: 0, OTG VER FLAG: 0
[    0.755137] Dedicated Tx FIFOs mode
[    0.755487] WARN::dwc_otg_hcd_init:1034: FIQ DMA bounce buffers: virt = 0xae504000 dma = 0xee504000 len=9024
[    0.755512] FIQ FSM acceleration enabled for :
Non-periodic Split Transactions
Periodic Split Transactions
High-Speed Isochronous Endpoints
Interrupt/Control Split Transaction hack enabled
[    0.755518] dwc_otg: Microframe scheduler enabled
[    0.755582] WARN::hcd_init_fiq:459: FIQ on core 1 at 0x8058e610
[    0.755592] WARN::hcd_init_fiq:460: FIQ ASM at 0x8058e980 length 36
[    0.755603] WARN::hcd_init_fiq:486: MPHI regs_base at 0xaf87a000
[    0.755662] dwc_otg 3f980000.usb: DWC OTG Controller
[    0.755696] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[    0.755726] dwc_otg 3f980000.usb: irq 62, io mem 0x00000000
[    0.755772] Init: Port Power? op_state=1
[    0.755776] Init: Power Port (0)
[    0.755975] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    0.755984] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.755993] usb usb1: Product: DWC OTG Controller
[    0.756000] usb usb1: Manufacturer: Linux 4.9.29-v7+ dwc_otg_hcd
[    0.756008] usb usb1: SerialNumber: 3f980000.usb
[    0.756847] hub 1-0:1.0: USB hub found
[    0.756887] hub 1-0:1.0: 1 port detected
[    0.757601] dwc_otg: FIQ enabled
[    0.757605] dwc_otg: NAK holdoff enabled
[    0.757609] dwc_otg: FIQ split-transaction FSM enabled
[    0.757623] Module dwc_common_port init
[    0.757841] usbcore: registered new interface driver usb-storage
[    0.758067] mousedev: PS/2 mouse device common for all mice
[    0.759040] bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer
[    0.759315] bcm2835-cpufreq: min=600000 max=1200000
[    0.759699] sdhci: Secure Digital Host Controller Interface driver
[    0.759703] sdhci: Copyright(c) Pierre Ossman
[    0.759978] sdhost-bcm2835 3f202000.sdhost: could not get clk, deferring probe
[    0.762150] mmc-bcm2835 3f300000.mmc: could not get clk, deferring probe
[    0.762247] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.769521] ledtrig-cpu: registered to indicate activity on CPUs
[    0.769706] hidraw: raw HID events driver (C) Jiri Kosina
[    0.769896] usbcore: registered new interface driver usbhid
[    0.769900] usbhid: USB HID core driver
[    0.770694] vchiq: vchiq_init_state: slot_zero = 0xae580000, is_master = 0
[    0.777365] Initializing XFRM netlink socket
[    0.777387] NET: Registered protocol family 17
[    0.777500] Key type dns_resolver registered
[    0.777969] Registering SWP/SWPB emulation handler
[    0.778670] registered taskstats version 1
[    0.779024] vc-sm: Videocore shared memory driver
[    0.779032] [vc_sm_connected_init]: start
[    0.788396] [vc_sm_connected_init]: end - returning 0
[    0.794290] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
[    0.795953] sdhost: log_buf @ ae507000 (ee507000)
[    0.875567] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    0.877782] mmc-bcm2835 3f300000.mmc: mmc_debug:0 mmc_debug2:0
[    0.877791] mmc-bcm2835 3f300000.mmc: DMA channel allocated
[    0.942819] mmc0: host does not support reading read-only switch, assuming write-enable
[    0.944789] mmc0: new high speed SDHC card at address 0007
[    0.945410] mmcblk0: mmc0:0007 Y016B 14.9 GiB
[    0.946981]  mmcblk0: p1 p2
[    0.955685] of_cfs_init
[    0.955864] of_cfs_init: OK
[    0.958973] EXT4-fs (mmcblk0p2): INFO: recovery required on readonly filesystem
[    0.958980] EXT4-fs (mmcblk0p2): write access will be enabled during recovery
[    0.969555] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    0.971107] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    0.972658] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    0.975437] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    0.975660] Indeed it is in host mode hprt0 = 00021501
[    1.048452] random: fast init done
[    1.126942] mmc1: new high speed SDIO card at address 0001
[    1.175581] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    1.175737] Indeed it is in host mode hprt0 = 00001101
[    1.405829] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
[    1.405839] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    1.406609] hub 1-1:1.0: USB hub found
[    1.406704] hub 1-1:1.0: 5 ports detected
[    1.725569] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    1.855813] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    1.855823] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    1.858546] smsc95xx v1.0.5
[    1.949245] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:5e:5c:13
[    3.422514] EXT4-fs (mmcblk0p2): recovery complete
[    3.427803] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    3.427851] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    3.428852] devtmpfs: mounted
[    3.430660] Freeing unused kernel memory: 1024K (80b00000 - 80c00000)
[    3.741640] systemd[1]: systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)
[    3.741977] systemd[1]: Detected architecture 'arm'.
[    3.885836] NET: Registered protocol family 10
[    3.887300] systemd[1]: Inserted module 'ipv6'
[    3.889013] systemd[1]: Set hostname to <kivypie>.
[    4.362407] systemd[1]: Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed to load: No such file or directory.
[    4.365241] systemd[1]: Starting Forward Password Requests to Wall Directory Watch.
[    4.365682] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[    4.365755] systemd[1]: Starting Remote File Systems (Pre).
[    4.365911] systemd[1]: Reached target Remote File Systems (Pre).
[    4.365996] systemd[1]: Starting Encrypted Volumes.
[    4.536554] fuse init (API version 7.26)
[    4.736262] systemd-udevd[134]: starting version 215
[    4.810819] i2c /dev entries driver
[    5.217407] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[    5.437868] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    5.549046] usbcore: registered new interface driver brcmfmac
[    5.678383] brcmfmac: Firmware version = wl0: May 27 2016 00:13:38 version 7.45.41.26 (r640327) FWID 01-df77e4a7
[    5.809563] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[    5.944493] systemd-journald[113]: Received request to flush runtime journal from PID 1
[    6.327140] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[    6.374904] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[    6.374913] brcmfmac: power management disabled
[    7.859640] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1
[  100.187105] random: crng init done
- config.txt

Code: Select all

disable_splash=1

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
lcd_rotate=2

# pretend all audio formats unsupported by display, forcing analog output instead.
#hdmi_ignore_edid_audio=1

# force output to HDMI for users who plug the HDMI screen after boot
#hdmi_force_hotplug=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan#
disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=800
#framebuffer_height=600

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# increase if you get problems with graphics intensive apps
gpu_mem=256

# Uncomment this line to set the HDMI as the primary display
# You might need this flag if using RaspberryPI touch screen
#display_default_lcd=0

# for more options see http://elinux.org/RPi_config.txt
dtparam=i2c_arm=on
dtoverlay=goodix

dtdebug=on
- cmdline.txt

Code: Select all

dwc_otg.lpm_enable=0 logo.nologo console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 usbcore.autosuspend=-1 elevator=deadline rootwait quiet consoleblank=0 loglevel=1 

Killjoy99
Posts: 4
Joined: Tue Jun 06, 2017 7:06 pm

Re: RPI3 and Goodix GT9271 Touchscreen

Wed Jun 07, 2017 4:58 pm

PhilE,

:D :D :D :D :D
After hours of scoping the hardware lines and reading through documentation its actually alive. System is running and i'm able to
get all 10 fingers of multi-touch inside my app. Reboot the system and its gone again, no input device, nothing. Went back over the commands you sent me and it looks like "sudo modprobe goodix" brings everything back. I've read over the info on modprobe and it looks like I can add goodix to "/etc/module" in order to get it to load at boot. Giving that a try now.

- Brian

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1822
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: RPI3 and Goodix GT9271 Touchscreen

Wed Jun 07, 2017 8:29 pm

I'm happy your making progress, but I still don't understand why the loading isn't automatic since it ought to be - that it was the module aliases are for.

Aha - got it. Because you aren't running Raspbian you won't have a special udev rule (part of the raspberrypi-sysmods package) to work around a peculiarity of I2C aliases.

Code: Select all

[email protected] ~ $ grep goodix /lib/modules/`uname -r`/modules.alias
alias i2c:GDIX1001:00 goodix
alias of:N*T*Cgoodix,gt967C* goodix
alias of:N*T*Cgoodix,gt967 goodix
alias of:N*T*Cgoodix,gt928C* goodix
alias of:N*T*Cgoodix,gt928 goodix
alias of:N*T*Cgoodix,gt9271C* goodix
alias of:N*T*Cgoodix,gt9271 goodix
alias of:N*T*Cgoodix,gt927C* goodix
alias of:N*T*Cgoodix,gt927 goodix
alias of:N*T*Cgoodix,gt912C* goodix
alias of:N*T*Cgoodix,gt912 goodix
alias of:N*T*Cgoodix,gt9110C* goodix
alias of:N*T*Cgoodix,gt9110 goodix
alias of:N*T*Cgoodix,gt911C* goodix
alias of:N*T*Cgoodix,gt911 goodix
This command shows all of the aliases for the goodix module - "i2c" aliases and "of" (Device Tree) aliases. Unfortunately the normal udev rule only looks up the i2c alias, so the compatible string would have to say "<something>,GDIX1001" and the distinction about which specific device is required would be lost.

The workaround is to create a custom shell command and a udev rule to run it. The shell command calls modprobe using the i2c alias, but if that fails it tries the device tree alias instead.

The shell command:

Code: Select all

[email protected] ~ $ cat /usr/lib/raspberrypi-sys-mods/i2cprobe 
#!/bin/sh
modprobe ${MODALIAS} || modprobe "of:N${OF_NAME}T<NULL>C${OF_COMPATIBLE_0}"
And the udev rule:

Code: Select all

[email protected] ~ $ cat /lib/udev/rules.d/15-i2c-modprobe.rules 
SUBSYSTEM=="i2c", ENV{MODALIAS}=="?*", ENV{OF_NAME}=="?*", ENV{OF_COMPATIBLE_0}=="?*", RUN+="/usr/lib/raspberrypi-sys-mods/i2cprobe"
You can rename or move the command provided you modify the rule to match, but make sure the command is executable:

Code: Select all

chmod a+x /usr/lib/raspberrypi-sys-mods/i2cprobe
With that done, the goodix module should load automatically.

tanzilli
Posts: 2
Joined: Tue Sep 12, 2017 4:53 pm

Re: RPI3 and Goodix GT9271 Touchscreen

Tue Sep 12, 2017 5:08 pm

I'm designing a very basic terminal with the Raspberry Compute Module, a Chinese 7 inch TFT display with DPI interface and capacitive touch. This is the working overlay I'm using. Please note the I2C address on 0x5D instead of 0x14. And the new pin for SDA,SCL,RES and INT.

Code: Select all

// Device tree overlay for I2C connected Goodix gt9271 multiple touch controller
// Acme Systems version for 7 inch DPI display
/dts-v1/;
/plugin/;

/ {
        compatible = "brcm,bcm2708";

        [email protected] {
                target = <&gpio>;
                __overlay__ {
                        goodix_pins: goodix_pins {
                                brcm,pins = <30 31>; // interrupt and reset
                                brcm,function = <0 0>; // in
                                brcm,pull = <2 2>; // pull-up
                        };
                };
        };

        [email protected] {
                target = <&i2c0>;
                __overlay__ {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        status = "okay";

                        gt9271: [email protected] {
                                compatible = "goodix,gt9271";
                                reg = <0x5D>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&goodix_pins>;
                                interrupt-parent = <&gpio>;
                                interrupts = <30 2>; // high-to-low edge triggered
                                irq-gpios = <&gpio 30 0>; 
                                reset-gpios = <&gpio 31 0>;
                        };
                };
        };
};
To generate the binary overlay use:
sudo dtc [email protected] -I dts -O dtb -o /boot/overlays/goodix-7-acme.dtbo goodix-7-acme.dts

These are the lines to add on /boot/config.txt:

Code: Select all

#Enable the DPI interface on GPIO0 to GPIO21
dtoverlay=dpi18
overscan_left=0
overscan_right=0
overscan_top=0
overscan_bottom=0
framebuffer_width=800
framebuffer_height=480
enable_dpi_lcd=1
display_default_lcd=1
dpi_group=2
dpi_mode=87
dpi_output_format=0x6f005
hdmi_timings=800 0 40 48 88 480 0 13 3 32 0 0 0 60 0 32000000 6

#Move the I2C to GPIO 28 an 29
dtoverlay=i2c0-bcm2708,sda0_pin=28,scl0_pin=29

#Add the updated goodix driver
dtoverlay=goodix-7-acme 


marton
Posts: 3
Joined: Sun Mar 18, 2018 9:30 pm

Re: RPI3 and Goodix GT9271 Touchscreen

Sun Jul 08, 2018 9:22 am

Hi,

I am trying to make a Sharp LS035Y8DX04A screen work which also has a Goodix touch controller. The display part works but I am having trouble making the Goodix GT911 touch controller to function.

I can see it on i2c:

Code: Select all

# i2cdetect -y 3
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- 5d -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --    
It is at 0x5d.

I am using this overlay:

Code: Select all

// Device tree overlay for I2C connected Goodix gt911 touch controller
/dts-v1/;
/plugin/;

/ {
        compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";

        [email protected] {
                target = <&gpio>;
                __overlay__ {
                        goodix_pins: goodix_pins {
                                brcm,pins = <26 19>; // interrupt and reset
                                brcm,function = <0 0>; // in
                                brcm,pull = <2 2>; // pull-up
                        };
                };
        };

        [email protected] {
                target = <&i2c0>;
                __overlay__ {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        status = "okay";

                        gt911: [email protected] {
                                compatible = "goodix,gt911";
                                reg = <0x5d>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&goodix_pins>;
                                interrupt-parent = <&gpio>;
                                interrupts = <26 2>; // high-to-low edge triggered
                                irq-gpios = <&gpio 26 0>; 
                                reset-gpios = <&gpio 19 0>;
                        };
                };
        };
};
I can see with vcdbg log msg that the overlay is loaded:

Code: Select all

001780.989: brfs: File read: /mfs/sd/overlays/touch.dtbo
001790.874: Loaded overlay 'touch'
However there's no device in /dev/input, just the mice. Could you help me with some pointers where should I try to troubleshoot this?

Thank you!

Marton

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1822
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: RPI3 and Goodix GT9271 Touchscreen

Mon Jul 09, 2018 1:35 pm

You are running i2cdetect and finding the touchscreen on I2C bus 3, but you are declaring the touchscreen controller to be on I2C bus 0, so I wouldn't expect it to work.

Which I2C bus are you actually using? On a regular Pi you should avoid i2c0 (unless it is a very early Model B) and use i2c1 instead. i2c3 looks like it might be a bit-bashed bus on some GPIO pins (using `dtoverlay=i2c-gpio`). If you want to use the touchscreen on i2c3 you will need to replace:

Code: Select all

target = <&i2c0>;
with

Code: Select all

target = <&i2c3>;

marton
Posts: 3
Joined: Sun Mar 18, 2018 9:30 pm

Re: RPI3 and Goodix GT9271 Touchscreen

Mon Jul 09, 2018 4:32 pm

Thanks! I have tried with

Code: Select all

target = <&i2c3>;
but then I got the following error:

Code: Select all

dterror: can't find symbol 'i2c3'
.

I am setting the i2c up the following way:

Code: Select all

[email protected] {
        target-path = "/";
        __overlay__ {
            i2c_gpio: [email protected] {
                compatible = "i2c-gpio";
                gpios = <&gpio 10 0 /* sda */
                    &gpio 11 0 /* scl */
                    >;
                i2c-gpio,delay-us = <4>;
                #address-cells = <1>;
                #size-cells = <0>;
            };
        };
    };

    [email protected] {
        target = <&i2c_arm>;
        __overlay__ {
            status = "disabled";
        };
    };

    [email protected] {
        target-path = "/aliases";
        __overlay__ {
            i2c_gpio = "/[email protected]";
        };
    };

    [email protected] {
        target-path = "/__symbols__";
        __overlay__ {
            i2c_gpio = "/[email protected]";
        };
    };
It works with 2 other i2c devices, but I talk to those through python.

I managed to get it show up in dmesg, but I got the following error:

Code: Select all

[    5.683636] i2c-gpio [email protected]: using pins 10 (SDA) and 11 (SCL)
[    6.023432] Goodix-TS 0-005d: i2c test failed attempt 1: -121
[    6.063653] Goodix-TS 0-005d: i2c test failed attempt 2: -121
[    6.103008] Goodix-TS 0-005d: I2C communication failure: -121
[    6.103115] Goodix-TS: probe of 0-005d failed with error -121
I can talk to the touch IC with python.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1822
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: RPI3 and Goodix GT9271 Touchscreen

Mon Jul 09, 2018 4:41 pm

Your i2c-gpio overlay exports the symbol "i2c_gpio" for the new I2C bus, so the following ought to work:

Code: Select all

target = <&i2c_gpio>;

marton
Posts: 3
Joined: Sun Mar 18, 2018 9:30 pm

Re: RPI3 and Goodix GT9271 Touchscreen

Mon Jul 09, 2018 4:47 pm

Thank you! It works now! :)

Return to “Device Tree”

Who is online

Users browsing this forum: No registered users and 1 guest