From 4112e336ef51edf99d3d1f0b5a15c147bdc556d8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Feb 2026 15:51:37 +0100 Subject: [PATCH 1/2] add slow read --- firmware/zedboard-bsp/src/qspi_spansion.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/firmware/zedboard-bsp/src/qspi_spansion.rs b/firmware/zedboard-bsp/src/qspi_spansion.rs index 9eafd3b..b2e487d 100644 --- a/firmware/zedboard-bsp/src/qspi_spansion.rs +++ b/firmware/zedboard-bsp/src/qspi_spansion.rs @@ -533,11 +533,16 @@ impl QspiSpansionS25Fl256SIoMode { } } - pub fn read_page_fast_read(&self, addr: u32, buf: &mut [u8], dummy_byte: bool) { + fn generic_read_page(&self, addr: u32, buf: &mut [u8], dummy_byte: bool, fast_read: bool) { let mut qspi = self.0.borrow_mut(); let mut transfer = qspi.transfer_guard(); + let reg_id = if fast_read { + RegisterId::FastRead + } else { + RegisterId::Read + }; let raw_word: [u8; 4] = [ - RegisterId::FastRead as u8, + reg_id as u8, ((addr >> 16) & 0xff) as u8, ((addr >> 8) & 0xff) as u8, (addr & 0xff) as u8, @@ -611,6 +616,15 @@ impl QspiSpansionS25Fl256SIoMode { } } } + + pub fn read_page_fast_read(&self, addr: u32, buf: &mut [u8], dummy_byte: bool) { + self.generic_read_page(addr, buf, dummy_byte, true) + } + + /// Only works if the clock speed is slower than 50 MHz according to datasheet. + pub fn read_page_read(&self, addr: u32, buf: &mut [u8]) { + self.generic_read_page(addr, buf, false, false) + } } /// If the Spansion QSPI is used in linear addressed mode, no IO operations are allowed. -- 2.43.0 From 3eb8467bf5451ccc164165c9cdee58331b8d755c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Feb 2026 15:57:21 +0100 Subject: [PATCH 2/2] add register double read --- firmware/zedboard-bsp/src/qspi_spansion.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/firmware/zedboard-bsp/src/qspi_spansion.rs b/firmware/zedboard-bsp/src/qspi_spansion.rs index b2e487d..418b829 100644 --- a/firmware/zedboard-bsp/src/qspi_spansion.rs +++ b/firmware/zedboard-bsp/src/qspi_spansion.rs @@ -565,7 +565,10 @@ impl QspiSpansionS25Fl256SIoMode { let mut reply_word_index = 0; while read_index < buf.len() { - if transfer.read_status().rx_above_threshold() { + let rx_is_above_threshold = transfer.read_status().rx_above_threshold(); + + // See p.374 of the TRM: Do a double read to ensure this is correct information. + if rx_is_above_threshold && transfer.read_status().rx_above_threshold() { let reply = transfer.read_rx_data(); if reply_word_index == 0 { reply_word_index += 1; -- 2.43.0