This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BeagleBone Black Touchscreen moves everywhere

Hi All,

I try now for two weeks to make my 7inch  touchscreen working on BBB.

You can find here a small video showing the problem and oscilloscope measurement on Sense on X and Y axis, the cursor moves everywhere.

My 4wire resistive touchscreen uses  BB-BONE-LCD7-01-A003.dts .

Linux kernel version is .4.19.

I measured X plate  resistance of 714ohm. Y resistance is 218 ohm.

I update X resistance value to 714 in the dts file. Wiring is x+an0,  x- an1,  y+ an2, y- an3.

As cursor moves everywhere, I am not able to do the calibration with the software that launch at start.

One line i don't understand in dts is :

ti,adc-channels = <4 5 6 7>;

Cause in all schematics i see of touchscreen for bbb, all uses an0,1,2,3 as adc channel. Moreover, it is not possible to use AN7 on BBB becase of a resistor divider on the line...



Thanks for your help or any comment ☺
  • I will forward this to the software team. They will respond here.
  • Thanks a lot . It is really important  for me !

  • Hi Florian,

    I can't see the video file, can you try reattaching it ?

    Also can you share your .dts?

    Best Regards,
    Yordan
  • Hi Yordan Thanks a lot here th link to the video:

    www.youtube.com/watch

    And i join you the .dts. i only change the field x resistance from 200 ( ohm i guess) to 766, the value i measured with my ohm resitor between x+ and x-.

    I also tried to change adc channel from 4 5 6 7 to 0 1 2 3 but seems to have ni impact. 

    It comes from bb-overlay github.

  • Hi Florian,

    I've seen similar behavior with a display connected to external adc. In my case what helped was, lowering the x_plate resistance to the minimal x_resistance described in TS datasheet.
    Also try lowering the clock.

    Just FYI, you say " i join you the .dts", but I can't see the BB-BONE-LCD7-01-A003.dts attached... Is it the same as:
    github.com/.../BB-BONE-LCD7-01-00A3.dts ?

    Best Regards,
    Yordan
  • So what means this s_plate resistance in reality and what is the minimum value we can put ?

    Cause dts documentation is not really precise on it. I guess it is the resistance you measure with multimeter placed between the x+ and x- without touching the touschscreen. by doing this, i measure 760 ohm something like that. So i'm far to the 200. 

    Concerning the dts yes its exactly this one i use. Concerning the screen it works quiet well.

    What i don't understood is the filed adc chanell . They use adc channel 4 5 6 7. Impossible to use the 7 ( see my first chat). so what does it means this channel number

    is it the one we read on the schematics and on AM335 pinout ?

     

    Thanks a lot for your support i really appreciate it and hope i could do something that works!

  • Soory i skip the file ...

    /*
     * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License version 2 as
     * published by the Free Software Foundation.
     */
    /dts-v1/;
    /plugin/;
    
    #include <dt-bindings/board/am335x-bbw-bbb-base.h>
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/pinctrl/am33xx.h>
    
    / {
    	compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";
    
    	/* identification */
    	part-number = "BB-BONE-LCD7-01";
    	version = "00A3";
    
    	/* state the resources this cape uses */
    	exclusive-use =
    		/* the pin header uses */
    		"P8.45",	/* lcd: lcd_data0 */
    		"P8.46",	/* lcd: lcd_data1 */
    		"P8.43",	/* lcd: lcd_data2 */
    		"P8.44",	/* lcd: lcd_data3 */
    		"P8.41",	/* lcd: lcd_data4 */
    		"P8.42",	/* lcd: lcd_data5 */
    		"P8.39",	/* lcd: lcd_data6 */
    		"P8.40",	/* lcd: lcd_data7 */
    		"P8.37",	/* lcd: lcd_data8 */
    		"P8.38",	/* lcd: lcd_data9 */
    		"P8.36",	/* lcd: lcd_data10 */
    		"P8.34",	/* lcd: lcd_data11 */
    		"P8.35",	/* lcd: lcd_data12 */
    		"P8.33",	/* lcd: lcd_data13 */
    		"P8.31",	/* lcd: lcd_data14 */
    		"P8.32",	/* lcd: lcd_data15 */
    		"P8.27",	/* lcd: lcd_vsync */
    		"P8.29",	/* lcd: lcd_hsync */
    		"P8.28",	/* lcd: lcd_pclk */
    		"P8.30",	/* lcd: lcd_ac_bias_en */
    		"P9.27",	/* lcd: gpio3_19 DISPEN */
    		"P9.12",	/* led: gpio1_28 LED */
    		"P9.14",	/* pwm: ehrpwm1a PWM_BL */
    		"P9.15",	/* keys: gpio1_16 LEFT */
    		"P9.23",	/* keys: gpio1_17 RIGHT */
    		"P9.16",	/* keys: gpio1_19 UP */
    		"P9.30",	/* keys: gpio3_16 DOWN */
    		"P9.21",	/* keys: gpio0_3 ENTER */
    
    		"ehrpwm1a",
    		"gpio3_19",	/* DISPEN */
    		"gpio1_28",	/* LED */
    		"gpio1_16",	/* LEFT */
    		"gpio1_17",	/* RIGHT */
    		"gpio1_19",	/* UP */
    		"gpio3_16",	/* DOWN */
    		"gpio0_3",	/* ENTER */
    		"lcdc",
    		"tscadc";
    
    	fragment@0 {
    		target = <&am33xx_pinmux>;
    		__overlay__ {
    
    			bb_lcd_led_pins: pinmux_bb_lcd_led_pins {
    				pinctrl-single,pins = <
    					BONE_P9_12 (PIN_INPUT | MUX_MODE7) /* gpmc_ben1.gpio1_28, INPUT | PULLDIS | MODE7 */
    				>;
    			};
    
    			bb_lcd_pwm_backlight_pins: pinmux_bb_lcd_pwm_backlight_pins {
    				pinctrl-single,pins = <
    					BONE_P9_14 (PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* gpmc_a2.ehrpwm1a */
    				>;
    			};
    
    			bb_lcd_lcd_pins: pinmux_bb_lcd_lcd_pins {
    				pinctrl-single,pins = <
    					BONE_P9_27 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* mcasp0_fsr.gpio3_19 */
    
    					BONE_P8_45 (PIN_OUTPUT | MUX_MODE0) /* lcd_data0.lcd_data0 */
    					BONE_P8_46 (PIN_OUTPUT | MUX_MODE0) /* lcd_data1.lcd_data1 */
    					BONE_P8_43 (PIN_OUTPUT | MUX_MODE0) /* lcd_data2.lcd_data2 */
    					BONE_P8_44 (PIN_OUTPUT | MUX_MODE0) /* lcd_data3.lcd_data3 */
    					BONE_P8_41 (PIN_OUTPUT | MUX_MODE0) /* lcd_data4.lcd_data4 */
    					BONE_P8_42 (PIN_OUTPUT | MUX_MODE0) /* lcd_data5.lcd_data5 */
    					BONE_P8_39 (PIN_OUTPUT | MUX_MODE0) /* lcd_data6.lcd_data6 */
    					BONE_P8_40 (PIN_OUTPUT | MUX_MODE0) /* lcd_data7.lcd_data7 */
    					BONE_P8_37 (PIN_OUTPUT | MUX_MODE0) /* lcd_data8.lcd_data8 */
    					BONE_P8_38 (PIN_OUTPUT | MUX_MODE0) /* lcd_data9.lcd_data9 */
    					BONE_P8_36 (PIN_OUTPUT | MUX_MODE0) /* lcd_data10.lcd_data10 */
    					BONE_P8_34 (PIN_OUTPUT | MUX_MODE0) /* lcd_data11.lcd_data11 */
    					BONE_P8_35 (PIN_OUTPUT | MUX_MODE0) /* lcd_data12.lcd_data12 */
    					BONE_P8_33 (PIN_OUTPUT | MUX_MODE0) /* lcd_data13.lcd_data13 */
    					BONE_P8_31 (PIN_OUTPUT | MUX_MODE0) /* lcd_data14.lcd_data14 */
    					BONE_P8_32 (PIN_OUTPUT | MUX_MODE0) /* lcd_data15.lcd_data15 */
    
    					BONE_P8_27 (PIN_OUTPUT | MUX_MODE0) /* lcd_vsync.lcd_vsync */
    					BONE_P8_29 (PIN_OUTPUT | MUX_MODE0) /* lcd_hsync.lcd_hsync */
    					BONE_P8_28 (PIN_OUTPUT | MUX_MODE0) /* lcd_pclk.lcd_pclk */
    					BONE_P8_30 (PIN_OUTPUT | MUX_MODE0) /* lcd_ac_bias_en.lcd_ac_bias_en */
    				>;
    			};
    
    			bb_lcd_keymap_pins: pinmux_bb_lcd_keymap_pins {
    				pinctrl-single,pins = <
    					BONE_P9_15 (PIN_INPUT | MUX_MODE7) /* gpmc_a0.gpio1_16 */
    					BONE_P9_23 (PIN_INPUT | MUX_MODE7) /* gpmc_a1.gpio1_17 */
    					BONE_P9_16 (PIN_INPUT | MUX_MODE7) /* gpmc_a3.gpio1_19 */
    					BONE_P9_30 (PIN_INPUT | MUX_MODE7) /* mcasp0_axr0.gpio3_16 */
    					BONE_P9_21 (PIN_INPUT | MUX_MODE7) /* spi0_d0.gpio0_3 */
    				>;
    			};
    		};
    	};
    
    	fragment@1 {
    		target = <&epwmss1>;
    		__overlay__ {
    			status = "okay";
    		};
    	};
    
    	fragment@2 {
    		target = <&ehrpwm1>;
    		__overlay__ {
    			pinctrl-names = "default";
    			pinctrl-0 = <&bb_lcd_pwm_backlight_pins>;
    			status = "okay";
    		};
    	};
    
    	fragment@3 {
    		target = <&lcdc>;
    		__overlay__ {
    			status = "okay";
    		};
    	};
    
    	fragment@4 {
    		target = <&tscadc>;
    		__overlay__ {
    
    			status = "okay";
    			tsc {
    				ti,wires = <4>;
    				/*ti,x-plate-resistance = <200>;*/
    				ti,x-plate-resistance = <766>;
    				ti,coordinate-readouts = <5>;
    				ti,wire-config = <0x00 0x11 0x22 0x33>;
    			};
    
    			adc {
    				ti,adc-channels = <4 5 6 7>;
    			};
    		};
    	};
    
    	fragment@5 {
    		target-path="/";
    		__overlay__ {
    
    			/* avoid stupid warning */
    			#address-cells = <1>;
    			#size-cells = <1>;
    
    			backlight {
    				status = "okay";
    				compatible = "pwm-backlight";
    				pwms = <&ehrpwm1 0 500000 0>;
    				brightness-levels = <
    					0  1  2  3  4  5  6  7  8  9
    					10 11 12 13 14 15 16 17 18 19
    					20 21 22 23 24 25 26 27 28 29
    					30 31 32 33 34 35 36 37 38 39
    					40 41 42 43 44 45 46 47 48 49
    					50 51 52 53 54 55 56 57 58 59
    					60 61 62 63 64 65 66 67 68 69
    					70 71 72 73 74 75 76 77 78 79
    					80 81 82 83 84 85 86 87 88 89
    					90 91 92 93 94 95 96 97 98 99
    					100
    				>;
    				default-brightness-level = <50>;
    			};
    
    			gpio-leds-cape-lcd {
    				compatible = "gpio-leds";
    				pinctrl-names = "default";
    				pinctrl-0 = <&bb_lcd_led_pins>;
    
    				lcd-led0 {
    					label = "lcd:green:usr0";
    					gpios = <&gpio1 28 0>;
    					linux,default-trigger = "heartbeat";
    					default-state = "off";
    				};
    			};
    
    			gpio_keys {
    				compatible = "gpio-keys";
    				pinctrl-names = "default";
    				pinctrl-0 = <&bb_lcd_keymap_pins>;
    
    				#address-cells = <1>;
    				#size-cells = <0>;
    
    				button@1 {
    					debounce_interval = <50>;
    					linux,code = <105>;
    					label = "left";
    					gpios = <&gpio1 16 0x1>;
    					gpio-key,wakeup;
    					autorepeat;
    				};
    				button@2 {
    					debounce_interval = <50>;
    					linux,code = <106>;
    					label = "right";
    					gpios = <&gpio1 17 0x1>;
    					gpio-key,wakeup;
    					autorepeat;
    				};
    				button@3 {
    					debounce_interval = <50>;
    					linux,code = <103>;
    					label = "up";
    					gpios = <&gpio1 19 0x1>;
    					gpio-key,wakeup;
    					autorepeat;
    				};
    				button@4 {
    					debounce_interval = <50>;
    					linux,code = <108>;
    					label = "down";
    					gpios = <&gpio3 16 0x1>;
    					gpio-key,wakeup;
    					autorepeat;
    				};
    				button@5 {
    					debounce_interval = <50>;
    					linux,code = <28>;
    					label = "enter";
    					gpios = <&gpio0 3 0x1>;
    					gpio-key,wakeup;
    				};
    			};
    
    			panel {
    				status = "okay";
    				compatible = "ti,tilcdc,panel";
    				pinctrl-names = "default";
    				pinctrl-0 = <&bb_lcd_lcd_pins>;
    				panel-info {
    					ac-bias           = <255>;
    					ac-bias-intrpt    = <0>;
    					dma-burst-sz      = <16>;
    					bpp               = <16>;
    					fdd               = <0x80>;
    					sync-edge         = <0>;
    					sync-ctrl         = <1>;
    					raster-order      = <0>;
    					fifo-th           = <0>;
    				};
    				display-timings {
    					native-mode = <&timing0>;
    					/* Settings for ThreeFive S9700RTWV35TR / LCD7 cape: */
    					timing0: 800x480 {
    						clock-frequency = <30000000>;
    						hactive = <800>;
    						vactive = <480>;
    						hfront-porch = <40>;
    						hback-porch = <40>;
    						hsync-len = <48>;
    						vback-porch = <30>;
    						vfront-porch = <13>;
    						vsync-len = <3>;
    						hsync-active = <0>;
    						vsync-active = <0>;
    						de-active = <1>;
    						pixelclk-active = <0>;
    					};
    				};
    			};
    		};
    	};
    };

  • Hi,

    Your understanding about x_plate resistance is correct, it represents the resistance between x+ & x-. It is used in the tscadc driver to calculate the touch coordinates & pressure. That is why I recommended going lower (to the minimal x_resistance defined in your display datasheet) than the actual measured resistance (in my past experienced this resulted in more precise coordinate & pressure calculation). Try playing with this value (try the minimal, maximal) and see when your display behaves better. I am not aware of a straightforward guide..

    What i don't understood is the filed adc chanell

    See Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt:
    - child "adc"
    ti,adc-channels: List of analog inputs available for ADC.
    AIN0 = 0, AIN1 = 1 and so on till AIN7 = 7.

    They use adc channel 4 5 6 7. Impossible to use the 7 ( see my first chat).

    You can change this to match your use case. Define the 4 channels you use for your touchscreen.

    Best Regards,
    Yordan
  • Thanks Yordan,

    As i bought my touchscreen on chinese site, there is no data available but i will try to play more with the value. I tried already 200 like you said before but i didn t see improvement.

    Concerning the adc channel, yes its seems to be more logical to use the one on which i wired my x and y plate.

    I will try this evening and i hope it will work.

    Thanks for really appreciated support !