Anyone use STMPE610 TS IRQ?

Has anyone tried using the touchscreen IRQ to trigger an action on an esp32? I've been unsuccessful despite much effort. I would greatly appreciate another set of eyes over all of this. I'm assuming something obvious is missing, but can't figure it out.

Here's what I have:
-esp32 Devkit
-STMPE610 on a 7789 TFT
-1Mohm Pullup resistor on the IRQ circuit

I have only been able to get a constant repeating IRQ trigger with 1Mohm Pullup attached and the following code: ANY changes results in no IRQ triggering. Have exhaustively tried many combinations of settings for the STMPE610

#include "Adafruit_STMPE610.h"    //https://github.com/adafruit/Adafruit_STMPE610
#include <Arduino.h>
unsigned long pTime1 = millis();  //For delays
unsigned long pTime2 = millis();
#define TSINT 26                  //esp32 GPIO26 - TS IRQ Input from STMPE610
volatile int IRQTrigger = 0;      //Flag for IRQ occurance 
Adafruit_STMPE610 touch = Adafruit_STMPE610();
portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;

void IRAM_ATTR TSisr() {
  detachInterrupt(TSINT);
  portENTER_CRITICAL_ISR(&mux);
    IRQTrigger = 1;           //IRQ Flag
  portEXIT_CRITICAL_ISR(&mux);
  // attachInterrupt(TSINT, TSisr, FALLING);  //Reattach here or later?
}

void setup() {
  Serial.begin(115200);
  touch.begin(0x41);
  pinMode(TSINT, INPUT_PULLUP);               //ALSO tried 1M Ohm to 3V3
  Serial.println("Starting");
  touch.writeRegister8(STMPE_INT_STA, 0xFF);  // reset all ints
  //Following are for TESTING
  // touch.writeRegister8(STMPE_INT_CTRL, STMPE_INT_CTRL_POL_LOW);  //Set Low on INT
  // touch.writeRegister8(STMPE_INT_CTRL, STMPE_INT_CTRL_POL_HIGH); //Set High on INT
  // touch.writeRegister8(STMPE_INT_CTRL, STMPE_INT_CTRL_EDGE);     //SET INT output to Edge
  // touch.writeRegister8(STMPE_INT_CTRL, STMPE_INT_CTRL_LEVEL);    //SET INT output to Level
  // touch.writeRegister8(STMPE_INT_CTRL, STMPE_INT_EN);
  attachInterrupt(TSINT, TSisr, FALLING);
}

void loop() {
  unsigned long cTime = millis();
  uint16_t x, y;
  uint8_t z;
  if (touch.touched()) {
    // read x & y & z;
    while (!touch.bufferEmpty()) {
      Serial.print(touch.bufferSize());
      touch.readData(&x, &y, &z);
      Serial.print("->(");
      Serial.print(x); Serial.print(", ");
      Serial.print(y); Serial.print(", ");
      Serial.print(z);
      Serial.print(")  ");
      Serial.println(analogRead(TSINT));
    touch.writeRegister8(STMPE_INT_STA, 0xFF);
    }
    touch.writeRegister8(STMPE_INT_STA, 0xFF);
  }

  if (IRQTrigger == 1) {                          //Action when IRQ triggered
    Serial.println("          IRQ Triggered");
    IRQTrigger = 0;
    touch.writeRegister8(STMPE_INT_STA, 0xFF);
    attachInterrupt(TSINT, TSisr, FALLING);       //re-attach IRQ
  }
  
  if (cTime - pTime2 >= 300) {
    Serial.println(analogRead(TSINT));
    pTime2 = cTime;
  }
}

Please post schematics. 1 M Ohm is usually too much every ware. Read the datasheet to know what internal resistans there is. Else You create voltage dividers.

Thank you, I'll check the datasheet for the ADS1115.

Can't show the full schematics, but the circuitry is a direct connection between the ADS1115 TS IRQ and the esp32 GPIO26. Does that help?

To your feedback regarding the Pullup Resistance, here's what I found:

  • The ADS1115 TS IRQ is an open collector.
  • The esp32 GPIO26, I can't determine the internal resistance from the datasheet (not as well educated on deciphering it).

I understand voltage divider circuits and agree with your concern regarding choice of pullup resistor. Do you have any suggestions/insight regarding how to determine the internal resistance of the esp32 GPIO that would need to be considered in the equation? Couldn't find anything that made sense to me...

Reading datasheets is mandatory for knowing.
I suggest a 10 kOhm pullup resistor for that open collector output.
Please post the schematics showing the parts You tell about. Words can never replace it. Helpers don't take on the detective work to convert words to schematics.

Here's a copy of the relevant schematic showing a direct circuit "TS_INT" between the ADS1115 TS IRQ and the esp32 GPIO26. Seeking the best value for R5 PullUp resistor.

There are two boards for the display to be remotely mounted from the main board:


I suggest 10k Ohm. 1M, no, never seen such values.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.