M5Stack-Core2

Advanced ESP32 touchscreen dev kit with IMU, mic, and speaker - great for interactive and multimedia IoT.

USB-C
M5Stack-Core2 board
54 × 54 mm
ESP32
MCU
240MHz
clock
16MB
flash
520KB
SRAM
24· Two 12-bit, 18 Channels ADC
GPIO
BLE 4.2+ WiFi
radio
On this page

Pinout

24 pins
View:
M5Stack-Core2 pinout diagram
PinGPIOLabelsStatusCapabilitiesNotes
10G0strapping-
21TXG1PWMuartuart
32G2PWMstrapping-
43RXG3PWMuartuart
55SSG5PWMstrappingspi
612G12PWMstrapping-
713RX2G13PWMstrapping-
814TX2G14PWMstrapping-
915G15PWMstrapping-
1017G17PWMstrapping-
1118SCKG18PWMsafespi
1219G19PWMsafe-
1321G21PWMsafe-
1422G22PWMsafe-
1523MOSIG23PWMsafespi
1625G25DAC1PWMsafedac
1726G26DAC2PWMsafedac
1827G27PWMsafe-
1932SDAG32PWMsafei2c
2033SCLG33PWMsafei2c
2134G34strapping-
2235G35ADC1strapping-
2336G36ADC2strapping-
2438MISOG38strappingspi

Start with these

10 pins with no boot or system involvement
SCKG18G19PWMG21PWMG22PWMMOSIG23G25DAC1G26DAC2G27PWMSDAG32SCLG33

Freely assignable - no strapping, flash, USB or JTAG duties. Ideal first picks for buttons, sensors and LEDs.

Fine - with a little care

sampled at boot or shared with debug/serial
PinLabelWhat to knowRole
G0GPIO0Must be HIGH during boot for normal startup; if held LOW on reset, forces flash programming mode.Strapping
G2GPIO2If driven HIGH on reset (while IO0 is LOW), selects an unsupported SDIO boot mode, causing boot failure.Strapping
SSGPIO5Must be HIGH during boot; if pulled LOW at reset, alters SDIO slave timing and may prevent normal boot.Strapping
G12MTDI (GPIO12)Keep LOW during boot (internal PD); pulling HIGH at reset selects 1.8V flash mode, causing flash brownout if 3.3V flash is used.Strapping
RX2MTCK (GPIO13)Used for JTAG debugging (TCK); avoid using as GPIO if JTAG is needed.Other
TX2MTMS (GPIO14)Used for JTAG debugging (TMS); driving it as GPIO may interfere with JTAG or produce spurious signals at boot.Other
G15MTDO (GPIO15)Keep HIGH during boot (internal PU); if LOW on reset, bootloader log is silenced and boot mode may change.Strapping
G34GPIO34Cannot be used as output (no drive capability); only suitable for analog/digital input.Other
G35GPIO35Cannot be used as output; only suitable for input.Other
G36GPIO36 (SENSOR_VP)Cannot be used as output; only suitable for input (e.g., analog read).Other
MISOGPIO38 (SENSOR_CAPN)Cannot be used as output; only suitable for input.Other

Only if you know the tricks

wired to flash or USB - expect a fight
PinLabelWhat to knowRole
TXU0TXD (GPIO1)Connected to on-board USB-UART for uploading and logs; drives serial output at boot, so using as GPIO can disrupt programming or console.USB
RXU0RXD (GPIO3)Used for receiving data from USB-UART (programming); also pulled HIGH at boot for console communication, so using as GPIO can disrupt uploads.USB
G17GPIO17Connected to internal PSRAM on PSRAM-enabled modules; not usable as GPIO on those modules.Flash
These are recommendations, not hard rules - with the right pull-ups, timing and boot-state awareness most pins can be made to work. When in doubt, start green.
Pinout notes The M5Stack-Core2 pinout brings out 24 GPIO pins - every one of them usable in your project. For peripherals, I²C is mapped to SDA on GPIO32 and SCL on GPIO33;…

The M5Stack-Core2 pinout brings out 24 GPIO pins - every one of them usable in your project.

For peripherals, I²C is mapped to SDA on GPIO32 and SCL on GPIO33; the SPI bus (MOSI, MISO, SCK, SS) is broken out in full; TX/RX on GPIO1 and GPIO3 cover serial logging and flashing.

On the analog side there are 2 true DAC outputs.

If you want zero surprises, SCK, G19, G21, G22 and 6 more are free of any such role - the safest first picks. 11 of the exposed pins carry boot-time or system duties on the ESP32 (G0, G2, SS and 8 more).

Getting started

flash your first firmware in ~2 minutes
Tool:
1
Connect over USB
Serial chip: CP2104. Not detected? Hold BOOT while plugging in.
2
Flash with your tool
Arduino IDE, PlatformIO, ESPHome or esptool - copy the settings on the right.
3
Verify it runs
The blink example uses GPIO18 - swap for your board's LED pin if different.
Tools → Board settings Copy
Board:            M5stack Core2
Flash Size:       16MB · DIO
Upload Speed:     921600

// blink
pinMode(18, OUTPUT);
digitalWrite(18, LOW);   // on (often inverted)
platformio.ini Copy
[env:m5stack-core2]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
upload_speed = 921600
device.yaml Copy
esp32:
  board: esp32dev
  variant: m5stack_core2
  framework:
    type: esp-idf

# blink - GPIO18
output:
  - platform: gpio
    pin: 18
    id: led_out
light:
  - platform: binary
    name: "LED"
    output: led_out
shell Copy
esptool.py --chip esp32 --port /dev/ttyACM0 \
  write_flash 0x0 firmware.bin
Build details: sketch space 6553600 B · data 4521984 B · DIO

Specifications

ESP32 · 54 × 54 mm
Compute
MCU
ESP32
Clock
240 MHz
SRAM · Flash
520 KB · 16MB · 8MB (QSPI) PSRAM
Radio
Wi-Fi
802.11 b/g/n
Bluetooth
4.2 LE
Antenna
3D
I/O
GPIO · ADC
24 · Two 12-bit, 18 Channels
UART · I²C · SPI
3 · 2 · 4
PWM
16 channels
Power
USB
USB-C
Serial
CP2104
Boot address
0x1000
Display
Screen
IPS LCD · 2.0" · 320x240
Driver
ILI9342C
Touch
FT6336U
Flashing
Upload · OTA
esptool_py · esp_ota
Flash · Boot mode
DIO · DIO
Sketch · Data
6.25 MB · 4.31 MB
54 mm54 mm
54 × 54 mm
The M5Stack-Core2 uses esptool_py for firmware uploads, esp_ota for over-the-air (OTA) updates. Flash mode is DIO with DIO boot mode. The maximum sketch size is 6.25 MB with 4.31 MB available for data.

About this board

At its core is the ESP32 - a dual-core Xtensa with both Bluetooth Classic and BLE.

Expect to pay about $42.90 - above the ~$20 typical for ESP32 boards.

Onboard you'll find 8MB (QSPI) PSRAM, an IPS LCD 2.0" 320x240 display with touch, a microSD slot, a Grove connector, a microphone (SPM1423), a speaker, an amplifier (NS4168), an MPU6886 IMU, a BM8563 RTC, battery charging (AXP192), status LEDs (Power) and Power/Reset/3 capacitive touch buttons.

  • Vibration motor for haptic feedback
  • Built-in 500mAh 3.7V LiPo battery
  • M-Bus expansion connector
  • USB-serial bridge CP2104 (CH9102F on later revisions)

Where to buy

prices are typical street prices
M5Stack-Core2
M5Stack-Core2
$42.90per unit, typical

Resources

Similar boards