Adafruit ESP32-S2 boards
Adafruit have designed several boards based on the Espressif ESP32-S2. These modules have one 240MHz Xtensa core, Wi-Fi, and native USB. They provide 4 MB flash and 2 MB PSRAM.
These boards have a USB-C connector, and use the ESP32-S2's native CDC USB, avoiding the need for a UART chip.
Even large serial uploads are now reliable using the latest core, and so these boards can be recommended for use with uLisp.
Boards
General features
The following features apply to both boards.
Installing the ESP32 Arduino core
If you don't already have the ESP32 Arduino Core installed:
- Add the following URL to the Additional Boards Manager URLs list in the Arduino IDE Preferencesdialog box:
https://espressif.github.io/arduino-esp32/package_esp32_index.json
- In the Arduino IDE search for the ESP32 Arduino core in Boards Manager and install it.
I tested this with core version 3.3.7.
Setting up the Board options
The installation procedure is the same for both of these boards:
- Select ESP32 Arduino from the Board menu.
- Select the appropriate Board option:
Adafruit Feather ESP32-S2
Adafruit QT Py ESP32-S2
- Set USB CDC On Boot: to "Enabled".
- Set Upload Mode: to "Internal USB".
- Set Partition Scheme to Default 4MB with spiffs.
- Set PSRAM: to "Enabled" to use it (recommended), or "Disabled" to disable it.
You can leave the other options at their defaults.
Uploading uLisp
- Download release 4.9a 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 board.
Uploading Lisp programs
To upload a program to uLisp:
- Select it, including the comment at the top of the program, and do Copy.
- Click in the Arduino Serial Monitor input field and do Paste, then press Return.
The comment disables echo, which could interfere with the serial upload.
LittleFS and save-image
The ESP32 version of uLisp uses LittleFS to allow you to save the entire workspace on all ESP32 boards using (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
It should subsequently work without error.
If you have previously used the board with an older version of the Arduino ESP32 core and you get the error:
assert failed: lfs_fs_grow_ lfs.c:5263 (block_count >= lfs->block_count)
upload uLisp again after selecting the option:
- Erase All Flash Before Sketch Upload: "Enabled"
Wi-Fi
All these boards support Wi-Fi. To connect to a Wi-Fi network give the wifi-connect command with the network name and password; for example:
> (wifi-connect "Geronimo" "secret99") "10.0.1.28"
If successful it will return the IP address you are connected to.
For more examples of using the Wi-Fi features see Wi-Fi examples, and for reference information see Wi-Fi extensions.
NeoPixel
These boards include a NeoPixel RGB LED on pin :pin-neopixel. The following program slowly displays the full range of colours on the LED using the rgbledwrite function:
; NeoPixel spectrum
(defun fix (y)
(setq y (mod y 1536))
(if (>= y 768) (setq y (- 1535 y)))
(setq y (max (min (- y 256) 255) 0)))
(defun spectrum ()
(unwind-protect
(loop
(dotimes (c 1536)
(rgbledwrite :pin-neopixel (fix (+ c 768)) (fix (+ c 256)) (fix (+ c 1280)))
(delay 50)))
(rgbledwrite :pin-neopixel 0 0 0)))
The unwind-protect turns off the LED if you escape from the program.
To run the program enter:
(spectrum)
To exit type a ~.
Sleep
The sleep function can be used to put these boards into light sleep for a specified number of seconds. The current consumption typically drops to 5% of normal power.
Adafruit ESP32-S2 Feather
The Adafruit ESP32-S2 Feather [1] adopts the same format as Adafruit's other Feather boards, making it compatible with their Featherwings:

It includes a JST connector for a Lipo battery, a Lipo charger to allow the battery to be charged from the USB port, and an I2C LC709203 battery monitor chip. The board also has a vertical QWIIC/STEMMA QT connector for connecting I2C modules.
A version is also available with an integrated BME280 temperature/humidity/pressure sensor.
For information about the I/O pins and interfaces see: Adafruit ESP32-S2 Feather Pinouts.
LED
As with other Feather boards the ESP32-S2 Feather has a red LED connected to digital pin 13 which you can flash with the following program:
(defun blink (&optional x) (pinmode :led-builtin t) (digitalwrite :led-builtin x)
(delay 1000) (blink (not x)))
Run it by typing:
(blink)
Exit by entering ~.
Analogue inputs
The ESP32-S2 Feather has 6 analogue inputs, on pins 8 and 14 to 18.
Serial
The ESP32-S2 Feather has one serial port on pin numbers 38 (RX) and 39 (TX).
SPI
The ESP32-S2 Feather has one SPI port on pin numbers 42 (SS), 37 (MISO), 35 (MOSI), and 36 (SCK).
I2C
The ESP32-S2 Feather has one I2C port on pins 3 (SDA) and 4 (SCL).
Adafruit QT Py ESP32-S2
The Adafruit ESP32-S2 QT Py [2] adopts the same compact format as their other QT Py boards:

It has a USB-C connector, and uses the ESP32-S2's native USB, avoiding the need for a UART chip.
LEDs
The QT Py ESP32-S2 has no built-in LED, but it does have a NeoPixel RGB LED; see General features.
Analogue inputs
The QT Py ESP32-S2 has 8 analogue inputs, on pins 5 to 9 and 16 to 18.
Analogue outputs
The QT Py ESP32-S2 supports PWM output on any pin using analogwrite.
Serial
The QT Py ESP32-S2 has one serial port on pin numbers 16 (RX) and 5 (TX).
SPI
The QT Py ESP32-S2 has one SPI port on pin numbers 42 (SS), 37 (MISO), 35 (MOSI), and 36 (SCK).
I2C
The QT Py ESP32-S2 has two I2C ports; port 0 on the edge connector on pins 7 (SDA) and 6 (SCL), and port 1 on the STEMMA QT connector on pins 41 (SDA) and 40 (SCL).
- ^ Adafruit ESP32-S2 Feather Board on Adafruit.
- ^ Adafruit QT Py ESP32-S2 Board on Adafruit.
