Adafruit Feather RP2350 HSTX

The Feather RP2350 HSTX is Adafruit's Feather-format board based on the Raspberry Pi RP2350:

FeatherRP2350.jpg

The board is based on the Raspberry Pi RP2350 running at 150MHz, with 8MB of flash and 520KB of on-chip SRAM. The board has space to fit up to 8MB of PSRAM, or can be bought pre-populated with 8MB of PSRAM [1]. The HSTX port provides 8 additional I/O pins, or can be used to drive a DVI or HDMI display.

Installing uLisp from the Arduino IDE

Install the Raspberry Pi Pico/RP2040/RP2350 core

  • Add the following URL to the Additional Boards Manager URLs list in the Arduino IDE Preferences dialog box:
https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
  • In the Arduino IDE search for the Raspberry Pi Pico/RP2040/RP2350 core in Boards Manager and install it. I used version 4.5.0.
  • Select Raspberry Pi RP2040 from the Board menu, and Adafruit Feather RP2350 HSTX from the submenu.
  • Set PSRAM Size to the size of PSRAM fitted to the board. If you bought it with PSRAM already fitted this is 8MByte PSRAM.
  • Set Flash Size to the option 8MB (Sketch: 1MB, FS: 7MB).

This option allocates 7MB for use by LittleFS for use with save-image.

  • Set CPU Architecture to ARM or RISC-V to choose which core you want to use.

You can leave all the other options at their defaults.

Using PSRAM

  • Uncomment the #define BOARD_HAS_PSRAM in the ARDUINO_ADAFRUIT_FEATHER_RP2350_HSTX section of the Platform specific settings at the start of the uLisp source.
  • Because garbage collections take over a second with 8 MB of PSRAM I also recommend commenting out the printfreespace option as follows:
// #define printfreespace

Otherwise there's a delay before the uLisp prompt is printed each time while the free space is calculated.

Upload uLisp

  • Download release 4.8 or later of the ARM version of uLisp from the Download uLisp page.
  • Select the board's USB port from the Port menu, or UF2 Board if that option is shown.
  • 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.

Putting the board into upload mode

If the upload fails you may need to put the board into upload mode:

  • Press and hold the BOOT button.
  • Press the RESET button.
  • Release the BOOT button.

The upload should then continue to completion.

Error on 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.

P2350-E9 Errata

A bug has been reported in the current A2 batch of RP2350 chips that means that in some cases when an input pin is being driven by a weak (high impedance) input, it may not read properly. There are workarounds for most practical applications; see the RP2350-E9 Errata for more details.

Fitting PSRAM

If you don't buy the Feather RP2350 HSTX board with PSRAM already fitted you can fit it yourself later:

FeatherRP2350PSRAM.jpg

A suitable part is the APS6404L-3SQR-SN from AP Memory available from Mouser [2], or an equivalent part from Adafruit [3].

Note that the PSRAM uses pin 8 as the chip select, so this won't be available for other uses.

Using the Feather RP2350 HSTX board

Pinout

The following diagram shows the main board connections:

FeatherRP2350Pins.gif

For a full pinout see Adafruit Feather RP2350

LEDs

The Feather RP2350 HSTX has a red LED connected to digital pin 7 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)

All pins can also be used for analogue (PWM) output, so you can pulsate the LED slowly on and off with the program:

(defun pulse ()
  (let (down)
    (loop
     (dotimes (x 256) 
       (delay 5) 
       (analogwrite :led-builtin (if down (- 255 x) x)))
(setq down (not down)))))

Run it by typing:

(pulse)

Exit from either program by entering ~.

Neopixel

The Feather RP2350 HSTX has a Neopixel RGB LED on pin 21. You can control it using the NeoPixel extension.

Analogue inputs

The Feather RP2350 HSTX has four analogue inputs which you can access on digital pins 26, 27, 28, and 29. They have 12-bit precision.

Analogue outputs

You can generate an analogue output using PWM on any of the digital pins 0 to 29. By default the precision is 8 bits, but you can change it to a value from 4 to 16 bits by calling, for example:

(analogwriteresolution 16)

Playing notes

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:

(scale 10)

Serial

The Feather RP2350 HSTX has one accessible serial port: Serial1 on pin numbers 0 (TX) and 1 (RX).

SPI

The Feather RP2350 HSTX has one accessible SPI port: SPI0 on pin numbers 20 (MISO), 23 (MOSI), 22 (SCK) and 21 (SS).

I2C

The Feather RP2350 HSTX has one accessible I2C port: Wire0 on pin numbers 2 (SDA) and 3 (SCL), or on the Stemma QT connector.

Connecting an HDMI display

The HSTX connector connects to the High Speed Transmit (HSTX) peripheral that drives 4 lanes of differential data transmission, such as DVI output, without needing to overclock or use PIO.

HSTX.jpg

To connect an HDMI display you need a few additional components:

For Adafruit GFX graphics support you will need to install the Adafruit DVI HSTX library from Manage Libraries… in the Arduino IDE. The library supports a range of display resolutions from 320x180 to 640x360. Note that the display buffer is in RAM, so the library will reduce the amount of RAM available to uLisp.

ARM and RISC-V assemblers

You can run uLisp on either the ARM or RISC-V core of the RP2350, and it's therefore possible to run either ARM or RISC-V machine code using the defcode function built in to uLisp.

There are both ARM and RISC-V assemblers that you can use to generate machine code from assembler programs; these are written in Lisp to make it easy to extend them or add new instructions. For more information see ARM assembler overview or RISC-V assembler overview.


  1. ^ Adafruit Feather RP2350 HSTX on Adafruit.
  2. ^ APS6404L-3SQR-SN on Mouser.
  3. ^ Generic 64 Mbit Serial Pseudo SRAM on Adafruit.