Skip to content

Fix RP2350 boards with PSRAM crashing after raising the CPU speed - #11516

Merged
dhalbert merged 2 commits into
adafruit:mainfrom
mikeysklar:rp2350-psram-clkdiv
Oct 7, 2026
Merged

dhalbert merged 2 commits into
adafruit:mainfrom
mikeysklar:rp2350-psram-clkdiv

Conversation

@mikeysklar

@mikeysklar mikeysklar commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

What

PSRAM clock divider and read delay now follow the CPU speed.

Why

Setting microcontroller.cpu.frequency above 150 MHz corrupted PSRAM reads, then crashed into safe mode.

import microcontroller
microcontroller.cpu.frequency = 250_000_000
b = bytearray(4 * 1024 * 1024)  # lands in PSRAM

Uses the arduino-pico rule: SCK at or under 133 MHz, read delay matched to the divider. Follows up #11250.

Hardware tested

Fruit Jam (8 MB PSRAM)

How I tested it

Cold boot, set the clock, then write and verify 4 MB of PSRAM:

Clock Before After
150 MHz OK OK
200 MHz MemoryError OK
216 to 300 MHz Hard fault, safe mode OK

AI assistance

Claude Code helped find, fix and test this on my Fruit Jam.

mikeysklar and others added 2 commits October 5, 2026 17:46
mcu_processor_update_psram_timing() kept CLKDIV at 2 and RXDELAY at 1 at
every system clock. After microcontroller.cpu.frequency was raised, PSRAM
reads came back wrong: a 4 MB bytearray raised MemoryError at 200 MHz and
hard faulted from 216 MHz up, rebooting into safe mode.

Pick CLKDIV so PSRAM SCK stays at or below 133 MHz and RXDELAY to match,
the same rule arduino-pico uses for the APS6404.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@dhalbert dhalbert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dhalbert
dhalbert merged commit 41be5a3 into adafruit:main Oct 7, 2026
175 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants