This is a short guide to getting the M5Stack Core2 running on MacOS Catalina.
The following commands get us set up with arduino-cli
brew install arduino-cli arduino-cli config init vi Library/Arduino15/arduino-cli.yaml # add board download URLs as below
(TODO: describe how to install the USB driver for MacOS)
We need URLs so arduino-cli knows about ESP32 boards. See https://conferre.cf/arduino/cli.php
board_manager: additional_urls: - https://dl.espressif.com/dl/package_esp32_index.json - https://arduino.esp8266.com/stable/package_esp8266com_index.json - https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
Now we can install the required tooling for ESP32.
arduino-cli core update-index arduino-cli core search # see that esp32:esp32 is available arduino-cli core install esp32:esp32 arduino-cli board listall # see that M5Stack-Core-ESP32 is available
We’ll need the M5Core2 library to be installed
arduino-cli lib install M5Core2
arduino-cli sketch new FirstApp
Edit FirstApp.ino
to look as follows:
#include <M5Core2.h>
void setup() {
M5.begin();
M5.Lcd.print("Hello, world!");
}
void loop() {
}
Now compile the sketch from the FirstApp
directory:
arduino-cli compile --fqbn esp32:esp32:m5stack-core-esp32
Run the following without the Core2 plugged into USB:
arduino-cli board list
Now, plug the Core2 into USB and run the command again. In my case, the second run produced the following additional lines:
Port Type Board Name FQBN Core /dev/cu.SLAB_USBtoUART Serial Port (USB) Unknown /dev/cu.usbserial-01F9709F Serial Port (USB) Unknown
It’s OK that arduino-cli
doesn’t know the board type. It just means we have to specify it when we upload.
arduino-cli upload --fqbn esp32:esp32:m5stack-core-esp32 --port /dev/cu.SLAB_USBtoUART
The upload should take a few seconds, after which the Core2 should restart and display "Hello, world!" in tiny little letters.
A more up-to-date guide: * https://www.dellascolto.com/bitwise/category/m5stack/