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

    Issue with esp32 board lib v1.0.5

    Arduino
    2
    4
    6.1k
    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.
    • PatP
      Pat
      last edited by

      Hello,
      I would like to report an issue with M5Stack Core GRAY/BASIC.
      If you have installed esp32 board lib v1.0.5 and run code like above, you will find that the statement Serial.begin() has a conflict with the statement M5.begin(). You will never get into the loop.
      With esp32 1.0.4 and lower it is ok.
      The strange thing is that when i remove Serial.begin() it works and still prints with 115200 baud.
      I do not know wether the issue is in the lib esp32 or m5stack.
      Regards Patrick

      Here is an example:
      /******************************************************************************/
      #include <M5Stack.h>

      int i = 0;

      void setup(void) {
      Serial.begin(115200); // comment this line if esp32 lib 1.0.5 is installed!

      M5.begin();
      M5.Power.begin();
      M5.Lcd.setCursor(10, 20, 4);
      M5.Lcd.setTextColor(TFT_YELLOW);
      M5.Lcd.setTextSize(1);
      M5.Lcd.print("Hello World!");
      delay(2000);
      M5.Lcd.clear(TFT_BLACK);
      }

      void loop() {
      M5.Lcd.setCursor(10, 20, 4);
      M5.Lcd.fillRect(10, 20, 100, 19, TFT_BLACK);
      M5.Lcd.println(i);

      Serial.println(i);
      i++;
      delay(1000);
      }
      /******************************************************************************/

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

        Hello @Pat

        if you look into M5.begin() you'll see that there already is a Serial.begin() call.

          if (SerialEnable == true) {
            Serial.begin(115200);
            Serial.flush();
            delay(50);
            Serial.print("M5Stack initializing...");
          }
        

        In my experience calling Serial.begin() twice is a bad idea and can lead to very strange errors.
        Thanks
        Felix

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

        1 Reply Last reply Reply Quote 0
        • PatP
          Pat
          last edited by

          Thank you Felix for the quick answer. I confess did not looked in the M5 source. So its more a feature than a bug.
          My problem was, that i am communicating with other hardware where i can not easily change the baudrate to 115200. Must touch the M5Stack lib for that.
          A property for baudrate value would be nice.
          Still do not understand why the problem was only since the esp32 release to 1.0.5 and not earlier.
          Regards Patrick

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

            Hello @Pat

            you are welcome.

            BTW: you do not necessarily need to touch the M5Stack lib - M5.begin() actually has parameters, one of them is SerialEnable, if you set this to false you can setup Serial in your code anyway you like.

            Thanks
            Felix

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

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