M5Stack Core2 (AWS)

Hello, trying to get PlatformIO working with this device. It uploads to the Core2, but the device fails to boot. I can flash it with the M5Burn application. My platform is Windows.

I have tried using the stock standard configuration within PlatformIO which produces a platformio.ini file like:

[env:m5stack-core2]
platform = espressif32
board = m5stack-core2
framework = arduino
lib_deps = m5stack/M5Stack @ ^0.3.6

I have also tried following the steps as outlined here (including selecting the esp32 board): Building Core2 FactoryDemo in PlatformIO | M5Stack Community but get a compiler error:

collect2.exe: error: ld returned 1 exit status
*** [.pio\build\m5stack-core2\firmware.elf] Error 1

There are no other errors when compiling.

The code I tried in my first attempt, if anyone is wondering is:

#include <Arduino.h>
#include <M5Stack.h>

void setup() {
  M5.begin(true, true, true, false);
}

void loop() {
  M5.Lcd.fillScreen(RED);
  delay(50);
  M5.Lcd.fillScreen(BLUE);
  delay(50);
}

… I think you should rather be using https://platformio.org/lib/show/11080/M5Core2/installation?

If I then slightly adapt M5Core2/examples/Basics/helloworld/helloworld.ino at master · m5stack/M5Core2 · GitHub to get the code

#include <Arduino.h>
#include <M5Core2.h>

void setup() {
   M5.begin();
}

void loop() {
  M5.Lcd.fillScreen(RED);
  delay(50);
  M5.Lcd.fillScreen(BLUE);
  delay(50);
}

with the platformio.ini

[env:m5stack-core2]
platform = espressif32
board = m5stack-core2
framework = arduino
lib_deps =
     m5stack/M5Core2 @ ^0.0.6

I have absolutely 0 problems compiling.

Linking .pio\build\m5stack-core2\firmware.elf
Retrieving maximum program size .pio\build\m5stack-core2\firmware.elf
Checking size .pio\build\m5stack-core2\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.4% (used 17352 bytes from 4521984 bytes)
Flash: [=         ]   6.6% (used 433283 bytes from 6553600 bytes)
Building .pio\build\m5stack-core2\firmware.bin
esptool.py v3.1
Merged 1 ELF section
=====================[SUCCESS] Took 18.54 seconds =====================

Make sure to remove the hidden .pio folder in the project folder before compiling to get rid of the old libraries.

1 Like

Thank you! That worked! I did have some trouble installing the library with PIO, seems like the PIO terminal is broken in my setup, but running the command from command prompt seemed to install it working and I now have a seizure inducing test screen.

That is weird but you also don’t need to have access to the terminal to install a library. If lib_deps = m5stack/M5Core2 @ ^0.0.6 is in the platformio.ini, the library will automatically get installed on the next build, no need to type in any pio lib install .. commands.

For installing shell commands, try and follow this or execute it from a CLI in VSCode.

Thank you very much, that’s very helpful.