touch stopped working



  • @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 or Core2FactoryTest or Core2_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 the Wire.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 of Button btn1 .... Reason: with your current code the button gets drawn but since the variable btn1 is only valid as long as ShowScreen() 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?

    0_1651761398226_Core2_For_AWS_FW_20220505.png

    In my Linux setup Core2_For_AWS-v0.0.1.bin is in this path M5Burner_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



  • Hello @W4GHV

    ok, I hope you have better luck with the non-AWS version.

    Thanks
    Felix



  • @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



  • @felmue no problem. thanks for your help and time :)



  • I had the same thing happen with the AWS version. Touch was working initially with the Core2_For_AWS firmware. However, I burned the Core2_Tools firmware. When this booted it said "Updating touch firmware" and then the screen was unresponsive with any other firmware burns. Somehow this disabled the touch capability. I tested this on two AWS units and it happened to both.

    I feel like it may be a screen calibration issue. There is this note from this page (https://shop.m5stack.com/products/m5stack-core2-esp32-iot-development-kit-for-aws-iot-edukit):

    "Some of the screen edges will have touch non-linearity problem, you can try to use M5Tool to upgrade the screen firmware to solve this problem."

    And looking at the source code for the referenced M5Tool, it appears it performs a procedure to update the touch firmware to version 17. This may actually be a downgrade for the AWS unit, maybe not, but in any case I'm pretty sure this broke it.

    -- void ft6336_fw_updater(void); // M5Core2 TouchPanel updater

    I logged an issue with the M5Tool github project. Looking at the history this is not the first time this firmware update broke one of the models.