Seeed Studio XIAO nRF52840
The Seeed Studio XIAO nRF52840  and XIAO nRF52840 Sense  are each based on the Nordic Semiconductor nRF52840 ARM Cortex-M4 microcontroller running at 64 MHz, and with 1 Mbyte of flash program memory and 256 Kbytes of RAM. They also include 2 Mbytes of DataFlash that uLisp uses to allow you to save and reload the Lisp image. They also include an RGB LED, and a BQ25101 battery charge management chip. There's a tiny reset button to the left of the USB-C connector
The Sense version (above right) also includes two additional on-board sensors:
- An MSM261D3526H1CPM digital microphone which interfaces with the Pulse Density Modulation (PDM) module on the nRF52840 chip. It can receive audio data in real-time which allows it can be used for audio recognition.
- An LSM6DS3TR-C  6-axis Inertial Measurement Unit (IMU).
Install the ARM version of uLisp for use with these boards.
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 Seeed nRF52 Boards from the Board menu, and the appropriate board from the submenu.
You can leave all the other options at their defaults.
- Download the latest ARM version of uLisp from the Download uLisp page.
- Upload uLisp to the board.
You should then be able to select the USB port from the Port menu, select Serial Monitor from the Tools menu, and enter Lisp commands.
Digital inputs and outputs
The XIAO nRF52840 boards provide 11 digital inputs/outputs, on pin numbers 0 to 10.
The XIAO nRF52840 boards have an RGB LED on pins 11 (red), 13 (green), and 12 (blue). You can access the red LED with the keyword :led-builtin. For example, you can flash it 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:
Exit from the program by entering ~.
These pins can also be used as analogue output pins, so you can pulsate the green LED slowly on and off with the program:
(defun pulse () (let (down) (loop (dotimes (x 256) (delay 5) (analogwrite 13 (if down (- 255 x) x))) (setq down (not down)))))
Run it by typing:
Exit from either program by entering ~.
There are six analogue inputs on pin 0 to 5.
The XIAO nRF52840 boards have one accessible serial port: Serial1 on pin numbers 20 (TX) and 5 (RX).
The XIAO nRF52840 boards have one accessible SPI port on pin numbers 9 (MISO), 10 (MOSI), and 8 (SCK).
The XIAO nRF52840 boards have two I2C ports: port 0 on pin numbers 4 (SDA) and 5 (SCL), and port 1 on pin numbers 17 (SDA) and 16 (SCL) which are used for the on-board sensors. In addition, the LM6DS3 uses pin 15 for power and pin 18 for interrupts.
There is a PDM (Pulse Density Modulation) interface on pins 19 (PWR), 20 (CLK), and 21 (DIN).