A brief experience with the Cardputer uLisp Machine
For Chrismtas 2024 I bought myself a lovely little Cardputer uLisp Machine, an M5Stack Cardputer that can run uLisp.
The M5Stack Cardputer is a card-sized, microcontroller-based portable system for home automation, hobby, and industrial applications. Although not designed for Lisp the Cardputer can run uLisp, an implementation optimized for microcontrollers. This is my unit:
The uLisp system provides a capable Lisp implementation, a rich anvironment, debugging and editing tools, and lots of libraries and examples. It's well maintained and has an active user community.
Motivation
Like many Lispers I always wanted to play with Lisp on the bare metal and the Cardputer uLisp Machine is a simple and inexpensive solution.
uLisp runs on a wide variety of microcontrollers and boards. I picked the ESP32-S3 based Cardputer because it's compact, can run off rechargeable batteries or USB without an external power source, and comes with a graphics display. And at $29.90 it was a no brainer.
Hardware
The Cardputer is a self-contained device with a keyboard, a 240x135 color TFT display, a USB-C port, and a microSD card slot.
Despite the minuscle keyboard, if I hold the Cardputer with both hands I can accurately press any key with my thumbs. However, the keys are very sensitive to pressure and if I hit one with slightly more force than needed I end up repeatedly typing the same character. Entering code and expressions with the built-in keyboard isn't practical for anything longer than a line or two.
The stamp sized display is tiny too but my new eyes help me read the microscopic text on it.
Software
The first thing I did was to install the uLisp firmware to replace the stock system software. The installation procedure is straightforward, took a few minutes, and required only the Arduino IDE which I run on Linux.
There are two main ways of interacting with uLisp. The first is to access the REPL using the Cardputer keyboard and display, the other is to connect from a desktop computer over a USB serial line via the Arduino Serial Monitor or a terminal emulator such as GNU Screen or Minicom. There is also experimental user contributed code for accessing uLisp from Emacs via an inferior Lisp mode or Swank.
A limitation of interacting over USB is that sending code blocks longer than 256 characters overflows the serial buffer, which results in a string of error messages due to the dropped characters.
A workaround is to preceed the code with a comment line starting with a semicolon ;
which temporarily turns off echo mode on the device and prevents it from being overwhelmed. Lisp mode on Emacs has no support for the workaround though. So the extra comment line needs to be manually copied from the source buffer and pasted into the inferior REPL along with the code, instead of executing commands such as eval-defun
or C-M-x
. This introduces friction in the rapid cycles of REPL and editor interactions Lispers are used to.
A showstopper
The limitations of interacting with the Cardputer over serial are just inconveniences that may be fixed by improving existing tools. But a showstopper forces me to set the Cardputer aside until a major Arduino core issue is resolved.
The Cardputer's ESP32-S3 native USB manages the serial port via software and currently has a nasty bug: if the receive buffer fills up too fast the ESP32-S3 will crash and disconnect. I can't do anything practical with the Cardputer without reliably sending medium or large Lisp code blocks to uLisp for evaluation.
The uLisp website does warn about the issue but I incorrectly assumed it affected the Cardputer only when connected to Macs, whereas I use Linux.
Only the Arduino team can fix this issue not caused by uLisp. But since it has been known for a couple of years I’m not holding my breath.
Discuss... Email | Reply @amoroso@fosstodon.org