<?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[Trouble getting touch button example code to work on M5 Tough.]]></title><description><![CDATA[<p dir="auto">Hi everyone,</p>
<p dir="auto">I'm still in the process of learning the M5 Tough's capability and approach to coding it.  I'm mostly looking through the examples in the this repo  (<a href="https://github.com/m5stack/M5Tough" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/m5stack/M5Tough</a>) to understand how to do things.</p>
<p dir="auto">I'm having troubles though trying to run any code that shows how to use touch button.  When I run any of the example code the M5 Tough controller panics and ends up in a boot loop.</p>
<p dir="auto">For example if I run the following sample bit of code that is documented in the M5Button.h file.</p>
<pre><code>#include &lt;M5Tough.h&gt;



    ButtonColors onCol = {BLACK, WHITE, WHITE};

    ButtonColors offCol = {RED, WHITE, WHITE};

    Button myButton(10, 10, 200, 100, false, "I'm a button !", onCol, offCol);



    

    void touched(Event&amp; e) {

      Serial.println("Touched!");

    }



    void released(Event&amp; e) {

      Serial.println("Released!");

    }



    void setup() {

      M5.begin();

      myButton.addHandler(touched, E_TOUCH);

      myButton.addHandler(released, E_RELEASE);

    }



    void loop() {

      M5.update();

    }
</code></pre>
<p dir="auto">A core dump /boot loop occurs with the following info displaying over and over in the Terminal window:<br />
...........</p>
<p dir="auto">E (277) esp_core_dump_flash: Core dump flash config is corrupted! CRC=0x7bd5c66f instead of 0x0<br />
Rebooting...<br />
ets Jul 29 2019 12:21:46</p>
<p dir="auto">rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)<br />
configsip: 0, SPIWP:0xee<br />
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00<br />
mode:DIO, clock div:2<br />
load:0x3fff0030,len:1184<br />
load:0x40078000,len:13192<br />
load:0x40080400,len:3028<br />
entry 0x400805e4<br />
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.</p>
<p dir="auto">Core  0 register dump:<br />
PC      : 0x400d5035  PS      : 0x00060330  A0      : 0x800d5089  A1      : 0x3ffe3b10<br />
A2      : 0x3ffc2a44  A3      : 0xffff0000  A4      : 0x0000ffff  A5      : 0x0000db40<br />
A6      : 0x00060320  A7      : 0x00000001  A8      : 0x00000000  A9      : 0x00000000<br />
A10     : 0x3ffc2a44  A11     : 0xffff0000  A12     : 0x00060320  A13     : 0x00060523<br />
A14     : 0x007b7e1c  A15     : 0x003fffff  SAR     : 0x0000001c  EXCCAUSE: 0x0000001c<br />
EXCVADDR: 0x00000000  LBEG    : 0x40088a2d  LEND    : 0x40088a3e  LCOUNT  : 0xfffffff0</p>
<p dir="auto">Backtrace: 0x400d5032:0x3ffe3b10 0x400d5086:0x3ffe3b40 0x400d5c25:0x3ffe3b60 0x400d5d15:0x3ffe3b90 0x400d2755:0x3ffe3bc0 0x400e49b7:0x3ffe3c10 0x4008333a:0x3ffe3c40 0x40079266:0x3ffe3c90 |&lt;-CORRUPTED</p>
<p dir="auto">........................</p>
<p dir="auto">I've also tried the TouchButton.ino example file code (From the GIT project repo listed above project) and it does exactly the same thing.</p>
<p dir="auto">Is there something simple that I have missed doing here, because all of the example code looks pretty straight forward?</p>
<p dir="auto">Any help or ideas on this is appreciated.</p>
<p dir="auto">Thanks,<br />
galeap</p>
]]></description><link>https://community.m5stack.com/topic/5322/trouble-getting-touch-button-example-code-to-work-on-m5-tough</link><generator>RSS for Node</generator><lastBuildDate>Tue, 05 May 2026 18:32:48 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/5322.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 22 May 2023 06:50:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Trouble getting touch button example code to work on M5 Tough. on Tue, 23 May 2023 03:53:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/felmue" aria-label="Profile: felmue">@<bdi>felmue</bdi></a> Hey felmue, I've managed to sort out my issue.  It wasn't a power thing.</p>
<p dir="auto">I've been using PlatformIO to do my work as I'm trying to start using VSC for a number of tasks.  I ended up going back to the Arduino IDE and surprise surprise the above code compiled and worked ok.   So Iwent back and started looking at how I was trying to use the library in PlatformIO.  Because the M5Tough library didn't appear in the usual library list, I had just copied the files in the GIT repo under the src folder into my VSC project src folder.  It turns out that this works ok for some examples, but not the buttons one (I assuming it tries to reach a header file that it couldn't locate for these ones or something.</p>
<p dir="auto">Anyway, I found out how to add a third part library into PIO using CLI, started a new Tough project, and now the code works well.  So in the end the problem was my lack of understanding (again!) but at least now I've learnt how PIO goes together.</p>
<p dir="auto">Thanks for the suggestions and your time, I sure you'll get another chance to try and help me in the future :)</p>
<p dir="auto">galeap.</p>
]]></description><link>https://community.m5stack.com/post/20930</link><guid isPermaLink="true">https://community.m5stack.com/post/20930</guid><dc:creator><![CDATA[galeap]]></dc:creator><pubDate>Tue, 23 May 2023 03:53:00 GMT</pubDate></item><item><title><![CDATA[Reply to Trouble getting touch button example code to work on M5 Tough. on Mon, 22 May 2023 12:08:02 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/galeap" aria-label="Profile: galeap">@<bdi>galeap</bdi></a></p>
<p dir="auto">I don't think the code is the issue here. I can run either TouchButton.ino or the code you posted on my M5Tough just fine.</p>
<p dir="auto">Maybe it's power issue? Have you tried a different USB port?</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/20918</link><guid isPermaLink="true">https://community.m5stack.com/post/20918</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Mon, 22 May 2023 12:08:02 GMT</pubDate></item></channel></rss>