/PSRAM-Applications

2021: 8MB AP-memory PSRAM with a Teensy 4x or Audioboard using SPI, QSPI, and FlexSPI.

Primary LanguageC++GNU General Public License v3.0GPL-3.0

PSRAM-Applications

A number of 64Mb (8MB) AP Memory Technology APS6404L-3SQN QSPI PSRAM ICs had been obtained from Mouser (Texas), and are being tested through their single and quad SPI memory interface modes, for the latter using the RP2040 Pico (for which there is potential PIO-based r/w QSPI support), and the established QSPI support for the Teensy 4.1 and ESP32's.

For the RP2040 RPi Pico and PSRAM refer to SPI PSRAM via PIO on the RP2040 microcontroller. Also refer to SPI communication with PSRAM fails and How does yocto-8 use SPI RAM.

Picture 1 and 2. Two External PSRAM ICs on 8-pin DIP modules and a Teensy 4.1 with another PSRAM IC soldered to its bottom (Note 2).


Method 1. External PSRAM module connected via Teensy SPI0

An external PSRAM 8-pin DIP module was connected to a Teensy 4.1 with another PSRAM IC soldered to its bottom (Note 2), which in turn, was connected to a Teensy Audio 3 board rev B (Note 1) as shown in picture 3 below:

Table 1. Connections between the external PSRAM module and a Teensy 4.1 (SPI0):

PSRAM Teensy 4.1
1 /CE 10 CS
2 SO/SIO[1] 12 MISO
3 SIO[2] NC
4 VSS GND
5 SI/SIO[0] 11 MOSI
6 SCLK 13 SCLK
7 SIO[3] 3v3
8 VDD 3v3

Note: CS pin 6 is used for the Flash and SRAM mounted directly on the Audio board 3 and 4, bottom pads.

Picture 3. Two External PSRAM 8-pin DIP modules, a socketed 23LC1024, and a Teensy 4.1 (with another PSRAM IC soldered to its bottom) connected to a Teensy Audio 3 board revision B (Note 1).


As an initial check the 8MB-PSRAM module was tested with a modified version of the direct SPI read/write code from here: Problem with 23LC1024 RAM memory - 31 August 2016. The modified file used is also available here as 23LC1024a.ino.

After it was established that the PSRAM can be accessed (read/write) using the same code as for the 23LC1024 SRAM, the Teensy audio code changes as suggested here on 12 August 2021, were made, where the PSRAM was tested as a direct replacement for the 23LC1024 in the audio external-delay module. But as both the direct and the delayed audio had significant audible distortion with no obvious easy solution, any further examination were postponed - a possible reason could be gain overload (tried to lower gain of both wet and dry signals via an amplifier), or the two different handlers for the PSRAM that are active at the same time. The files used are available here as effect_delay_ext.h, effect_delay_ext.cpp, and PassThroughStereo4.ino. Further developments on adding PSRAM to the Audio Board are discussed here:

(a) Compatible PSRAM chips with Teensy 4 (b) Roadmap Dynamic (Audio objects) Updates

Method 2. PSRAM IC directly connected to Teensy 4.1 bottom via QSPI

Using another approach the PSRAM connected to the bottom of the Teensy 4.1 (Note 2), was used as an audio-delay-storage array in the memory-mapped PSRAM, as described here: Audio Effect Delay Pops & Clicks when changing tap times - 5 September 2020. The files used are available here as effect_tapedelay10tap.h, effect_tapedelay10tap.cpp, tapedelay-example.ino (PSRAM version), and tapedelay-orginal.ino (normal version). To compile the PSRAM version, keep the first three files (.h .cpp .ino) in a folder tapedelay-example.

As this second approach worked very well, with no audible distortion and capable of exceptionally long delays, it will be investigated further.

Other similar posts which are aimed at Teensy audio library objects suitable for PSRAM storage are:

Note 1: To connect a Teensy 4.x to an (older) Audio board 3 please refer to Teensy 4.0 I2S Support - 14 Aug 2019.

Note 2: The Teensy 4.1 use special QSPI pins (48,49,50,52,53,54) to connect to the PSRAM pads at its bottom.

Important: The copyright of the various code sections and code files, reside with their owners, as identified by the links provided. Specifically, all Teensy libraries are the property of pjrc.com.