Core2 stopped working after Arduino library update
-
My Core stopped working after some updates in the Arduino 2.2.1 environment (I just accepted the update, most probably some M5 Stack library). The Core5 doesn't run any code, including Arduino sample codes (hello world, display, button, nothing). I loaded the factory code with M5burner and it worked perfectly. When I try again any code with Arduino, the code is apparently loads, but it doesn't run. Does anyone face the same problem? Any hint?
-
Hello @RonaldoDuarte
how do you know it doesn't run? Maybe it's just the display that stays dark? Do you see anything on the debug output?
Thanks
Felix -
Hi Felix. Thanks for your fast reply. In fact, besides the standard sample codes that display something, I've tried to debug including Serial.Print("Something") and it appears not to work as well (nothing in the serial is read in the PC). The Core2 really appears to be dead, even the green led that normally is ON is in fact OFF. But when I use M5Burner to flash the factory code, everything works fine. I even tried to uninstall and reinstall Arduino, but the same keeps happening. The "normal" Core2 running the factory code stops working once any code is loaded through Arduino.
-
Hello @RonaldoDuarte
hmm, not sure what's going on here.
Are you sure you are using the M5Core2 library and have selected the correct board in Arduino IDE?
Can you share the code you are trying to run?
BTW: the green LED is controlled by the AXP192; so if it is not initialized correctly the green LED will not be on.
Thanks
Felix -
Hello @felmue
I'm trying several codes, including the native sample code "Hello World":#include <M5Core2.h>
void setup(){
M5.begin(); //Init M5Core2. Initialize M5Core2
/* Power chip connected to gpio21, gpio22, I2C device
Set battery charging voltage and current
If used battery, please call this function in your project */
M5.Lcd.print("Hello World"); // Print text on the screen (string) Print text on the screen (string)
}/* After the program in setup() runs, it runs the program in loop()
The loop() function is an infinite loop in which the program runs repeatedly
After the program in the setup() function is executed, the program in the loop() function will be executed
The loop() function is an endless loop, in which the program will continue to run repeatedly */
void loop() {
Serial.println("Teste");
}See my environment configuration:
The data in the serial monitor comes from my Core2 when running the factory code.
The only thing I haven't tried yet is to record my device from a different computer.
I'll try to do that. -
Just tried it on a new computer, with a brand-new Arduino installation. The same result! Either there is something wrong with some latest version of some library or my Core2 board is kind of "Arduino-damaged", as all the functionalities seem to be ok (display, sound, touch, wifi, everything) when tested with a M5Burner code, but the board seems completely dead when uploading a code with arduino. Codes (such as HelloWorld) what have always worked.
Very weird!
-
Hello @RonaldoDuarte
indeed - that is weird. I assume after uploading from Arduino IDE you've already tried to dis-/reconnect USB and/or pressing the reset button and/or pushing the power button?
Thanks
Felix -
I'm on macOS and am having the same issue... Core2 was working fine... the Arduino IDE crashed after a file upload... since then sketches upload via the Arduino IDE but the Core2 won't run the code... power down and up and reset buttons have no effect... though erasing and uploading the Core2FactoryTest via M5 burner works fine.
I too installed a fresh Arduino IDE 2.2.1 on a different computer, loaded the M5Stack boards + Core2 and CoreS3 libraries including dependencies - but no joy - sketches do upload via the Arduino IDE but the Core2 won't run the code.
Any thoughts?
-
@lewissykes That's exactly what's happening!
I'm still trying everything, but no success so far. As a piece of additional information, the first time I had the issue was when Arduino IDE was updating two libraries simultaneously and I compiled and loaded a code at the same time. It seems that a certain flash area used by Arduino code (and not by the codes loaded with M5Burner) was corrupted and it's not being automatically recorded with new flashings.
Let's keep trying different things. In case of any news, I'll update this thread. -
Hi Ronaldo
Likewise... if I find a solution I'll update this thread.
As an aside but possibly related... since updating some M5Stack libraries in a recent session non of the inbuilt 'Basic' examples I've tried for my CoreS3 will compile - and ditto existing project sketches that worked fine before... so I suspect something's broken in the recent Arduino library updates.
Also the Arduino IDE appears to flash the Core2 successfully... I don't get any upload errors and it's usually pretty pernickety. The issue seems to be a fault in copying the code from flash to SRAM to execute it?
-
Hi Ronaldo
So this worked for me...
In Arduino IDE 'Tools' set 'Flash Size' to 16MB & 'Erase All Flash Before Sketch Upload' to Enabled... all other settings as default.
After compiling Output shows 'Connecting....' which hangs for ages (I assume it's erasing the Flash) but after upload the Core2 runs the sketch.
I subsequently disabled 'Erase All Flash...' but kept 'Flash Size' at 16MB... and a different sketch also ran after upload.
If I changed 'Flash Size' back to the default 4MB the sketch uploaded without issue - but the Core2 wouldn't' run it - so same issue as before.
If you compare the output from M5Burner and Arduino IDE there are differences - the version of esptool.py for one... but also the Flash locations that get erased on a new upload.
So I reckon you're right - it seems like the Flash at the locations the Arduino IDE uses has been damaged and that's what's causing the problem.
Anyways, hope this works for you too - let me know how you get on.
Best
Lewis
-
That's perfect Lewis, it worked!
I repeated the same steps as you described and had the same results (it works with 16MB and stops working with 4MB configuration).
So, although the root cause and definitive solution are unclear, at least we can keep using our Core2 this way.
Many thanks for sharing a solution.
Wish you all the best.