From e7aeb9b29feaf2ca4bf3ac2cac47583cd9468e88 Mon Sep 17 00:00:00 2001 From: Grant Miller Date: Mon, 16 Oct 2023 19:23:01 -0500 Subject: [PATCH] stm32f1: Keep flash prefetch enabled --- embassy-stm32/src/rcc/f1.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/embassy-stm32/src/rcc/f1.rs b/embassy-stm32/src/rcc/f1.rs index b2ae56dbf..367c88324 100644 --- a/embassy-stm32/src/rcc/f1.rs +++ b/embassy-stm32/src/rcc/f1.rs @@ -102,7 +102,6 @@ pub(crate) unsafe fn init(config: Config) { assert!(pclk2 <= 72_000_000); - // Only needed for stm32f103? FLASH.acr().write(|w| { w.set_latency(if real_sysclk <= 24_000_000 { Latency::WS0 @@ -111,6 +110,8 @@ pub(crate) unsafe fn init(config: Config) { } else { Latency::WS2 }); + // the prefetch buffer is enabled by default, let's keep it enabled + w.set_prftbe(true); }); // the USB clock is only valid if an external crystal is used, the PLL is enabled, and the