If anyone else is trying to do this you'll need to fix your partition table to take advantage of the larger memory. The steps how to do this are:
- Go to PIO Home in Visual Studio Code
- Click on
+New Project
- Name it m5core2 or similar. Choose
M5Stack Core ESP32
for the board. - Leave Framework set to Arduino.
- Open your platformio.ini file and replace the text with this:
[env:m5stack-core-esp32]
platform = espressif32
board = m5stack-core-esp32
framework = arduino
; [[[for macos]]]
;upload_port = /dev/cu.SLAB_USBtoUART
; [[[fix PSRAM size and you won't need have this file]]]
board_build.partitions = default_16MB.csv
build_flags =
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
- Copy the 16MB partition table file into your src directory. You can download this file here:
https://github.com/espressif/arduino-esp32/blob/master/tools/partitions/default_16MB.csv
- In the 'lib' directory you will need three libraries.
FastLED - https://github.com/FastLED/FastLED
M5Core2 - https://github.com/m5stack/M5Core2
ArduinoECCX08 - This one is in a zip file in the M5Core2 library repo:
https://github.com/m5stack/M5Core2/blob/master/examples/core2_for_aws/ArduinoECCX08.zip
Your lib directory should look like this when you're done:
- Now copy everything from the example FactoryTest directory in the M5Core2 library into your
src
folder. The directory files can be viewed here:
https://github.com/m5stack/M5Core2/tree/master/examples/core2_for_aws/FactoryTest
-
Rename FactoryTest.ino to main.cpp
-
Edit main.cpp and comment out these two lines with
//
. These tests will fail if you don't have an SDCard or something plugged into the IO port.
-
Connect your M5Core2 and build/upload. You can do CTRL-Shift-P to find the Platformio:Upload option.
-
Play with the cool factory demo!
Thanks to jokercatz for the tip on fixing the platform:
http://jokercatz.blogspot.com/2020/11/m5stack-core2-build-from-platformio.html