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.

TSC2046: TSC2046 not work in TI SDK10 (AM62P)

Part Number: TSC2046
Other Parts Discussed in Thread: AM62P, , ADS7846

Tool/software:

Hi TI experts,

Our board is using TI AM62P SOC with SDK10 (kernel 6.6).

we have a TSC2046 touch in mcu_spi0 and GPIO0_7 for pen interrupt

So my dts as below

&main_pmx0 {
	bootph-all;
	// Touchscreen PEN IRQ
	penirq_pins: pinmux_penirq_pins {
		pinctrl-single,pins = <
			AM62PX_IOPAD(0x001c, PIN_INPUT, 7) /* (N21) OSPI0_D4.GPIO0_7 TS2046_PENIRQ */
		>;
	};
};	
&mcu_pmx0{
	// MCU_SPI0
	mcu_spi0_pins_default: mcu-spi0-pins-default {
		pinctrl-single,pins = <
			AM62PX_MCU_IOPAD(0x0008, PIN_OUTPUT, 0) /* (C10) MCU_SPI0_CLK */
			AM62PX_MCU_IOPAD(0x0000, PIN_OUTPUT, 0) /* (B10) MCU_SPI0_CS0 */
			AM62PX_MCU_IOPAD(0x000c, PIN_OUTPUT, 0) /* (B11) MCU_SPI0_D0 */
			AM62PX_MCU_IOPAD(0x0010, PIN_INPUT, 0) /* (D10) MCU_SPI0_D1 */
		>;
	};
};
&mcu_spi0{
		status = "okay";
		pinctrl-names = "default";
		pinctrl-0 = <&mcu_spi0_pins_default>;
		#address-cells = <1>;
		#size-cells= <0>;
		ti,pindir-d0-out-d1-in = <1>;

		tsc2046@0{
			reg = <0>;
			compatible = "ti,tsc2046";
			spi-max-frequency = <1000000>;
			pinctrl-names = "default";
			pinctrl-0 = <&penirq_pins>;
			interrupt-parent = <&main_gpio0>;
			interrupts = <7 IRQ_TYPE_NONE>;    /* (N21) OSPI0_D4.GPIO0_7 TS2046_PENIRQ */
			pendown-gpio = <&main_gpio0 7 GPIO_ACTIVE_HIGH>;

			ti,x-min = /bits/ 16 <0>;
			ti,x-max = /bits/ 16 <8000>;
			ti,y-min = /bits/ 16 <0>;
			ti,y-max = /bits/ 16 <4800>;

			ti,x-plate-ohms = /bits/ 16 <200>;
			/*ti,pressure-min = /bits/ 16 <50>;*/
			ti,pressure-max = /bits/ 16 <4095>;

			ti,debounce-max = /bits/ 16 <10>;
			ti,debounce-tol = /bits/ 16 <5>;
			ti,debounce-rep = /bits/ 16 <1>;

			ti,penirq-recheck-delay-usecs = /bits/ 16 <2>;
			/*ti,swap-xy;*/
			/*ti,settle-delay-usec = /bits/ 16 <150>;*/

			ti,vref-delay-usecs = /bits/ 16 <2>;
			ti,vref-mv = /bits/ 16 <0>;
			ti,keep-vref-on;

			wakeup-source;
		};
};

Currently, when I use ts_calibrate and ts_test, there is no response from the touch input.

I check the interrupt is ok, but dmesg show no spi_device_id for ti,tsc2046

root@am62pxx-evm:~# dmesg | grep ads
[    0.819277] SPI driver ads7846 has no spi_device_id for ti,tsc2046
[    0.825597] SPI driver ads7846 has no spi_device_id for ti,ads7843
[    0.831912] SPI driver ads7846 has no spi_device_id for ti,ads7845
[    0.838229] SPI driver ads7846 has no spi_device_id for ti,ads7873
[    6.109755] ads7846 spi0.0: supply vcc not found, using dummy regulator
[    6.124741] ads7846 spi0.0: touchscreen, irq 303
root@am62pxx-evm:~# cat /proc/interrupts | grep 303
303:     255937          0          0          0      GPIO   7 Edge    -davinci_gpio  ads7846

Could you help me check where the configuration error in my DTS?

  • Hi Daveon,

    I inserted debug messages into ads7846.c.

    I observed that when I first touched the panel, the code enters the ads7846_irq() function.

    After that, it remains stuck in the loop because get_pendown_state(ts) keeps returning true.

    https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/drivers/input/touchscreen/ads7846.c?h=ti-linux-6.6.y#n921

    But we do not touch the screen, I don't know why "get_pendown_state(ts)" always returns true.

  • Hi Yuyan.

    I have raised a note to see if we have a linux support expert for TSC device. Thank you for your patience

  • Hi Daveon,

    Update my status.
    Our EE found some setting is wrong, so I updated my DTS as below, but this DTS setting is working on kernel 5.10 with the same touchscreen (our previous generation machine, but using AM654. The peripheral circuitry for the TSC2046 has not changed.)

    &main_pmx0 {
    	bootph-all;
    	// Touchscreen PEN IRQ
    	penirq_pins: pinmux_penirq_pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x001c, PIN_INPUT, 7) /* (N21) OSPI0_D4.GPIO0_7 TS2046_PENIRQ */
    		>;
    	};
    };	
    &mcu_pmx0{
    	// MCU_SPI0
    	mcu_spi0_pins_default: mcu-spi0-pins-default {
    		pinctrl-single,pins = <
    			AM62PX_MCU_IOPAD(0x0008, PIN_OUTPUT, 0) /* (C10) MCU_SPI0_CLK */
    			AM62PX_MCU_IOPAD(0x0000, PIN_OUTPUT, 0) /* (B10) MCU_SPI0_CS0 */
    			AM62PX_MCU_IOPAD(0x000c, PIN_OUTPUT, 0) /* (B11) MCU_SPI0_D0 */
    			AM62PX_MCU_IOPAD(0x0010, PIN_INPUT, 0) /* (D10) MCU_SPI0_D1 */
    		>;
    	};
    };
    &mcu_spi0{
    		status = "okay";
    		pinctrl-names = "default";
    		pinctrl-0 = <&mcu_spi0_pins_default>;
    		#address-cells = <1>;
    		#size-cells= <0>;
    		ti,pindir-d0-out-d1-in = <1>;
    
    		tsc2046@0{
    			reg = <0>;
    			compatible = "ti,tsc2046";
    			spi-max-frequency = <1000000>;
    			pinctrl-names = "default";
    			pinctrl-0 = <&penirq_pins>;
    			interrupt-parent = <&main_gpio0>;
    			interrupts = <7 IRQ_TYPE_EDGE_FALLING>;    /* (N21) OSPI0_D4.GPIO0_7 TS2046_PENIRQ */
    			pendown-gpio = <&main_gpio0 7 IRQ_TYPE_EDGE_FALLING>;
    
    			ti,x-min = /bits/ 16 <0>;
    			ti,x-max = /bits/ 16 <8000>;
    			ti,y-min = /bits/ 16 <0>;
    			ti,y-max = /bits/ 16 <4800>;
    
    			ti,x-plate-ohms = /bits/ 16 <200>;
    			/*ti,pressure-min = /bits/ 16 <50>;*/
    			ti,pressure-max = /bits/ 16 <4095>;
    
    			ti,debounce-max = /bits/ 16 <10>;
    			ti,debounce-tol = /bits/ 16 <5>;
    			ti,debounce-rep = /bits/ 16 <1>;
    
    			ti,penirq-recheck-delay-usecs = /bits/ 16 <2>;
    			/*ti,swap-xy;*/
    			/*ti,settle-delay-usec = /bits/ 16 <150>;*/
    
    			ti,vref-delay-usecs = /bits/ 16 <2>;
    			ti,vref-mv = /bits/ 16 <2500>;
    			ti,keep-vref-on;
    
    			wakeup-source;
    		};
    };
    

    This is diff

    After updating the DTS, we can now properly exit the IRQ function. However, I noticed that the X and Y positions are still not updated.

    After using new DTS: 

    I observed that when I touched the screen. IRQ function will call ads7846_read_state()

    In this function will get fail 3 times from ads7846_filter() (then continue in while loop)

    After leaving ads7846_read_state(), next will call ads7846_report_state() function   
    And this function will return from here. and the debug message is "ignored 1 pressure 0"

    Could you tell me if I should modify any specific settings? Or how should I proceed with debugging this issue?
    Thanks!

  • Hi Daveon,

    Good news, our touch already can work 

    We updated the DTS setting

    		tsc2046@0{
    			reg = <0>;
    			compatible = "ti,tsc2046";
    			spi-max-frequency = <1000000>;
    			pinctrl-names = "default";
    			pinctrl-0 = <&penirq_pins>;
    			interrupt-parent = <&main_gpio0>;
    			interrupts = <7 IRQ_TYPE_EDGE_FALLING>;    /* (N21) OSPI0_D4.GPIO0_7 TS2046_PENIRQ */
    			pendown-gpio = <&main_gpio0 7 GPIO_ACTIVE_LOW>;
    
    			ti,x-min = /bits/ 16 <0>;
    			ti,x-max = /bits/ 16 <8000>;
    			ti,y-min = /bits/ 16 <0>;
    			ti,y-max = /bits/ 16 <4800>;
    
    			ti,x-plate-ohms = /bits/ 16 <400>;
    			ti,y-plate-ohms = /bits/ 16 <100>;
    			ti,pressure-min = /bits/ 16 <50>;
    			ti,pressure-max = /bits/ 16 <4095>;
    
    			ti,debounce-max = /bits/ 16 <10>;
    			ti,debounce-tol = /bits/ 16 <5>;
    			ti,debounce-rep = /bits/ 16 <1>;
    
    			ti,penirq-recheck-delay-usecs = /bits/ 16 <2>;
    			/*ti,swap-xy;*/
    			ti,settle-delay-usec = /bits/ 16 <15>;
    
    			ti,vref-delay-usecs = /bits/ 16 <2>;
    			ti,vref-mv = /bits/ 16 <0>;
    			ti,keep-vref-on;
    
    			wakeup-source;
    		};

    Thanks