Skip to content

Refactor PSRAM clock frequency handling#19224

Open
phuzzyday wants to merge 3 commits into
micropython:masterfrom
phuzzyday:patch-1
Open

Refactor PSRAM clock frequency handling#19224
phuzzyday wants to merge 3 commits into
micropython:masterfrom
phuzzyday:patch-1

Conversation

@phuzzyday
Copy link
Copy Markdown

@phuzzyday phuzzyday commented May 15, 2026

Read clock speed before entering direct mode (flash access is unavailable while QMI direct mode is enabled)

Summary

Fix PSRAM init crash when system clock differs from default
Move clock_get_hz() call before QMI direct mode is enabled.
Flash access is unavailable during direct mode, causing a bus fault
on the instruction fetch when clock_configure_undivided is not
in the XIP cache. Confirmed via debugprobe on WeAct RP2350A.

NOTE - Failed Checks are happening in areas of the code far away from what I changed.

Tested on multiple RP2350 boards. (Weact.)

Generative AI

I used generative AI tools when creating this PR, but a human has checked the
code and is responsible for the code and the description above. (earlphilhower)

Read clock speed before entering direct mode (flash access is
unavailable while QMI direct mode is enabled)

Signed-off-by: phuzzyday <phuzzyd@yahoo.ca>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

Code size report:

Reference:  tests: Update ESP32-Cx detection to match standard name. [334c031]
Comparison: Fix formatting of comments in rp2_psram.c [merge of a21b9b0]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
      esp32:    +0 +0.000% ESP32_GENERIC
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

phuzzyday added 2 commits May 14, 2026 22:34
Removed blank space

Signed-off-by: phuzzyday <phuzzyd@yahoo.ca>
Signed-off-by: phuzzyday <phuzzyd@yahoo.ca>
@agatti
Copy link
Copy Markdown
Contributor

agatti commented May 15, 2026

NOTE - Failed Checks are happening in areas of the code far away from what I changed.

If with failed checks you mean the CI errors, then those are related to your changes. Given what you committed I reckon you probably didn't read CODECONVENTIONS.md and maybe didn't set up the environment as described in that document.

Just in case, please read that document. There's all the necessary information to not cause the two CI errors you see here.

Also, since the commits have to be altered, please squash those three commits into just one atomic change. You're just making minor modifications to your main change, after all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants