M5Stack Stamp-P4

The M5Stack Stamp-P4 [1] is a low-cost processor board, just 30 x 22 mm, based on Espressif's ESP32-P4 chip. This features a dual-core 400 MHz RISC-V processor (running at 360 MHz on this board), with 16 Mbytes of flash and 768 KB of on-chip SRAM. It also has 32 Mbytes of PSRAM:

StampP4Front.jpgStampP4Back.jpg

Despite its compact size, the Stamp-P4 is currently one of the fastest platforms for running uLisp, running the Tak benchmark in just 1.4 secs.

The Stamp-P4 can take two 10-way 0.1" headers, which will give access to a subset of the I/O pins on a standard solderless breadboard. Alternatively, intermediate connections are also provided with a 0.05" pitch, allowing you to solder the Stamp-P4 onto a PCB and access a fuller set of I/O pins available from the ESP32-P4. The pins are labelled on the reverse of the board.

In addition there are two connectors on the board, for connection to the MIPI CSI and SDIO connections. Unlike other ESP32 processors the ESP32-P4 has no Wi-Fi capabilities, but the SDIO connector allows you to fit the Stamp-AddOn C6 For P4 which adds an ESP32-C6-MINI-1-N4 to provide Wi-Fi.

For more information see the M5Stack documentation: https://docs.m5stack.com/en/core/Stamp-P4.

Installing uLisp from the Arduino IDE

Install the M5Stack Arduino core

  • Add the following URL to the Additional Boards Manager URLs list in the Arduino IDE Preferences dialog box:
https://static-cdn.m5stack.com/resource/arduino/package_m5stack_index.json
  • In the Arduino IDE search for the M5Stack Arduino core in Boards Manager and install it.

I tested this with core version 3.3.7, which is based on the ESP32 Arduino Core 3.3.7.

  • Select M5Stack Arduino from the Board menu, and M5StampP4 from the submenu.
  • Check that the options are set as follows:

USB Mode: "Hardware CDC and JTAG"
USB CDC On Boot: "Enabled"
Upload Mode: "UART0 / Hardware CDC"

Flash Size: "16MB (128Mb)"
Partition Scheme: "Default (2 x 6.5 MB app/3.6 MB SPIFFS)"
PSRAM: "Disabled"

or, if you want to use PSRAM (more workspace but slightly slower):

PSRAM: "Enabled"

You can leave all the other options at their defaults.

Upload uLisp

  • Download release 4.9b or later of the ESP version of uLisp from the Download uLisp page.
  • Select the board's USB port from the Port menu.
  • Upload uLisp to the M5Stamp-P4.

Using uLisp

  • Select Serial Monitor from the Tools menu.
  • Enter Lisp commands.

You can also use uLisp via a serial terminal such as CoolTerm or iTerm, and these feature a slow Paste option to avoid buffer problems when uploading long Lisp programs. For more information see Using uLisp from a terminal.

General features

LittleFS and save-image

The first time you call save-image LittleFS allocates the file system, and an error may be displayed such as:

./components/esp_littlefs/src/littlefs/lfs.c:1071:error: Corrupted dir pair at {0x0, 0x1}
E (62578) esp_littlefs: mount failed,  (-84)
E (62579) esp_littlefs: Failed to initialize LittleFS

You can ignore this, and it will subsequently work without error.

Pins

The following diagram shows the Stamp-P4 pin assignments:

Stamp-P4-pinmap.jpg

Analogue inputs

The Stamp-P4 has 14 analogue inputs, on pins 16 to 23 and 49 to 54. Pins 17, 19, 21, and 23 are available on the 0.1" pitch header pins.

Serial

The Stamp-P4 has one serial port on pin numbers 38 (RX) and 37 (TX), available on the 0.1" pitch header pins.

SPI

The Stamp-P4 has one SPI port on pin numbers 42 (SS), 39 (MISO), 44 (MOSI), and 43 (SCK).

I2C

The Stamp-P4 has two I2C ports; an external port on pins 53 (SDA) and 54 (SCL), and an internal port on pins 31 (SDA) and 32 (SCL).

USB

The USB pins are available on pins 27 (D+) and 26 (D-) , on the 0.1" pitch header pins.


  1. ^ M5Stamp-P4 on M5Stack Shop.