touch stopped working
-
@felmue I have tried everything! I noted on the AWS Core2 forum there is firmware for that version. It takes a complicated PlatformIO procedure to flash it.
It this a portion that I may have corrupted that needs to be reflashed?? I'm assuming it is not affected by the ERASE option.
I took it apart but could not run it since the battery is there.
It has to be a software bug in one of the programs I ran, for it to happen in TWO. It did work initially. I killed the second almost immediately.
I left a note on the AWS M5 forum and sent one to M5stack support.
Should I send them both back? I really want to give micropython/blocky a chance to help me learn Python.
I wonder if I can find this available on another device.?? Any ideas greatly appreciated.
Bo W4GHV -
Hello @W4GHV
M5Core2 has two I2C busses. An internal one (GPIO 21, 22) and an external one (GPIO 32,33) e.g. port A.
The I2C scan code you've posted only scans the external I2C bus (port A). So if nothing is connected to port A the scan will find noting.
In order to scan the internal I2C bus you'll need to modify these two lines:
Wire.beginTransmission(address); error = Wire.endTransmission();
to
Wire1.beginTransmission(address); // change Wire to Wire1 error = Wire1.endTransmission(); // change Wire to Wire1
Without the M5GO Battery bottom2 stacked I get 34, 38 and 51. The touch IC has address 38.
Please try the I2C scan with the above modifications on your M5Core2 and let me know the scan result.
Note: In the M5Core2 library
Wire
is used for the external I2C bus andWire1
is used for the internal I2C bus.Thanks
Felix -
@felmue Thank you so much!
Yep I get the same addresses now.
So the port exists but no program works with touch.
Is there something in the firmware that isn't normally touched by apps or erasing that is busted?Should I return both and buy another, if Amazon let's me?
Thanks again.
Bo -
For grins I modified the M5.begin()
to include the TTTF
and added the Wire.begin line to a other touch app to wake it up. No luck.
Bo -
Hello @W4GHV
ok. so we know that the touch IC is alive - that is good.
Using M5Burner have you tried to load and run
Core2_Tools
orCore2FactoryTest
orCore2_For_AWS
firmware? Does touch work with any of these three firmwares?Thanks
Felix -
Hello. I have Core 2 that is continuously scanning external i2c every 100ms in loop. I noticed the touch event is very unresponsive. For example: every 10 touch, only 1 or 2 was detected. However, if I disable the external i2c in loop, the touch become responsive again. Is there any way to mitigate this issue? I tried increasing the external scan delay (non blocking) to every 250ms but the result is the same.
-
Hello @albertlt
it's difficult to say why that is happening w/o seeing the actual code you are using. Care to share your code?
Thanks
Felix -
@felmue core2 tools starts, no touch to proceed
Factory test runs, halts at SD card missing, touch-to-skip fails.
Inserted SD card, now error message is AT608A find failed, touch dead.
Core2 for AWS firmware appears to be source to be compiled with platform, which I haven't conquered yet.I know it's a software error but am out of places to look.
Is there a way of transferring an image from a working cube?
What I've done twice can be done again, I'm afraid. Should I buy the third one?🤔😂
Thanks so much for your help.
Bo -
Hello @W4GHV
Core2_For_AWS
is a firmware binary in M5Burner as well. No need to compile anything. (Note: it's listed under CORE and not CORE2 & TOUGH.)As for the AT608A error. Since the AT08A is in the M5GO battery bottom 2 - did you try this with the M5GO battery bottom stacked?
The only other idea I have, if you haven't tried that yet, is to use M5Burner to completely erase your M5Core2 before burning a new firmware.
Thanks
Felix -
@felmue , here is the code:
String wireData; unsigned long prevReadMillis; int READ_DELAY = 100; void setup() { M5.begin(); Serial.begin(115200); Wire.begin(32, 33); //Init GUI myGUI.begin(); myGUI.ShowScreen(); } void loop() { myGUI.loop(); I2CLoop(); } void I2CLoop(){ if((millis() - prevReadMillis) > READ_DELAY){ //Read 20 bytes from the slave length = Wire.requestFrom(I2C_ADDR, I2C_LENGTH); if(length == I2C_LENGTH){ //in test environment, codes inside this if statement are never executed because I have not connected any external I2C device but the touch is already not responsive. wireData = ""; wireData = Wire.readStringUntil('!'); Wire.flush(); Serial.print(millis()); Serial.print(" - "); Serial.print("Wire Data: "); Serial.println(wireData); }else{ wireData = ""; } prevReadMillis = millis(); } }
GUI class codes:
void M5GUI::begin(){ //Setup touch buttons M5.Buttons.addHandler(tapEvent, E_RELEASE); } void tapEvent(Event& e){ Serial.print("Button: "); Serial.println(e.objName()); } void M5GUI::loop(){ M5.update(); } void M5GUI::ShowScreen{ //Create Touch Button ButtonColors on_clrs = {RED, WHITE, WHITE}; ButtonColors off_clrs = {BLACK, WHITE, WHITE}; Button btn1(BTN1_POS_X, BTN1_POS_Y, BTN_WIDTH, BTN_HEIGHT, false ,"btn1", off_clrs, on_clrs, CC_DATUM); }
Another issue is, whenever I touch the screen, the source is always "background" even though I clicked on the "btn1" coordinate. How do I make the virtual touch button to work? The only working sources are: background, physical btnA, physical btnB, and physical btnC. I can't get any virtual button to work. I plan to put several virtual button and execute different code when each button is tapped, so I need to be able to identify the correct source of event.
-
Hello @albertlt
if I print
millis()
before and after theWire.requestFrom()
statement I see that the statement is blocking for about 1 second. During that time no other code is running, including checking for touch. You might want to look into tasks.As for the button, you'll need to add the keyword
static
in front ofButton btn1 ...
. Reason: with your current code the button gets drawn but since the variablebtn1
is only valid as long asShowScreen()
is executed, it no longer exists when you tap the screen.Thanks
Felix -
@felmue Thanks a lot for pointing out the static on the button. So I am planning to place a couple buttons on the screen and put all the codes in the tapEvent() method and filter by e.objName(). Is it the correct way to do it? or is there alternative similar to: M5.BtnA.wasPressed() ? Also, how do I clear the static button when changing screen to preserve ram?
Yes, I also realized Wire.requestFrom(); is causing the block. Is there any way to get around this issue? This make the device's UI not very user friendly when i2c is used and without i2c, this device is not very useful as a lot of modules depend on i2c :(
-
Hello @albertlt
the documentation here should answer most of your questions. If you define your buttons outside a function then you can use
btn1.wasPressed()
like this:#include <M5Core2.h> Button myButton(10, 10, 200, 100, false, "I'm a button !", {BLACK, WHITE, WHITE}); void setup() { M5.begin(); } void loop() { M5.update(); if (myButton.wasPressed()) Serial.print("* "); }
As for I2C - as I wrote in my last post, check out tasks.
Thanks
Felix -
@felmue Thanks reply. I see you are busy helping lots of folks.
I think you nailed the problem.
I need the AWS.bin file. It's not in the burner FW subdir.I looked everywhere on the web and only found the source. Can you send it to me?
On + side, I got Thonny, blink, & hello going on a new ESP-WROOM-32 ESP32S!
I'm hoping the.bin file is the solution.
Bo -
Hello @W4GHV
have you downloaded the
Core2_For_AWS
from within M5Burner?In my Linux setup
Core2_For_AWS-v0.0.1.bin
is in this pathM5Burner_Linux/packages/fw/core/
.Thanks
Felix -
@felmue. The easy loader app loads the AWS firmware. And that doesn't help the touch function.
Stubborn ( or dumb) here, I'll return these 2 and buy the non-AWS version.
Bo -
-
@felmue okay will do. thanks a lot felmue for your help. have a nice day
-
Hi @felmue. I have a quick question. I tried to encapsulate the GUI function in a class named M5GUI. I moved the tapEvent into M5GUI.h as follow:
private: void tapEvent(Event& e);
Then in M5GUI.cpp:
void M5GUI::begin(){ M5.Buttons.addHandler(tapEvent, E_RELEASE); } void M5GUI::tapEvent(Event& e){ Serial.print("Button: "); Serial.println(e.objName()); }
The M5.Buttons.addHandler(tapEvent, E_RELEASE); is giving me this error:
argument of type "void (M5GUI::)(Event &e)" is incompatible with parameter of type "void ()(Event &)"
How do I integrate that event handler function properly into class method?
-
Hello @albertlt
sorry, I cannot help you with that. I am not very well versed about how to use classes.
Thanks
Felix