QT Py SAMD21 and XIAO SAMD21
The ARM version of uLisp supports two diminuitive ARM-based boards: the Adafruit QT Py [1] and the Seeduino XIAO [2]. The boards are both based on ARM M0 SAMD21 processors running at 48MHz, with 256 Kbytes of flash and 32 Kbytes of RAM.
Boards
Common features
Pins
Adafruit QT Py RP2040 and Seeed Studio XIAO RP2040 both have USB type C connectors, and identical form factors and pinouts:
They both have USB type C connectors, and identical form factors and pinouts:
Saving and loading the workspace
On the QT Py and XIAO you can save the entire workspace to flash on the ATSAMD21 chip using save-image.
Adafruit QT Py SAMD21
The Adafruit QT Py SAMD21 [3] is based on the 32-pin ATSAMD21E18A, and is similar to the XIAO:
It has the following additional features:
- NeoPixel RGB LED.
- Stemma QT connector for connecting to I2C sensors and peripherals.
- Reset button.
Installing uLisp from the Arduino IDE
- Add the following URL to the Additional Boards Manager URLs list in the Arduino IDE Preferencesdialog box:
https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
- In the Arduino IDE search for the Adafruit SAMD Boards core in Boards Manager and install it.
- Select Adafruit SAMD (32-bits ARM Cortex-M0+ and Cortex M4) Boards from the Board menu, and Adafruit QT Py (SAMD21) from the submenu.
You can leave all the other options at their defaults.
Upload uLisp
- 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.
Using uLisp
- 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.
NeoPixel RGB display
The Adafruit QT Py SAMD21 doesn't have a built-in LED, but it does have a NeoPixel on pin 11. For information about driving it from an assembler routine see: ARM NeoPixel driver using assembler.
Analogue inputs
The Adafruit QT Py SAMD21 has 9 analogue inputs, on pins 0 to 3 and 6 to 10, with up to 12-bit resolution. Pin 1 can be used as AREF.
Analogue outputs
The Adafruit QT Py SAMD21 has 9 PWM analogue outputs, on pins 2 to 10, and a 10-bit DAC output, on pin 0.
Serial
The Adafruit QT Py SAMD21 has one serial port on pin numbers 7 (RX) and 6 (TX). By default the baud rate is 9600.
SPI
The Adafruit QT Py SAMD21 has two SPI ports. Port 0 is on pin numbers 9 (MISO), 10 (MOSI), and 8 (SCK) and port 1 is on pin numbers 15 (MISO), 16 (MOSI), and 14 (SCK).
I2C
The Adafruit QT-Py SAMD21 has one I2C port on pin numbers 4 (SDA) and 5 (SCL).
Seeed Studio XIAO SAMD21
The Seeed Studio XIAO SAMD21 [4] is based on the 48-pin SAMD21G18:
Installing uLisp from the Arduino IDE
- Add the following URL to the Additional Boards Manager URLs list in the Arduino IDE Preferences dialog box:
https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json
- In the Arduino IDE search for the Seeed SAMD Boards core in Boards Manager and install it.
- Select Seeed SAMD (32-bits ARM Cortex-M0+ and Cortex-M4) Boards from the Board menu, and Seeeduino XIAO from the submenu.
You can leave all the other options at their defaults.
Upload uLisp
- Download the latest ARM version of uLisp from the Download uLisp page.
- Upload uLisp to the board.
Using uLisp
- 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.
Reset
The Seeed Studio XIAO SAMD21 doesn't have a reset button; instead you have to short together two pads marked RST on the top of the board. Short them once to reset the board, or twice in quick succession to enter bootloader mode, when the orange LED will light up.
Indicators
The Seeed Studio XIAO SAMD21 has the following LED indicators:
Label | Colour | Function |
P | Green | Power |
L | Orange | LED-Builtin |
R | Blue | RX |
T | Blue | TX |
LED
The Seeed Studio XIAO SAMD21 has an orange 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 from the program by entering ~.
Analogue inputs
The Seeed Studio XIAO SAMD21 has 11 analogue inputs, on pins 0 to 10, with up to 12-bit resolution. If you want to stay compatible with the QT-Py you should avoid using pins 4 and 5 for analogue input.
Analogue outputs
The Seeed Studio XIAO SAMD21 has 10 PWM analogue outputs, on pins 1 to 10, and a 10-bit DAC output, on pin 0.
Serial
The Seeed Studio XIAO SAMD21 has one serial port on pin numbers 7 (RX) and 6 (TX). By default the baud rate is 9600.
SPI
The Seeed Studio XIAO SAMD21 has one SPI port on pin numbers 9 (MISO), 10 (MOSI), and 8 (SCK).
I2C
The Seeed Studio XIAO SAMD21 has one I2C port on pin numbers 4 (SDA) and 5 (SCL).
- ^ Adafruit QT-Py on Adafruit.
- ^ Seeeduino XIAO SAMD21 on Seeeduino.
- ^ Adafruit QT-Py guide.
- ^ Seeed Studio XIAO SAMD21 - Seeed Wiki.