My projects keep running out of RAM. Graphics are the worst for it: on the Waveshare RP2350 Touch 2.8C, the frame buffer for that big round display eats most of the memory before my code gets a look in. On the RP2040 that was the end of the story. On the RP2350 there’s another option: bolt on some PSRAM.
I’ve now made two videos about this. In the first I soldered PSRAM chips onto boards, worked out where the memory lives and got the compiler to use it. It worked, and it was slow, and I put that down to PSRAM just being slow. In the second I found out the slowness was my fault. I’d never switched the chip into Quad mode. With that fixed, and a system clock picked to suit the chip, my PSRAM test runs 5.3 times faster.
This post pulls both videos together: everything you need to get PSRAM working on an RP2350, and then running at full speed.
Videos: I Added PSRAM to My RP2350 Projects · The PSRAM Setting I Missed (and the Clock Speed That Fixes It)
Code for three boards: jondurrant/RP2350-PSRAM-Exp
What PSRAM is, and where it lives

The RP2350 has 520 KB of on-chip SRAM: 512 KB of main RAM for your globals, heap and stack, plus two 4 KB scratch banks used for things like the second core’s stack. That’s all there is, and once it’s gone, it’s gone. You optimise your code or rethink the design.
PSRAM (pseudo-static RAM) is an external RAM chip on a serial bus. The RP2350 can map up to 16 MB of it into its address space. The chip I use, the APS6404L, is 64 Mbit, or 8 MB.
A few things about how it’s wired in matter later:
- It shares the QSPI bus with the flash. If you look at a board’s schematic, most of the lines to the PSRAM footprint are the same lines that go to the flash chip.
- It has its own chip select. Flash uses the dedicated QSPI_SS pin and appears at
0x10000000. PSRAM uses chip select 1 and appears at0x11000000. That’s the magic number for the rest of this post. - Chip select 1 is an ordinary GPIO set to the
XIP_CS1function. On the Pimoroni Pico Plus 2 and the Waveshare RP2350 Pi Zero it’s GPIO 47. On the Waveshare Touch 2.8C it’s GPIO 0. - You don’t talk to the chip directly. Reads and writes go through the XIP cache, 16 KB of on-chip cache in front of the bus. The RP2350 pulls a chunk of PSRAM into cache, you work on that, and it gets written back. It’s the same mechanism used to run code from flash.
The boards, and the soldering

Not every RP2350 board can take PSRAM. A plain Pico 2 has no footprint for it and doesn’t expose the pins you’d need. Of the boards I used:
- Pimoroni Pico Plus 2 comes with 8 MB of PSRAM already fitted. I started here, so I could prove my code worked before I trusted my soldering.
- Waveshare RP2350 Pi Zero has an empty footprint for a PSRAM chip, so I soldered one on.
- Waveshare RP2350 Touch LCD 2.8C also has the footprint. This was the board I actually needed the memory for, and the one I was most nervous about putting an iron to.

The APS6404L is an 8-pin SOIC part, so it’s not hard to solder, but it needs a steady hand. Mine aren’t always steady. A reasonably expensive display board is not the place to practise.

The Touch 2.8C also taught me not to assume. Every other board had PSRAM chip select on GPIO 47, so I assumed this one did too. It’s GPIO 0, and the documentation doesn’t make that obvious. I lost a few hours re-soldering a perfectly good joint before I found it was a one-line code change. Whichever board you use, find the GPIO with the XIP_CS1 function before you blame the soldering.
Part 1: getting PSRAM working (before SDK 2.3)
Raw access
The simplest way in is to treat the PSRAM as a block of memory at 0x11000000. Two lines of set-up: give the chip select pin its XIP_CS1 function, and tell the XIP controller that this region is writable (it’s RAM, not flash):
gpio_set_function(47, GPIO_FUNC_XIP_CS1); // CS for PSRAMxip_ctrl_hw->ctrl |= XIP_CTRL_WRITABLE_M1_BITS;int *psram = (int *)0x11000000;runTest(psram, TEST_SIZE);
My test fills an array of ints, reads it back, and times both. It worked first time on the Pico Plus 2. It was a lot slower than SRAM, which I expected: SRAM sits right next to the cores on a wide internal bus, while PSRAM is outside the chip on a serial one. Still usable, I thought. (Hold that thought.)
Telling the linker about it
Raw pointers are fine for one big buffer, but I wanted to place ordinary global variables in PSRAM. That means a custom linker script. I copied the one the Pico SDK generates and added a PSRAM region and a section to go in it:
PSRAM(rwx) : ORIGIN = 0x11000000, LENGTH = (8 * 1024 * 1024)....psram (NOLOAD): { . = ALIGN(4); *(.psram*)} > PSRAM
CMake loads it with pico_set_linker_script(), and then any global can be marked for PSRAM:
__attribute__((section(".psram"))) uint8_t test_psramA[0x40000];
It’s a bit verbose, and it only works for globals: anything declared inside a function lives on the stack. Also check the flash and PSRAM sizes in the script match your board. RAM and scratch are the same on every RP2350, but flash and PSRAM vary.
The test that passed with no chip fitted
Here’s a trap. Before soldering the chip onto the Pi Zero, I ran the code on the bare board, and the test passed. No write failures. I was briefly very impressed.
The cache explains it. My test wrote each value and immediately read it back, and that read came straight from the XIP cache, so it never needed a chip at all. To catch it properly I added a SHA-256 over the whole buffer, in SRAM and in PSRAM. With no chip, the two hashes differ. With the chip fitted, they match. If you’re testing PSRAM, check the data over a region well bigger than the 16 KB cache, not just one value at a time.
Part 2: what I got wrong

Then, in July 2026, Pico SDK 2.3.0 brought a new hardware_psram library, and I said at the time it would change how we use PSRAM. When I went back to try it, I found out why my PSRAM had been so slow.
My Part 1 code did two things: set the chip select function and made the region writable. It worked, so I assumed the bus was set up. After all, it’s already driving the flash. Bad assumption. The bus to the PSRAM was still in plain single-bit SPI: one data line, one bit per clock. The APS6404L can do Quad SPI: four data lines (SD0 to SD3), four bits per clock. I’d just never told it to.

Getting into Quad mode takes a command to the chip (0x35, Enter Quad Mode), then quad reads (0xEB, with six wait cycles while the chip fetches) and quad writes (0x38). The good news is you don’t need to know any of that. hardware_psram does it all inside psram_reinitialize(), with no QMI register poking.
The clock that sets PSRAM speed

Quad mode is half the story. The other half is the clock.
The PSRAM clock is the system clock divided by a whole number, and the APS6404L is rated to 133 MHz, which is also the SDK’s default ceiling. The divider has to keep PSRAM at or under that:
| System clock | Divider | PSRAM clock |
|---|---|---|
| 150 MHz (stock) | ÷2 | 75 MHz |
| 200 MHz | ÷2 | 100 MHz |
| 250 MHz | ÷2 | 125 MHz |
| 266 MHz | ÷2 | 133 MHz, the chip’s maximum |
| 300 MHz | ÷3 | 100 MHz |
| 400 MHz | ÷4 | 100 MHz |
That 300 MHz row is the trap. Push the CPU faster and the divider steps up, so the PSRAM gets slower. 266 MHz is the sweet spot: it’s the clock that fits the chip. (One more detail from the SDK source: above 100 MHz on the PSRAM side, the library adds an extra cycle of receive delay to keep reads reliable.)
The set-up, in order

In CMake, link hardware_psram. The library runs at start-up all by itself, using the PSRAM size and chip select from the board header. But it sets PSRAM up for the clock you boot at, 150 MHz. To use 266 MHz, do it again first thing in main():
vreg_set_voltage(VREG_VOLTAGE_1_15); // a little more core voltagesleep_ms(10);set_sys_clock_khz(266000, true); // 266 / 2 = 133 MHz PSRAM// Not set for you when the PSRAM size is fixed in the board headergpio_set_function(PICO_PSRAM_CS_PIN, GPIO_FUNC_XIP_CS1);psram_configure_params(PICO_DEFAULT_PSRAM_MAX_FREQ, PICO_DEFAULT_PSRAM_MAX_SELECT, PICO_DEFAULT_PSRAM_MIN_DESELECT);psram_reinitialize(); // Quad mode, new timings
psram_configure_params() works out the divider and timings for the new clock (2, at 266 MHz), and psram_reinitialize() puts the chip into Quad mode.
Then allocate. psram_or_malloc() gives you a static buffer in PSRAM, or quietly falls back to malloc if the board has no PSRAM, which is handy for code that runs on several boards:
psram_or_malloc("test_psram", int, test_psram, TEST_SIZE);
One warning from the SDK docs: psram_reinitialize() is unsafe if the other core or an interrupt handler is running from flash or PSRAM at the same moment. Call it before you start the second core or anything interrupt-heavy.
Telling the SDK about your PSRAM

hardware_psram needs to know the chip select pin and the PSRAM size. How you tell it depends on the board:
hardware_psram needs to know the chip select pin and the PSRAM size. How you tell it depends on the board:
- The board header already has it. The Pimoroni Pico Plus 2’s board file defines
PICO_PSRAM_CS_PINandPICO_PSRAM_SIZE_BYTES. Just link the library. - Your own board header. My Pi Zero’s PSRAM is something I added, so its board file knows nothing about it. Copy the board file into a
boardsfolder in your project, add the two PSRAM defines, and point CMake at it. No linker script needed. This is the cleanest:
c
#define PICO_PSRAM_CS_PIN 47
pico_board_cmake_set_default(PICO_PSRAM_SIZE_BYTES, (8 * 1024 * 1024))
#define PICO_PSRAM_SIZE_BYTES (8 * 1024 * 1024)
cmake
set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}/boards)
set(PICO_BOARD waveshare_rp2350_pizero_psram)
- Compile definitions plus a custom linker script. It works, but now you’re maintaining your own linker file. It’s in the repo (
psram-sdk2-3-1for the Pi Zero) if you want to compare.
The results

My benchmark writes and reads a 128 KB buffer of ints (well beyond the 16 KB cache, so it really is testing PSRAM), then runs the RP2350’s hardware SHA-256 over it, which proves the data is right as well as timing it. All times in microseconds, lower is better:
| Run | Write and read test | SHA-256 |
|---|---|---|
| SRAM, 150 MHz | 1,777 | 4,409 |
| PSRAM, single-bit SPI (my Part 1 set-up) | 42,762 | 13,084 |
| PSRAM, Quad, 75 MHz (stock clock) | 13,956 | 8,362 |
| PSRAM, Quad, 133 MHz (266 MHz clock) | 8,110 | 4,694 |
| SRAM, 266 MHz | 1,010 | 2,483 |
The old SPI set-up was 24 times slower than SRAM on the write test. No wonder I thought PSRAM was slow.
Just letting hardware_psram switch to Quad mode made the write test 3 times faster. The 266 MHz clock gave another 1.7 times on top. Overall, 5.3 times faster than where I started. The SHA run is 2.8 times faster overall, and PSRAM at 266 MHz now hashes the buffer in about the time SRAM took at the stock clock.

To be fair, though: raising the clock speeds up everything, not just PSRAM. SRAM at 266 MHz does the SHA in 2,483, so PSRAM is still about twice as slow as SRAM for this job, the same ratio as at 75 MHz. What the clock tuning does is let PSRAM keep pace with a faster CPU. The CPU and PSRAM clocks rose together in these runs, so I can’t split the gain between them exactly. The big structural win is Quad mode. The clock is the bonus on top, as long as you pick one that suits the chip.
Watch out for

- Check your chip select GPIO. 47 on some boards, 0 on the Touch 2.8C. Find the one with the
XIP_CS1function. - Set the CS pin function yourself when the PSRAM size is fixed in the board header. The library doesn’t do it for you in that case.
- Call
psram_reinitialize()first thing inmain(), before the second core or interrupts are running from flash or PSRAM. - Flash shares the bus. Raising the system clock speeds up the flash clock too, so check your board’s flash divider,
PICO_FLASH_SPI_CLKDIV. - 266 MHz is an overclock. The RP2350 is rated at 150 MHz. Mine has been fine at 1.15 V, but test your own board and keep the voltage steps small.
- Faster isn’t always better. 300 MHz gives you slower PSRAM than 266.
- Test data, not just timing. A write-then-read check can pass from the cache with no chip fitted. Hash a large region.
So is PSRAM worth it?
For display projects with big frame buffers, yes. They need space more than they need speed, and PSRAM at full speed is now a much better deal than the PSRAM I was running last year.
But it’s still nothing like just adding more RAM. You have to plan where things live, think about which data can tolerate the slower memory, and maybe even manage your own heaps so you can choose where each allocation comes from. Treat it as part of the design, not an afterthought.
Next, I’m planning to go back to my Touch 7 board to see whether LVGL with its frame buffers in Quad-mode PSRAM helps its stability.
All the code, for the Pico Plus 2, the Pi Zero and the Touch 2.8C, is in the repo. If you’re new to building my projects, I have a post on cloning and building them. Are you using PSRAM, and what for? Tell me in the comments on the video. I read every one.
Thanks to wolfSSL
The revisit video was sponsored by wolfSSL. The SHA-256 I’ve been timing is exactly the work a device does every time it opens a secure connection. wolfSSL is a small, fast TLS library for embedded devices, up to TLS 1.3, and it’s what I’ve used on the Pico since my first IoT project, for MQTT over TLS and later WebSockets. On the RP2350 it uses the chip’s true random number generator and assembly-optimised maths, and their wolfBoot bootloader adds secure boot on the Pico 2. With 8 MB of PSRAM running at full speed, there’s plenty of room for TLS alongside your application.
Get my videos first
Channel members see every new video before it goes public. Membership also helps me keep making these deep dives and get to Open Sauce 2027. If you’d like to join, you can sign up here.
The PSRAM Revisited video was sponsored by wolfSSL, and this post contains a wolfSSL partner link. The Waveshare links are affiliate links. Both cost you nothing extra and help keep the channel running. The Pimoroni link is a plain shop link.
