m5stamp-c3dev

Public

@h1romas4

Download board files

Files for version 1. Pick what you came for.

Share m5stamp-c3dev

Check access before sharing the link.

Who can open this board

Anyone can open this board. No sign-in is required.

This link opens the latest version. Copying it does not grant additional access.

Loading 3D model… large boards can take a moment.

README

m5stamp-c3dev

This is a development board for the M5Stamp C3 (RISC-V/FreeRTOS).

Hardware

  • External USB-C port for JTAG debugging
  • Support for LCD panel and SD card
  • Selecting a power supply
  • Switch(GPIO9) to enter loader mode
  • Pin headers to expose usable GPIOs to the outside
  • The size is just Japanese business card

Sample Sources Included

  • TrueType font with Japanese output to LCD - test_freetype.cpp
  • Output PNG images in SD card to LCD - test_tinypng.cpp
  • NTP synchronization via WiFi connection - test_nvs_wifi.cpp
  • Test ADC on GPIO0
  • Test I2C on GPIO18, 19
  • Test UART on GPIO18, 19
  • WebAssembly execution with Wasm3
  • Usage of SPIFFS, which stores TrueType fonts and .wasm binaries (parttool.py and spiffsgen.py tools)
  • Use of NVS (cryptographically enabled key value store) that stores WiFi passwords (nvs_partition_gen.py tool)
  • Building libraries and managing dependencies using the esp-idf build system
  • Visual Studio Code C/C++ Extension configuration and JTAG debugging configuration in conjunction with openocd
  • AssembyScript sharing method between web browser and microcontroller - wasm

This repository contains MIT Licensed PCB data and example programs.

Demo

Video

Web Simulation

Schematic

#UnitNameNoteWhere to get it
U1AE-USB2.0-TYPE-CUSB 2.0 Type-C Break out boardakizukidenshi.com (JP)
U2M5STAMP-C3M5Stamp C3+ M5Stack
+ SWITCH SCIENCE (JP)
U3KMR-1.8SPIKMR-1.8 SPI marked LCD and SD card interface+ amazon.co.jp (1)
+ ja.aliexpress.com
R1 - R25.2K ResistorPull-down for USB Power supply-
R3 - R710K ResistorSPI pull-up-
JP1Jumper pinSelect external power supplyakizukidenshi.com (JP)
SW1Tact switchfor loader mode and utilityakizukidenshi.com (JP)
J112 Pin headerYou can use the one that comes with the M5Stamp C3 Mate-

PCB and Gerber data

Example Source

Require

get_idf or (Windows) ESP-IDF command prompt

# Linux or macOS ->
$ alias get_idf='. $HOME/esp/esp-idf/export.sh'
$ get_idf
# <-

Detecting the Python interpreter
... snip ...
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:

  idf.py build

$ echo ${IDF_PATH}
/home/hiromasa/devel/toolchain/esp/esp-idf

$ riscv32-esp-elf-gcc -v
Using built-in specs.
COLLECT_GCC=riscv32-esp-elf-gcc
... snip ...
gcc version 12.2.0 (crosstool-NG esp-12.2.0_20230208)

openocd (Optional)

$ openocd -v
Open On-Chip Debugger v0.12.0-esp32-20240318 (2024-03-18-18:25)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html

Build and Execute

  1. git clone and build (Please add --recursive)
git clone --recursive https://github.com/h1romas4/m5stamp-c3dev
cd m5stamp-c3dev
idf.py build

Note: If you get a compile error, change the sdkconfig back to the Git one. In some cases, the target of sdkconfig is changed to esp32 instead of eps32c3.

  1. Write Partition table
idf.py partition-table-flash
  1. Write TypeType font to SPIFFS
parttool.py write_partition --partition-name=font --partition-subtype=spiffs --input resources/spiffs_font.bin
  1. Write WebAssembly(.wasm) to SPIFFS
parttool.py write_partition --partition-name=wasm --partition-subtype=spiffs --input resources/spiffs_wasm.bin
  1. Write main program to go!
idf.py flash monitor

Setup WiFi (Optional)

  1. Change WiFi Setting

nvs_partition.csv: Set own [ssid], [password]

key,type,encoding,value
wifi,namespace,,
ssid,data,string,[ssid]
passwd,data,string,[password]
  1. Create NVS Partition file
python ${IDF_PATH}/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py generate nvs_partition.csv nvs_partition.bin 0x6000
  1. Write NVS Partition
esptool.py write_flash 0x9000 nvs_partition.bin
  1. Run

NTP synchronization is performed by pressing the SW1 after the startup logo.

idf.py monitor

Select connected GPIO18 and GPIO19 device (Optional)

idf.py menuconfig

C3DEV Configuration → Select GPIO 18/19

3D Cube Demo

JTAG debug with Visual Studio Code

Require setup ESP32_TOOLCHAIN_HOME

$ echo ${ESP32_TOOLCHAIN_HOME}
/home/hiromasa/.espressif/tools/riscv32-esp-elf
  1. Connect the PC to the USB Type-C of the U1
  2. Open the source file in Visual Studio Code.
  3. Run Task "openocd (debug)" @see .vscode/tasks.json
  4. Set a breakpoint in the source code.
  5. Debug Launch (GDB) @see .vscode/launch.json The first time you start the program, it will often fail, so if you get an error, retry.

Note

If the LCD color is inverted.

main/main.cpp

    // If the color is inverted, set to 1.
    tft.invertDisplay(0);
    // tft.invertDisplay(1);

Create SPIFFS partition file from file system

python ${IDF_PATH}/components/spiffs/spiffsgen.py 0x100000 resources/font resources/spiffs_font.bin
python ${IDF_PATH}/components/spiffs/spiffsgen.py 0x10000 resources/wasm resources/spiffs_wasm.bin

Change the output destination of the log to U1 Serial/JTAG.(Don't forget to put it back)

Component config → ESP System Settings → Channel for console output

idf.py menuconfig

AssemblyScript and Wasm3

Build AssemblyScript

cd wasm/clockenv # or wasm/gpsgsv or wasm/imu6886
npm install

Web Browser Development

npm run asbuild:web
npm run start
# http://localhost:1234/

SPIFFS Build and Flash

npm run asbuild
cd ../../
python ${IDF_PATH}/components/spiffs/spiffsgen.py 0x10000 resources/wasm resources/spiffs_wasm.bin
parttool.py write_partition --partition-name=wasm --partition-subtype=spiffs --input resources/spiffs_wasm.bin

Dependencies

Thanks for all the open source.

NameVersionLicense
esp-idfrelease/v5.1BSD License
arduino-esp323.0.2LGPL-2.1 License
M5EPD0.1.5MIT License
UNIT_ENV0.0.7MIT License
M5Unit-Sonic0.0.2MIT License
Adafruit_GFX1.11.9BSD License
Adafruit_BusIO1.16.1MIT License
Adafruit-ST7735-Library1.10.4MIT License
tinyPNG0.11MIT License
lwgpsv2.1.0MIT License
Wasm3master(045040a9)MIT License
AssemblyScript0.27.29Apache-2.0 License
源真ゴシック-SIL Open Font License 1.1

License

MIT License (includes PCB data and example source)

Comments

No comments yet. Be the first to ask about this board.

Ask about this board

Sign in to BoardRepo

New here? Signing in creates your account; there is no separate sign-up.