diff --git a/embassy-stm32/CHANGELOG.md b/embassy-stm32/CHANGELOG.md index a6ee5c4b81..0ac1562969 100644 --- a/embassy-stm32/CHANGELOG.md +++ b/embassy-stm32/CHANGELOG.md @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - feat: stm32/usart: add `eager_reads` option to control if buffered readers return as soon as possible or after more data is available ([#4668](https://github.com/embassy-rs/embassy/pull/4668)) - feat: stm32/usart: add `de_assertion_time` and `de_deassertion_time` config options - change: stm32/uart: BufferedUartRx now returns all available bytes from the internal buffer +- change: stm32/(q|o|x)spi: Set the default memory size to the maximum allowable for qspi/ospi/xspi so that the indirect read command is able to read more than 2 bytes. This avoids a potential gotcha. ## 0.4.0 - 2025-08-26 diff --git a/embassy-stm32/src/ospi/mod.rs b/embassy-stm32/src/ospi/mod.rs index 592a8594a3..123bac7de0 100644 --- a/embassy-stm32/src/ospi/mod.rs +++ b/embassy-stm32/src/ospi/mod.rs @@ -69,7 +69,10 @@ impl Default for Config { Self { fifo_threshold: FIFOThresholdLevel::_16Bytes, // 32 bytes FIFO, half capacity memory_type: MemoryType::Micron, - device_size: MemorySize::Other(0), + // We set the default is the maximum size of the memory + // This value limits the possible read length using indirect read mode + // To prevent a gotcha we choose to use a high value + device_size: MemorySize::Other(31), chip_select_high_time: ChipSelectHighTime::_5Cycle, free_running_clock: false, clock_mode: false, diff --git a/embassy-stm32/src/qspi/mod.rs b/embassy-stm32/src/qspi/mod.rs index bb4f4f1d0f..5487ac45fa 100644 --- a/embassy-stm32/src/qspi/mod.rs +++ b/embassy-stm32/src/qspi/mod.rs @@ -72,7 +72,10 @@ pub struct Config { impl Default for Config { fn default() -> Self { Self { - memory_size: MemorySize::Other(0), + // We set the default is the maximum size of the memory + // This value limits the possible read length using indirect read mode + // To prevent a gotcha we choose to use a high value + memory_size: MemorySize::Other(31), address_size: AddressSize::_24bit, prescaler: 128, fifo_threshold: FIFOThresholdLevel::_17Bytes, diff --git a/embassy-stm32/src/xspi/mod.rs b/embassy-stm32/src/xspi/mod.rs index a80a2692b5..989b1ff924 100644 --- a/embassy-stm32/src/xspi/mod.rs +++ b/embassy-stm32/src/xspi/mod.rs @@ -65,7 +65,10 @@ impl Default for Config { Self { fifo_threshold: FIFOThresholdLevel::_16Bytes, // 32 bytes FIFO, half capacity memory_type: MemoryType::Micron, - device_size: MemorySize::Other(0), + // We set the default is the maximum size of the memory + // This value limits the possible read length using indirect read mode + // To prevent a gotcha we choose to use a high value + device_size: MemorySize::Other(31), chip_select_high_time: ChipSelectHighTime::_5Cycle, free_running_clock: false, clock_mode: false,