QT Py RP2040 and XIAO RP2040
The Adafruit QT Py RP2040  and Seeed Studio XIAO RP2040  are boards in Adafruit's compact QT Py format.
They are based on an RP2040 32-bit Cortex M0+ dual-core processor running at 133 MHz, and with 264 KB RAM. The Adafruit QT Py RP2040 has 8 MB flash and the Seeed Studio XIAO RP2040 has 2 MB flash.
Installing uLisp from the Arduino IDE
Install the Raspberry Pi Pico/RP2040 core
- Add the following URL to the Additional Boards Manager URLs list in the Arduino IDE Preferences dialog box:
- In the Arduino IDE search for the Raspberry Pi Pico/RP2040 core in Boards Manager and install it.
- Select Raspberry Pi RP2040 Boards from the Board menu, and the appropriate board from the submenu.
- Set Flash Size to the option that gives FS: 1MB. On the Raspberry Pi Pico this is 2MB (Sketch: 1MB, FS: 1MB).
This allocates enough space for use by LittleFS to save the entire workspace with save-image.
You can leave all the other options at their defaults.
- Download the latest ARM version of uLisp from the Download uLisp page.
- Select the board's USB port from the Port menu
- Upload uLisp to the board.
Putting the board into upload mode
If the upload fails you may need to put the board into upload mode first.
- Press and hold the Boot or B button.
- Press the Reset or R button.
- Release the Boot button.
- You may need to select the board's USB port from the Port menu again.
- Select Serial Monitor from the Tools menu.
- Enter Lisp commands.
Adafruit QT Py RP2040 and Seeed Studio XIAO RP2040 both have USB type C connectors, and identical form factors and pinouts:
Saving the workspace
The Adafruit QT Py RP2040 and Seeed Studio XIAO RP2040 use the LittleFS flash filesystem supported by the Raspberry Pi Pico/RP2040 core to allow you to save the entire workspace using save-image.
If when you call save-image you get the error;
Error: 'save-image' problem saving to LittleFS
the most likely explanation is that you didn't set the Flash Size option to the appropriate value to reserve memory for LittleFS before uploading uLisp.
The ARM version of uLisp includes an ARM assembler that allows you to generate machine-code functions, integrated with Lisp, written in ARM thumb code. The assembler itself is written in Lisp to make it easy to extend it or add new instructions. For more information see ARM assembler overview.
Programming the RP2040 registers
For details of directly programming the RP2040 registers from uLisp see Programming ARM registers.
Adafruit QT Py RP2040
The QT Py RP2040  provides 8 MByte of flash, and includes a NeoPixel LED:
A Stemma QT connector lets you daisy-chain I2C sensors and displays.
The Adafruit QT Py RP2040 doesn't have an LED.
The NeoPixel is connected to digital pin 12, and its power is on digital pin 11.
The Adafruit QT Py RP2040 has four analogue inputs which you can access on digital pins 26 (A3), 27 (A2), 28 (A1), and 29 (A0). They have 12-bit precision.
You can generate an analogue output using PWM on any of the digital pins. By default the precision is 8 bits, but you can change it to a value from 4 to 16 bits by calling, for example:
You can use the note function to play tunes on any pin. For example, the following function scale plays the scale of C on the specified pin:
(defun scale (pin) (mapc (lambda (n) (note pin n 4) (delay 500)) '(0 2 4 5 7 9 11 12)) (note))
For example, connect a piezo speaker between digital pin 10 and GND, and evaluate:
The Adafruit QT Py RP2040 has one accessible serial port: Serial1 on pin numbers 20 (TX) and 5 (RX).
The Adafruit QT Py RP2040 has one accessible SPI port: SPI0 on pin numbers 4 (MISO), 3 (MOSI), and 6 (SCK).
The Adafruit QT Py RP2040 has two I2C ports: Wire0 on pin numbers 24 (SDA) and 25 (SCL), and Wire1 on pin numbers 22 (SDA) and 23 (SCL) which are accessible on the Stemma QT connector.
Seeed Studio XIAO RP2040
The Seeed Studio XIAO RP2040 has an RGB LED connected on pin 17 (red), and a blue/green LED on pins 16 (green) and 25 (blue). Note that the LEDs are turned on with nil (or 0), and off with t (or 1).
You can flash the red LED with the following program:
(defun blink (&optional x) (pinmode :led-builtin :output) (digitalwrite :led-builtin x)
(delay 1000) (blink (not x)))
Run it by typing:
The Seeed Studio XIAO RP2040 has 4 analogue inputs which you can access on pins 26 (A0) to 29 (A3). They have 12-bit precision.
You can generate an analogue output using PWM on any of the digital pins. The precision is 8 bits.
In addition to the RGB LED, the Seeed Studio XIAO RP2040 has a Neopixel on pin number 12, with the power on pin number 11.
The Seeed Studio XIAO RP2040 has one serial port on pin numbers 1 (RX) and 0 (TX). By default the baud rate is 9600.
The Seeed Studio XIAO RP2040 has one SPI port on pin numbers 4 (MISO), 3 (MOSI), and 2 (SCK).
The Seeed Studio XIAO RP2040 has one I2C port on pin numbers 6 (SDA) and 7 (SCL).