Query Regarding ADS7846 Touchscreen Controller

Hi Team,

I have a few queries regarding the ADS7846 touchscreen controller and AM62 Sitara processor.

Development Environment

  • Hardware: Verdin Development Board with Verdin AM62 SoM (based on AM62 Sitara processor)

  • Display: 3.5" MSP3520 TFT

  • Display Controller: ILI9488

  • Touch Controller: ADS7846

  • Interface: SPI0 bus (shared between display and touchscreen on seperate CS)

The display and touchscreen share the same CLK, MOSI, and MISO lines — though MISO is only used by the touchscreen (not required by the display).
The display is connected to CS0, and the touchscreen is connected to CS1.

The ADS7846 driver is already available in the Linux kernel, so I have directly used it in my device tree overlay.

The display is working fine using my own application code (without using any external ILI9488 driver source).
I tested the touch functionality using evtest.

However, evtest is not providing any touch coordinates — it fails to show any touch data.


evtest Output

torizon@verdin-am62-15415886:~$ evtest
No device specified, trying to scan all of /dev/input/event*
Not running as root, no devices may be available.
Available devices:
/dev/input/event0:      gpio-keys
/dev/input/event1:      tps65219-pwrbutton
/dev/input/event2:      ADS7846 Touchscreen
Select the device event number [0-2]: 2
Input driver version is 1.0.1
Input device ID: bus 0x1c vendor 0x0 product 0x1ea6 version 0x0
Input device name: "ADS7846 Touchscreen"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 330 (BTN_TOUCH)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value      0
      Min        0
      Max     4095
    Event code 1 (ABS_Y)
      Value      0
      Min        0
      Max     4095
    Event code 24 (ABS_PRESSURE)
      Value      0
      Min        0
      Max      255
Properties:
Testing ... (interrupt to exit)
^C
### Not giving any touch coordinates when I touch the display


Troubleshooting Steps

1. ADS7846 Driver Loaded

$ cat /sys/bus/spi/devices/spi0.1/modalias
spi:ads7846

2. Both SPI Devices Registered

$ ls -la /sys/bus/spi/devices/
spi0.0 -> Display
spi0.1 -> Touchscreen

3. Device Nodes Present

/dev/spidev0.0 → Display
/dev/input/event2 → Touchscreen

4. Interrupt Count Increases on Touch

Before touch: 75857
After touch:  77781

5. SPI Transactions Occurring (verified through /sys/class/spi_master/spi0/statistics)

  • Byte count and message count increase when the screen is touched.

6. GPIO Verified

SODIMM_212 configured as Touch Interrupt (gpio-535 | pendown)

The GPIO input correctly transitions from high → low → high when touching and releasing the screen.

7. pen_down Value Always 0

$ cat /sys/bus/spi/devices/spi0.1/pen_down
0

Expected: The value should go 1 when touched, but it remains 0 always.


Device Tree Overlay
(verdin-am62_msp3520_tft_display_spi3_overlay.dts)

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include "k3-pinctrl.h"

/ {
    compatible = "toradex,verdin-am62";
};

/* Disable HDMI and conflicting peripherals */
&{/hdmi-connector}, &{/bus@f0000/i2c@20010000/hdmi@48}, &{/connector} {
    status = "disabled";
};

/* Disable PWM modules */
&epwm0 { status = "disabled"; };
&epwm1 { status = "disabled"; };

/* SPI0 (Verdin SPI_3) pin configuration */
&main_pmx0 {
    spi3_pins_default: spi3-default-pins {
        pinctrl-single,pins = <
            AM62X_IOPAD(0x01bc, PIN_OUTPUT, 0) /* SPI0_CLK - SODIMM 19 */
            AM62X_IOPAD(0x01b4, PIN_OUTPUT, 0) /* SPI0_CS0 - SODIMM 15 */
            AM62X_IOPAD(0x01b8, PIN_OUTPUT, 0) /* SPI0_CS1 - SODIMM 16 */
            AM62X_IOPAD(0x01c4, PIN_OUTPUT, 0) /* SPI0_D1 (MOSI) - SODIMM 161 */
            AM62X_IOPAD(0x01c0, PIN_INPUT, 0)  /* SPI0_D0 (MISO) - SODIMM 66 */
        >;
    };
};

/* MCU GPIO pins (SODIMM_206–212) configuration */
&mcu_pmx0 {
    pinctrl_sodimm_212_gpio: sodimm-212-gpio-pins {
        pinctrl-single,pins = <
            AM62X_MCU_IOPAD(0x0010, PIN_INPUT, 7) /* MCU_GPIO0_4 - Touch IRQ */
        >;
    };
};

&main_spi0 {
    pinctrl-names = "default";
    pinctrl-0 = <&spi3_pins_default>;
    status = "okay";
    ti,spi-num-cs = <2>;
    #address-cells = <1>;
    #size-cells = <0>;

    /* MSP3520 Display on CS0 */
    msp3520_display@0 {
        compatible = "rohm,dh2228fv";
        reg = <0>;
        spi-max-frequency = <32000000>;
        reset-gpios = <&mcu_gpio0 2 GPIO_ACTIVE_LOW>;
        dc-gpios = <&mcu_gpio0 1 GPIO_ACTIVE_HIGH>;
        led-gpios = <&mcu_gpio0 3 GPIO_ACTIVE_HIGH>;
    };

    /* ADS7846 Touchscreen on CS1 */
    msp3520_touch@1 {
        compatible = "ti,ads7846";
        reg = <1>;
        spi-max-frequency = <1250000>;
        vcc-supply = <&reg_3v3>;
        interrupt-parent = <&mcu_gpio0>;
        interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
        pendown-gpio = <&mcu_gpio0 4 GPIO_ACTIVE_LOW>;
        ti,x-plate-ohms = /bits/16 <400>;
        ti,pressure-max = /bits/16 <255>;
        ti,x-min = /bits/16 <0>;
        ti,x-max = /bits/16 <4095>;
        ti,y-min = /bits/16 <0>;
        ti,y-max = /bits/16 <4095>;
        ti,settle-delay-usec = /bits/16 <150>;
        ti,penirq-recheck-delay-usecs = /bits/16 <100>;
        ti,vref-delay-usecs = /bits/16 <100>;
        ti,vref-mv = /bits/16 <3300>;
        ti,debounce-rep = /bits/16 <1>;
        ti,debounce-tol = /bits/16 <50>;
        ti,debounce-max = /bits/16 <3>;
        ti,keep-vref-on;
        wakeup-source;
    };
};


Summary

  • ADS7846 driver is successfully probed and interrupts are triggered on touch.

  • SPI transactions are occurring correctly.

  • GPIO input toggles as expected on touch.

  • However, pen_down value remains 0, and evtest does not display any touch coordinates.

Could you please review and suggest what might be causing the pen_down status to remain low and why touch coordinates are not reported despite valid SPI and interrupt activity?
Also, can we use shared bus for both display and touchscreen? Did touch controller (ADS7846) demands seperate bus?

Thanks & Regards,
Meenakshy

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


ADS7846 Touchscreen Configuration on Verdin AM62

Based on your configuration and troubleshooting steps, I can see several potential issues with your ADS7846 touchscreen setup. Let me address your questions and provide guidance.

Shared SPI Bus Support

Yes, you can use a shared SPI bus for both display and touchscreen controllers (1). The Toradex documentation confirms that SPI devices can share the same bus with different chip select (CS) lines, which is exactly what you’re doing with CS0 for display and CS1 for touchscreen (1).

Device Tree Configuration Issues

Looking at your device tree overlay, there are several areas that need attention:

1. Pin Configuration Problems

Your current pin configuration has some issues (2). The Verdin AM62 SPI pin assignments need to be verified against the module datasheet. According to the pin multiplexing guidance (2), you should:

  1. Check the SoM datasheet for the correct pin assignments for SPI_3 (SPI0) on Verdin AM62
  2. Verify the pin control group that contains your SPI signals
  3. Ensure proper pin functions are configured

2. GPIO Configuration

The MCU GPIO configuration for the touch interrupt may need adjustment. Based on the device tree overlay writing guidelines (2), ensure that:

  • The GPIO controller reference is correct
  • The interrupt configuration matches the hardware setup
  • The pendown GPIO is properly configured

3. Device Tree Overlay Structure

Your overlay structure looks generally correct, but consider these improvements based on the overlay writing guide (2):

&main_spi0 {
    pinctrl-names = "default";
    pinctrl-0 = <&spi3_pins_default>;
    status = "okay";
    #address-cells = <1>;
    #size-cells = <0>;
    
    /* Your existing device configurations */
};

Troubleshooting Steps

1. Verify Pin Multiplexing

According to the device tree overlay documentation (2), you should:

  1. Identify the correct pin control group for your SPI signals
  2. Locate the bus node that corresponds to the pin control group
  3. Check the register address in the root node

2. Check Device Tree Application

Verify that your overlay is properly applied (2):

# Check if the overlay was successfully applied
cat /proc/device-tree/chosen/overlays/applied

3. SPI Bus Verification

Following the SPI troubleshooting guide (1), verify your SPI bus configuration:

# List available SPI buses
ls -l /sys/bus/spi/devices/

# Check SPI controller statistics
cat /sys/class/spi_master/spi0/statistics/messages

Common Issues and Solutions

1. Pen Down Detection

The fact that pen_down remains 0 suggests:

  • GPIO polarity issue: Check if GPIO_ACTIVE_LOW is correct for your hardware
  • Interrupt configuration: Verify the interrupt type matches your hardware
  • Pull-up/pull-down configuration: The pin may need proper pull configuration

2. Interrupt Configuration

Based on the overlay examples (2), ensure your interrupt configuration is correct:

interrupts = <4 IRQ_TYPE_EDGE_FALLING>;

Consider trying IRQ_TYPE_LEVEL_LOW if your hardware uses level-triggered interrupts.

Recommendations

  1. Verify Hardware Connections: Double-check that your touchscreen interrupt line is properly connected to the configured GPIO pin

  2. Check Voltage Levels: Ensure your touchscreen operates at the correct voltage level for Verdin AM62 (1.8V for Verdin modules) (1)

  3. Test with Minimal Configuration: Try a simplified device tree configuration with just the essential parameters

  4. Enable Debug Logging: Add kernel debug parameters to get more detailed information about the ADS7846 driver initialization

  5. Review Pin Assignments: Use the Verdin AM62 datasheet to verify that SODIMM_212 is correctly configured for GPIO functionality

The shared SPI bus approach is valid, but the device tree configuration needs refinement to properly handle the ADS7846 touchscreen controller on your Verdin AM62 setup.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Hi @Meenakshy!

We’ll continue the support in this other thread.

Best regards.