Skip to content

TouchInterrupt not work on T8 ESP32 #12006

@CodeNameHawk

Description

@CodeNameHawk

Board

ESP32_Core_board_v2

Device Description

On gpio33 10 cm wire.

Hardware Configuration

No, only wire on gio33.

Version

v3.3.3

Type

Bug

IDE Name

VSCode

Operating System

Ubuntu

Flash frequency

80MHz

PSRAM enabled

no

Upload speed

921600

Description

Change sketch TouchInterrupt to use T8, not work.

Touch wire not work. I try change touchSetDefaultThreshold(5); from 0 to 50 not work.

On T0, T2 - T7 and T9 work.

Sketch

/*
This is an example how to use Touch Intrrerupts
The bigger the threshold, the more sensible is the touch
*/

int threshold = 0; // if 0 is used, benchmark value is used. Its by default 1,5% change, can be changed by touchSetDefaultThreshold(float percentage)

bool touch8detected = false;

void gotTouch8()
{
  touch8detected = true;
}

void setup()
{
  Serial.begin(115200);
  delay(1000); // give me time to bring up serial monitor

  // Optional: Set the threshold to 5% of the benchmark value. Only effective if threshold = 0.
  touchSetDefaultThreshold(5);

  Serial.println("ESP32 Touch Interrupt Test");

  touchAttachInterrupt(T8, gotTouch8, threshold);
}

void loop()
{
   if (touch8detected)
   {
     touch8detected = false;
     Serial.println("Touch 8 detected");
   }
     
  // if (touch8detected)
  // {
  //   touch8detected = false;
  //   if (touchInterruptGetLastStatus(T8))
  //   {
  //     Serial.println(" --- T8 Touched");
  //   }
  //   else
  //   {
  //     Serial.println(" --- T8 Released");
  //   }
  // }
}

Debug Message

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4980
load:0x40078000,len:16612
load:0x40080400,len:3480
entry 0x400805b4
[     3][D][esp32-hal-cpu.c:276] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
=========== Before Setup Start ===========
Chip Info:
------------------------------------------
  Model             : ESP32
  Package           : D0WD-Q6
  Revision          : 0.00
  Cores             : 2
  CPU Frequency     : 240 MHz
  XTAL Frequency    : 40 MHz
  Features Bitfield : 0x00000032
  Embedded Flash    : No
  Embedded PSRAM    : No
  2.4GHz WiFi       : Yes
  Classic BT        : Yes
  BT Low Energy     : Yes
  IEEE 802.15.4     : No
------------------------------------------
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   378936 B ( 370.1 KB)
  Free Bytes        :   337568 B ( 329.7 KB)
  Allocated Bytes   :    34092 B (  33.3 KB)
  Minimum Free Bytes:   331940 B ( 324.2 KB)
  Largest Free Block:   110580 B ( 108.0 KB)
------------------------------------------
Flash Info:
------------------------------------------
  Chip Size         :  4194304 B (4 MB)
  Block Size        :    65536 B (  64.0 KB)
  Sector Size       :     4096 B (   4.0 KB)
  Page Size         :      256 B (   0.2 KB)
  Bus Speed         : 80 MHz
  Flash Frequency   : 80 MHz (source: 80 MHz, divider: 1)
  Bus Mode          : QIO
------------------------------------------
Partitions Info:
------------------------------------------
                nvs : addr: 0x00009000, size:    20.0 KB, type: DATA, subtype: NVS
            otadata : addr: 0x0000E000, size:     8.0 KB, type: DATA, subtype: OTA
               app0 : addr: 0x00010000, size:  1280.0 KB, type:  APP, subtype: OTA_0
               app1 : addr: 0x00150000, size:  1280.0 KB, type:  APP, subtype: OTA_1
             spiffs : addr: 0x00290000, size:  1408.0 KB, type: DATA, subtype: SPIFFS
           coredump : addr: 0x003F0000, size:    64.0 KB, type: DATA, subtype: COREDUMP
------------------------------------------
Software Info:
------------------------------------------
  Compile Date/Time : Nov 10 2025 15:39:14
  Compile Host OS   : linux
  ESP-IDF Version   : v5.5.1-418-gf1a1df9b2e
  Arduino Version   : 3.3.3
------------------------------------------
Board Info:
------------------------------------------
  Arduino Board     : ESP32_DEV
  Arduino Variant   : esp32
  Arduino FQBN      : esp32:esp32:esp32:JTAGAdapter=default,PSRAM=disabled,PartitionScheme=default,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,LoopCore=1,EventsCore=1,DebugLevel=debug,EraseFlash=none,ZigbeeMode=default
============ Before Setup End ============
ESP32 Touch Interrupt Test
=========== After Setup Start ============
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   378936 B ( 370.1 KB)
  Free Bytes        :   334512 B ( 326.7 KB)
  Allocated Bytes   :    36732 B (  35.9 KB)
  Minimum Free Bytes:   328920 B ( 321.2 KB)
  Largest Free Block:   110580 B ( 108.0 KB)
------------------------------------------
GPIO Info:
------------------------------------------
  GPIO : BUS_TYPE[bus/unit][chan]
  --------------------------------------  
     1 : UART_TX[0]
     3 : UART_RX[0]
    33 : TOUCH[8]
============ After Setup End =============
Touch 8 detected

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions