Board definition

Hey.
I am trying to make a project using platformio for my M5Stack Core module.
The PCB in the module states:
V2.61
2021-0907
I suspect that it has 16Mb flash.
If I run the code:

uint32_t flashSize = ESP.getFlashChipSize();
Serial.printf("Flash size: %d bytes\n", flashSize);

I get:
Flash size: 16777216 bytes

But when I compile i get:
PLATFORM: Espressif 32 (2023.7.0) > M5Stack Core ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash

I suspected this had something to do with the platformio board definition - here is the ini file I had:
[env:m5stack-core-esp32]

platform = espressif32

board = m5stack-core-esp32

framework = arduino

So I tried to use “m5stack-core-esp32-16M” instead. I even tried to create a new project, and chose this board, but this keeps telling me that this is an unrecognized board…??

There are 2 board versions for the M5 Stack core ESP32 available:
m5stack-core-esp32 and m5stack-core-esp32-16M

This info comes from the board manifest while this info

comes from a “hardware inquiry” during runtime.

If your hardware has the 16 MB version use board = m5stack-core-esp32-16M

Thanks, but unfortunately you miss the last point:
It seems that board = m5stack-core-esp32-16M is not recognized, even though being an option - meaning:
For example, if I create a new project through platformio, I have the name, board and framework selections. Lets say I chooose “testie” as name, and “M5Stack Core ESP32 16M” as the board, and Arduino as framework.
When I click finish I get this message:
Could not initialize project

PIO Core Call Error: “The following files/directories have been created in C:\Users\NotMyName\Documents\PlatformIO\Projects\testie\r\ninclude - Put project header files here\r\nlib - Put project specific (private) libraries here\r\nsrc - Put project source files here\r\nplatformio.ini - Project Configuration File\r\nResolving m5stack-core-esp32-16M dependencies…\r\n\n\nUnknownBoard: Unknown board ID ‘m5stack-core-esp32-16M’”

In project boards folder you can create json for custom or alternative board configs. Then new board name use in ini.

I’m sorry, you’re right.

For me, choosing the board works perfectly without issue.

I guess your platform or package files are broken. In this case

  • Close VS Code
  • delete C:\Users\<username>\.platformio\platforms
  • delete C:\Users\<username>\.platformio\packages
  • delete C:\Users\<username>\.platformio\.cache
  • restart VS Code and wait until all tasks are finished (reinstalling the missing files)

That worked! Thanks a bunch :slight_smile: