Trouble getting touch button example code to work on M5 Tough.
-
Hi everyone,
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 (https://github.com/m5stack/M5Tough) to understand how to do things.
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.
For example if I run the following sample bit of code that is documented in the M5Button.h file.
#include <M5Tough.h> 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& e) { Serial.println("Touched!"); } void released(Event& e) { Serial.println("Released!"); } void setup() { M5.begin(); myButton.addHandler(touched, E_TOUCH); myButton.addHandler(released, E_RELEASE); } void loop() { M5.update(); }
A core dump /boot loop occurs with the following info displaying over and over in the Terminal window:
...........E (277) esp_core_dump_flash: Core dump flash config is corrupted! CRC=0x7bd5c66f instead of 0x0
Rebooting...
ets Jul 29 2019 12:21:46rst:0xc (SW_CPU_RESET),boot:0x17 (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:2
load:0x3fff0030,len:1184
load:0x40078000,len:13192
load:0x40080400,len:3028
entry 0x400805e4
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.Core 0 register dump:
PC : 0x400d5035 PS : 0x00060330 A0 : 0x800d5089 A1 : 0x3ffe3b10
A2 : 0x3ffc2a44 A3 : 0xffff0000 A4 : 0x0000ffff A5 : 0x0000db40
A6 : 0x00060320 A7 : 0x00000001 A8 : 0x00000000 A9 : 0x00000000
A10 : 0x3ffc2a44 A11 : 0xffff0000 A12 : 0x00060320 A13 : 0x00060523
A14 : 0x007b7e1c A15 : 0x003fffff SAR : 0x0000001c EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x40088a2d LEND : 0x40088a3e LCOUNT : 0xfffffff0Backtrace: 0x400d5032:0x3ffe3b10 0x400d5086:0x3ffe3b40 0x400d5c25:0x3ffe3b60 0x400d5d15:0x3ffe3b90 0x400d2755:0x3ffe3bc0 0x400e49b7:0x3ffe3c10 0x4008333a:0x3ffe3c40 0x40079266:0x3ffe3c90 |<-CORRUPTED
........................
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.
Is there something simple that I have missed doing here, because all of the example code looks pretty straight forward?
Any help or ideas on this is appreciated.
Thanks,
galeap -
Hello @galeap
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.
Maybe it's power issue? Have you tried a different USB port?
Thanks
Felix -
@felmue Hey felmue, I've managed to sort out my issue. It wasn't a power thing.
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.
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.
Thanks for the suggestions and your time, I sure you'll get another chance to try and help me in the future :)
galeap.