Issue with esp32 board lib v1.0.5
-
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 PatrickHere 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);
}
/******************************************************************************/ -
Hello @Pat
if you look into
M5.begin()you'll see that there already is aSerial.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 -
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 -
Hello @Pat
you are welcome.
BTW: you do not necessarily need to touch the M5Stack lib -
M5.begin()actually has parameters, one of them isSerialEnable, if you set this tofalseyou can setupSerialin your code anyway you like.Thanks
Felix
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login