From 873994107face0b9694b59f3adf90bdf326e6465 Mon Sep 17 00:00:00 2001 From: eightycc Date: Fri, 28 Mar 2025 06:25:15 -0700 Subject: [PATCH] Allow PSRAM overclocking by enabling burst wrap mode. --- src/main.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main.c b/src/main.c index 8283058..2896728 100644 --- a/src/main.c +++ b/src/main.c @@ -395,14 +395,25 @@ static void __no_inline_not_in_flash_func(setup_psram)(void) { } // RESETEN, RESET and quad enable - for (uint8_t i = 0; i < 3; i++) { + for (uint8_t i = 0; i < 4; i++) { qmi_hw->direct_csr |= QMI_DIRECT_CSR_ASSERT_CS1N_BITS; - if (i == 0) { - qmi_hw->direct_tx = 0x66; - } else if (i == 1) { - qmi_hw->direct_tx = 0x99; - } else { - qmi_hw->direct_tx = 0x35; + switch (i) { + case 0: + // RESETEN + qmi_hw->direct_tx = 0x66; + break; + case 1: + // RESET + qmi_hw->direct_tx = 0x99; + break; + case 2: + // Quad enable + qmi_hw->direct_tx = 0x35; + break; + case 3: + // Toggle wrap boundary mode + qmi_hw->direct_tx = 0xc0; + break; } while ((qmi_hw->direct_csr & QMI_DIRECT_CSR_BUSY_BITS) != 0) { }