<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[M5Paper touchscreen wakeup on GPIO 36 constantly triggering]]></title><description><![CDATA[<p dir="auto">From the old topic <a href="/topic/3085/m5paper-touchscreen-wakeup-from-sleep">M5paper touchscreen wakeup from sleep</a> I got the following code to go into light sleep with wakeup on a touchscreen event:</p>
<pre><code class="language-cpp">esp_sleep_enable_ext0_wakeup(GPIO_NUM_36, LOW); // TOUCH_INT
esp_light_sleep_start();
</code></pre>
<p dir="auto">However, the device immediately wakes with <code>RTC_IO</code> as reason. If I comment out the <code>esp_sleep_enable_ext0_wakeup</code> line, it stays in light sleep. I have no idea what is going on. The original (linked) topic mentions WiFi as a problem source, but I don't use WiFi in this project and so it is never enabled.</p>
<p dir="auto">I tried <code>gpio_pullup_en(GPIO_NUM_36);</code> before going to sleep but it makes no difference. I initialize the device using <code>M5.begin(true, false, false, true, false);</code> so the touch screen should be enabled and active.</p>
<p dir="auto">Any thoughts?</p>
<p dir="auto">EDIT: maybe worth noting: this happens both when using PlatformIO in VSCode as well as with Arduino IDE. I can reproduce it with just this sketch as an .ino, which shows "Wakeup &lt;x&gt;" with a continuously increasing number as fast as it can:</p>
<pre><code class="language-cpp">#include &lt;M5EPD.h&gt;

M5EPD_Canvas canvas(&amp;M5.EPD);

void setup(){
  M5.begin();
  M5.EPD.SetRotation(90);
  M5.EPD.Clear(true);
  M5.RTC.begin(); 
  canvas.createCanvas(540, 50);
  canvas.setTextSize(3);
  canvas.drawString("Hello World", 10, 20);
  canvas.pushCanvas(0, 960/2 - 50/2, UPDATE_MODE_DU4);
}

void light_sleep_with_touch_wakeup() {
  esp_sleep_enable_ext0_wakeup(GPIO_NUM_36, LOW); // TOUCH_INT
  esp_light_sleep_start();
}

void loop(){
  static char buffer[128];
  static int i = 0;
  
  light_sleep_with_touch_wakeup();
  
  snprintf(buffer, sizeof(buffer), "Wakeup %d", ++i);
  canvas.clear();
  canvas.drawString(buffer, 10, 20);
  canvas.pushCanvas(0, 960/2 - 50/2, UPDATE_MODE_DU4);
}
</code></pre>
<p dir="auto">EDIT2: I dug a little deeper, opened up the M5Paper and probed the INT pin with a scope. Apparently it's not an ESP32 issue but a GT911 issue! I guess I must be missing some configuration for it. When I'm not touching it, it pulses high at ~24Hz. When I touch it, it pulses at ~48Hz:</p>
<p dir="auto"><img src="/assets/uploads/files/1699906818056-2118edea-7f7d-46d7-af95-25f2bed27728-image-resized.png" alt="not touching" class=" img-fluid img-markdown" /><br />
<img src="/assets/uploads/files/1699906857303-5984672a-0ac8-4e2b-be65-c524e86b4966-image-resized.png" alt="touching" class=" img-fluid img-markdown" /></p>
<p dir="auto">EDIT3: Aha, I finally cracked it! The scope plots made me look up the datasheet of the GT911, which states the following:</p>
<blockquote>
<p dir="auto">The timing sequence for GT911 interrupt signal output (take the rising-edge triggered interrupt for example.<br />
The timing for falling-edge triggered interrupt is similar to this one):</p>
<ol>
<li>In standby mode, INT outputs low level.</li>
<li>Output rising edge when any coordinate is updated.</li>
<li>After output rising edge in step 2, INT will keep outing high level until next cycle (the cycle is configurable<br />
by setting Refresh_Rate). The host is supposed to finish the reading within one cycle and reset buffer status<br />
(0x814E) to 0.</li>
<li>After output rising-edge in step 2, if the host fails to finish reading coordinates within one cycle, GT911 will<br />
output one INT pulse again instead of update coordinates even if it detects that the coordinate is updated.</li>
<li>If the host still fails to read coordinate, GT911 will keep outputting INT pulse.</li>
</ol>
</blockquote>
<p dir="auto">In other words, if you don't read the coordinates from the touch screen, <em>it will keep outputting an interrupt until you do</em></p>
<p dir="auto">So the solution ended up being to put <code>M5.TP.flush()</code> before going to sleep (or calling <code>M5.TP.update()</code> anywhere before going to sleep, which you would need to do anyway to respond to touch events).</p>
<p dir="auto">Case closed :-)</p>
]]></description><link>https://community.m5stack.com/topic/5802/m5paper-touchscreen-wakeup-on-gpio-36-constantly-triggering</link><generator>RSS for Node</generator><lastBuildDate>Sat, 16 May 2026 21:55:50 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/5802.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 13 Nov 2023 13:46:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5Paper touchscreen wakeup on GPIO 36 constantly triggering on Mon, 20 Nov 2023 09:23:51 GMT]]></title><description><![CDATA[<p dir="auto">Thanks, both, for these posts. I was able to resolve my issue with deep sleep by following your suggestions. I have created an issue in the M5 Unified issue tracker to solve this same bug in their M5.Power.deepSleep() implementation: <a href="https://github.com/m5stack/M5Unified/issues/91" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/m5stack/M5Unified/issues/91</a></p>
]]></description><link>https://community.m5stack.com/post/22834</link><guid isPermaLink="true">https://community.m5stack.com/post/22834</guid><dc:creator><![CDATA[sbesselsen]]></dc:creator><pubDate>Mon, 20 Nov 2023 09:23:51 GMT</pubDate></item><item><title><![CDATA[Reply to M5Paper touchscreen wakeup on GPIO 36 constantly triggering on Mon, 13 Nov 2023 20:53:07 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/remboooo" aria-label="Profile: Remboooo">@<bdi>Remboooo</bdi></a></p>
<p dir="auto">I just came back to report a similar finding. I've added below lines before going to sleep:</p>
<pre><code>  while(digitalRead(GPIO_NUM_36) == LOW)
  {
    M5.TP.flush();
    delay(100);
  }
</code></pre>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/22743</link><guid isPermaLink="true">https://community.m5stack.com/post/22743</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Mon, 13 Nov 2023 20:53:07 GMT</pubDate></item></channel></rss>