🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    touch stopped working

    Core 2
    4
    29
    46.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • felmueF
      felmue
      last edited by

      Hello @W4GHV

      not sure what's going on with your M5Core2. Could you share the Arduino code (and / or micropython code) you used to run the I2C scan?

      Thanks
      Felix

      GPIO translation table M5Stack / M5Core2
      Information about various M5Stack products.
      Code examples

      W4GHVW 2 Replies Last reply Reply Quote 0
      • W4GHVW
        W4GHV @felmue
        last edited by

        @felmue Thanks for the response. The Arduino I2C scan shows no addresses

        Part of the sketch.

        • describe:I2C Scanner. I2C探测
        • date:2021/7/26

        /
        /

        This program scans the addresses 1-127 continuosly and shows the devices found on the TFT.
        */
        #include <M5Core2.h>

        void setup()
        {
        M5.begin(true,true,true,true); //Init M5Core2(Initialization of external I2C is also included). 初始化M5Core2(初始化外部I2C也包含在内)
        //Wire.begin(21, 22); //Detect internal I2C, if this sentence is not added, it will detect external I2C. 检测内部I2C,若不加此句为检测外部I2C
        M5.Lcd.setTextColor(YELLOW); //Set the font color to yellow. 设置字体颜色为黄色
        M5.Lcd.setTextSize(2); //Set the font size to 2. 设置字体大小为2
        M5.Lcd.println("M5Core2 I2C Tester"); //Print a string on the screen. 在屏幕上打印字符串
        delay(3000);
        M5.Lcd.fillScreen( BLACK ); //Make the screen full of black (equivalent to clear() to clear the screen). 使屏幕充满黑色(等效clear()清屏)
        }

        int textColor=YELLOW;

        void loop()
        {
        int address;
        int error;
        M5.Lcd.setCursor(0, 0);
        M5.Lcd.println("scanning Address [HEX]");
        for(address = 1; address < 127; address++ )
        {
        Wire.beginTransmission(address); //Data transmission to the specified device address starts. 开始向指定的设备地址进行传输数据
        error = Wire.endTransmission(); /*Stop data transmission with the slave. 停止与从机的数据传输
        0: success. 成功
        1: The amount of data exceeds the transmission buffer capacity limit. 数据量超过传送缓存容纳限制
        return value: 2: Received NACK when sending address. 传送地址时收到 NACK
        3: Received NACK when transmitting data. 传送数据时收到 NACK
        4: Other errors. 其它错误 */
        if(error==0)
        {
        M5.Lcd.print(address,HEX);
        M5.Lcd.print(" ");
        }
        else M5.Lcd.print(".");

        delay(10);
        

        }

        if(textColor==YELLOW) {
        textColor=CYAN;
        }else textColor=YELLOW;
        M5.Lcd.setTextColor(textColor,BLACK); //Set the foreground color of the text to textColor and the background color to BLACK. 设置文字的前景色为textColor背景色为BLACK

        73, Bo W4GHV since '54

        1 Reply Last reply Reply Quote 0
        • W4GHVW
          W4GHV @felmue
          last edited by

          @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

          73, Bo W4GHV since '54

          1 Reply Last reply Reply Quote 0
          • felmueF
            felmue
            last edited by felmue

            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 and Wire1 is used for the internal I2C bus.

            Thanks
            Felix

            GPIO translation table M5Stack / M5Core2
            Information about various M5Stack products.
            Code examples

            1 Reply Last reply Reply Quote 0
            • W4GHVW
              W4GHV
              last edited by

              @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

              73, Bo W4GHV since '54

              1 Reply Last reply Reply Quote 0
              • W4GHVW
                W4GHV
                last edited by

                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

                73, Bo W4GHV since '54

                1 Reply Last reply Reply Quote 0
                • felmueF
                  felmue
                  last edited by

                  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

                  GPIO translation table M5Stack / M5Core2
                  Information about various M5Stack products.
                  Code examples

                  W4GHVW 1 Reply Last reply Reply Quote 0
                  • A
                    albertlt
                    last edited by

                    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.

                    1 Reply Last reply Reply Quote 0
                    • felmueF
                      felmue
                      last edited by

                      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

                      GPIO translation table M5Stack / M5Core2
                      Information about various M5Stack products.
                      Code examples

                      1 Reply Last reply Reply Quote 0
                      • W4GHVW
                        W4GHV @felmue
                        last edited by

                        @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

                        73, Bo W4GHV since '54

                        1 Reply Last reply Reply Quote 0
                        • felmueF
                          felmue
                          last edited by felmue

                          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

                          GPIO translation table M5Stack / M5Core2
                          Information about various M5Stack products.
                          Code examples

                          W4GHVW 2 Replies Last reply Reply Quote 0
                          • A
                            albertlt
                            last edited by albertlt

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

                            1 Reply Last reply Reply Quote 0
                            • felmueF
                              felmue
                              last edited by felmue

                              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

                              GPIO translation table M5Stack / M5Core2
                              Information about various M5Stack products.
                              Code examples

                              A 1 Reply Last reply Reply Quote 0
                              • A
                                albertlt @felmue
                                last edited by

                                @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 :(

                                1 Reply Last reply Reply Quote 0
                                • felmueF
                                  felmue
                                  last edited by felmue

                                  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

                                  GPIO translation table M5Stack / M5Core2
                                  Information about various M5Stack products.
                                  Code examples

                                  A 1 Reply Last reply Reply Quote 0
                                  • W4GHVW
                                    W4GHV @felmue
                                    last edited by

                                    @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

                                    73, Bo W4GHV since '54

                                    1 Reply Last reply Reply Quote 0
                                    • felmueF
                                      felmue
                                      last edited by

                                      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

                                      GPIO translation table M5Stack / M5Core2
                                      Information about various M5Stack products.
                                      Code examples

                                      1 Reply Last reply Reply Quote 0
                                      • W4GHVW
                                        W4GHV @felmue
                                        last edited by

                                        @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

                                        73, Bo W4GHV since '54

                                        1 Reply Last reply Reply Quote 0
                                        • felmueF
                                          felmue
                                          last edited by

                                          Hello @W4GHV

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

                                          Thanks
                                          Felix

                                          GPIO translation table M5Stack / M5Core2
                                          Information about various M5Stack products.
                                          Code examples

                                          1 Reply Last reply Reply Quote 0
                                          • A
                                            albertlt @felmue
                                            last edited by

                                            @felmue okay will do. thanks a lot felmue for your help. have a nice day

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post